kopia lustrzana https://github.com/mifi/lossless-cut
add default subtitle codec too
rodzic
9dc15267c8
commit
461e909e47
|
@ -213,12 +213,7 @@ async function getAllStreams(filePath) {
|
|||
return JSON.parse(result.stdout);
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/32922226/extract-every-audio-and-subtitles-from-a-video-with-ffmpeg
|
||||
async function extractAllStreams(filePath) {
|
||||
const { streams } = await getAllStreams(filePath);
|
||||
console.log('streams', streams);
|
||||
|
||||
function mapCodecToOutputFormat(codec, type) {
|
||||
function mapCodecToOutputFormat(codec, type) {
|
||||
const map = {
|
||||
// See mapFormat
|
||||
m4a: { ext: 'm4a', format: 'ipod' },
|
||||
|
@ -237,10 +232,16 @@ async function extractAllStreams(filePath) {
|
|||
};
|
||||
|
||||
if (map[codec]) return map[codec];
|
||||
if (type === 'video') return { ext: 'mkv', format: 'mkv' };
|
||||
if (type === 'audio') return { ext: 'mkv', format: 'mkv' };
|
||||
if (type === 'video') return { ext: 'mkv', format: 'matroska' };
|
||||
if (type === 'audio') return { ext: 'mka', format: 'matroska' };
|
||||
if (type === 'subtitle') return { ext: 'mks', format: 'matroska' };
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/32922226/extract-every-audio-and-subtitles-from-a-video-with-ffmpeg
|
||||
async function extractAllStreams(filePath) {
|
||||
const { streams } = await getAllStreams(filePath);
|
||||
console.log('streams', streams);
|
||||
|
||||
const outStreams = streams.map((s, i) => ({
|
||||
i,
|
||||
|
|
Ładowanie…
Reference in New Issue