mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 02:12:30 +01:00
parent
c66cb88de7
commit
56cd37dde8
@ -2,17 +2,6 @@ import invariant from 'tiny-invariant';
|
|||||||
import { FFprobeStream, FFprobeStreamDisposition } from '../../../../ffprobe';
|
import { FFprobeStream, FFprobeStreamDisposition } from '../../../../ffprobe';
|
||||||
import { AllFilesMeta, ChromiumHTMLAudioElement, ChromiumHTMLVideoElement, CopyfileStreams, LiteFFprobeStream } from '../types';
|
import { AllFilesMeta, ChromiumHTMLAudioElement, ChromiumHTMLVideoElement, CopyfileStreams, LiteFFprobeStream } from '../types';
|
||||||
|
|
||||||
// https://www.ffmpeg.org/doxygen/3.2/libavutil_2utils_8c_source.html#l00079
|
|
||||||
const defaultProcessedCodecTypes = new Set([
|
|
||||||
'video',
|
|
||||||
'audio',
|
|
||||||
'subtitle',
|
|
||||||
'attachment',
|
|
||||||
]);
|
|
||||||
|
|
||||||
const unprocessableCodecs = new Set([
|
|
||||||
'dvb_teletext', // ffmpeg doesn't seem to support this https://github.com/mifi/lossless-cut/issues/1343
|
|
||||||
]);
|
|
||||||
|
|
||||||
// taken from `ffmpeg -codecs`
|
// taken from `ffmpeg -codecs`
|
||||||
export const pcmAudioCodecs = [
|
export const pcmAudioCodecs = [
|
||||||
@ -235,9 +224,26 @@ export function getMapStreamsArgs({ startIndex = 0, outFormat, allFilesMeta, cop
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function shouldCopyStreamByDefault(stream: FFprobeStream) {
|
export function shouldCopyStreamByDefault(stream: FFprobeStream) {
|
||||||
if (!defaultProcessedCodecTypes.has(stream.codec_type)) return false;
|
// https://www.ffmpeg.org/doxygen/3.2/libavutil_2utils_8c_source.html#l00079
|
||||||
if (unprocessableCodecs.has(stream.codec_name)) return false;
|
switch (stream.codec_type) {
|
||||||
return true;
|
case 'audio':
|
||||||
|
case 'attachment':
|
||||||
|
case 'video': {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case 'subtitle': {
|
||||||
|
return stream.codec_name !== 'dvb_teletext'; // ffmpeg doesn't seem to support this https://github.com/mifi/lossless-cut/issues/1343
|
||||||
|
}
|
||||||
|
case 'data': {
|
||||||
|
// can handle gopro gpmd https://github.com/mifi/lossless-cut/issues/2134
|
||||||
|
// no other data tracks are known to be supported (might be added later)
|
||||||
|
return stream.codec_name === 'bin_data' && stream.codec_tag_string === 'gpmd';
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const attachedPicDisposition = 'attached_pic';
|
export const attachedPicDisposition = 'attached_pic';
|
||||||
|
Loading…
Reference in New Issue
Block a user