|
|
|
|
@ -427,7 +427,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
|
|
|
|
|
}, [appendFfmpegCommandLog, cutFromAdjustmentFrames, cutToAdjustmentFrames, filePath, getOutputPlaybackRateArgs, treatInputFileModifiedTimeAsStart, treatOutputFileModifiedTimeAsStart]);
|
|
|
|
|
|
|
|
|
|
// inspired by https://gist.github.com/fernandoherreradelasheras/5eca67f4200f1a7cc8281747da08496e
|
|
|
|
|
const cutEncodeSmartPart = useCallback(async ({ cutFrom, cutTo, outPath, outFormat, videoCodec, videoBitrate, videoTimebase, allFilesMeta, copyFileStreams, videoStreamIndex, ffmpegExperimental }: {
|
|
|
|
|
const cutEncodeSmartPart = useCallback(async ({ cutFrom, cutTo, outPath, outFormat, videoCodec, videoBitrate, videoTimebase, allFilesMeta, copyFileStreams, videoStreamIndex, ffmpegExperimental, hasBFrames }: {
|
|
|
|
|
cutFrom: number,
|
|
|
|
|
cutTo: number,
|
|
|
|
|
outPath: string,
|
|
|
|
|
@ -439,6 +439,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
|
|
|
|
|
copyFileStreams: CopyfileStreams,
|
|
|
|
|
videoStreamIndex: number,
|
|
|
|
|
ffmpegExperimental: boolean,
|
|
|
|
|
hasBFrames: number | undefined,
|
|
|
|
|
}) => {
|
|
|
|
|
invariant(filePath != null);
|
|
|
|
|
|
|
|
|
|
@ -481,6 +482,8 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
|
|
|
|
|
|
|
|
|
|
...getVideoTimescaleArgs(videoTimebase),
|
|
|
|
|
|
|
|
|
|
...(hasBFrames ? ['-bf', String(hasBFrames)] : []),
|
|
|
|
|
|
|
|
|
|
...getExperimentalArgs(ffmpegExperimental),
|
|
|
|
|
|
|
|
|
|
'-f', outFormat, '-y', outPath,
|
|
|
|
|
@ -583,7 +586,7 @@ function useFfmpegOperations({ filePath, treatInputFileModifiedTimeAsStart, trea
|
|
|
|
|
invariant(sourceCodecParams.videoTimebase != null);
|
|
|
|
|
invariant(filePath != null);
|
|
|
|
|
invariant(outFormat != null);
|
|
|
|
|
await cutEncodeSmartPart({ cutFrom, cutTo, outPath, outFormat, videoCodec, videoBitrate: encCustomBitrate != null ? encCustomBitrate * 1000 : sourceCodecParams.videoBitrate, videoStreamIndex: videoStream.index, videoTimebase: sourceCodecParams.videoTimebase, allFilesMeta, copyFileStreams: copyFileStreamsFiltered, ffmpegExperimental });
|
|
|
|
|
await cutEncodeSmartPart({ cutFrom, cutTo, outPath, outFormat, videoCodec, videoBitrate: encCustomBitrate != null ? encCustomBitrate * 1000 : sourceCodecParams.videoBitrate, videoStreamIndex: videoStream.index, videoTimebase: sourceCodecParams.videoTimebase, allFilesMeta, copyFileStreams: copyFileStreamsFiltered, ffmpegExperimental, hasBFrames: sourceCodecParams.videoStream.has_b_frames });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const cutEncodeWholePart = async () => {
|
|
|
|
|
|