且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在ffmpeg中,如何使用scale2ref过滤器缩放dvdsub字幕以匹配视频大小?

更新时间:2022-04-26 02:09:05

scale2ref 都将其输出标记为视频流,这几乎总是它们的输出.因此,ffmpeg将 c:v 的值应用于缩放后的子对象.

scale2ref tags both its output as video streams, which is what they almost always are. So ffmpeg is applying the value of c:v to the scaled subs.

相反,您应该尝试

ffmpeg -ss 28:00.2 -canvas_size 1920x1080 -i Hillary-2016-08-21.mpg -t 1:00 -map 0:0 -c:v copy -map 0:3 -c:a copy -map 0:6 -c:s dvdsub cut.mkv

使用

ffmpeg -ss 28:00.2 -i Hillary-2016-08-21.mpg -t 1:00 -filter_complex "[0:6][0:0]scale2ref[b][a]" -map 0:0 -c:v copy -map 0:3 -c:a copy -map "[b]" cut.mkv -map "[a]" -f null -

scale2ref 接受两个输入并吐出两个输出.两端的第二个元素是 ref erence视频.因此,必须告诉ffmpeg如何处理该引用的直通副本.在上面的命令中,分配了空混合器,该空混合器将其发送到遗忘区.

scale2ref takes two inputs and spits two outputs. The 2nd element at both ends is the reference video. So ffmpeg has to be told what to do with the passthrough copy of that reference. In the command above, the null muxer is assigned, which sends it to oblivion.