mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 02:12:30 +01:00
convert more subtitle codecs #418
This commit is contained in:
parent
b1f611099c
commit
1a574c02b2
@ -131,6 +131,12 @@ function getPerStreamFlags({ stream, outputIndex, outFormat, manuallyCopyDisposi
|
||||
} else if (outFormat === 'webm' && stream.codec_name === 'mov_text') {
|
||||
// Only WebVTT subtitles are supported for WebM.
|
||||
addCodecArgs('webvtt');
|
||||
} else if (outFormat === 'srt') { // not technically lossless but why not
|
||||
addCodecArgs('srt');
|
||||
} else if (outFormat === 'ass') { // not technically lossless but why not
|
||||
addCodecArgs('ass');
|
||||
} else if (outFormat === 'webvtt') { // not technically lossless but why not
|
||||
addCodecArgs('webvtt');
|
||||
} else {
|
||||
addCodecArgs('copy');
|
||||
}
|
||||
|
@ -111,3 +111,33 @@ test('getStreamIdsToCopy, includeAllStreams false', () => {
|
||||
expect(streamIdsToCopy).toEqual([2, 1, 7]);
|
||||
expect(excludedStreamIds).toEqual([0, 3, 4, 5, 6]);
|
||||
});
|
||||
|
||||
test('srt output', () => {
|
||||
expect(getMapStreamsArgs({
|
||||
allFilesMeta: { [path]: { streams: [{ index: 0, codec_type: 'subtitle', codec_tag: '0x67337874', codec_name: 'mov_text' }] } },
|
||||
copyFileStreams: [{ path, streamIds: [0] }],
|
||||
outFormat: 'srt',
|
||||
})).toEqual([
|
||||
'-map', '0:0', '-c:0', 'srt',
|
||||
]);
|
||||
});
|
||||
|
||||
test('webvtt output', () => {
|
||||
expect(getMapStreamsArgs({
|
||||
allFilesMeta: { [path]: { streams: [{ index: 0, codec_type: 'subtitle', codec_tag: '0x67337874', codec_name: 'mov_text' }] } },
|
||||
copyFileStreams: [{ path, streamIds: [0] }],
|
||||
outFormat: 'webvtt',
|
||||
})).toEqual([
|
||||
'-map', '0:0', '-c:0', 'webvtt',
|
||||
]);
|
||||
});
|
||||
|
||||
test('ass output', () => {
|
||||
expect(getMapStreamsArgs({
|
||||
allFilesMeta: { [path]: { streams: [{ index: 0, codec_type: 'subtitle', codec_tag: '0x67337874', codec_name: 'mov_text' }] } },
|
||||
copyFileStreams: [{ path, streamIds: [0] }],
|
||||
outFormat: 'ass',
|
||||
})).toEqual([
|
||||
'-map', '0:0', '-c:0', 'ass',
|
||||
]);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user