FFmpeg:省略-filter_complex会导致某些玩家丢失视频

时间:2017-05-17 09:40:09

标签: video ffmpeg video-encoding

我创建了一个不太简单的ffmpeg命令,其中包含一个复杂的过滤器,可以为视频附加开/关信用。在相同的过程中,视频被调整大小并重新编码。这适用于我测试的所有玩家。

当我省略-filter_complex arg和图像输入时,生成的文件在VLC中按预期播放,但在Windows Media Player中只有音频(没有视频)。

这一切都是在Windows 10上完成的,使用标准的Windows批处理文件。

任何人都知道这里发生了什么?我的ffmpeg foo非常有限。

ffmpeg.exe ^
 -i "..\videos\film.mov" ^
 -y ^
 -codec:a aac ^
 -s:v 1280x720 ^
 -codec:v libx264 -preset slower -tune animation -crf 22 ..\videos\film.mov.m4v"

ffmpeg.exe ^
 -i "..\videos\film.mov" ^
 -i OpeningCredits.de.png -i ClosingCredits.de.png ^
 -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,0,3.5)',drawtext=enable='between(t,0,3.5)':fontfile=fonts/Roboto-Bold.ttf:text=Test:fontcolor=white:fontsize=104:x=(w-text_w)/2:y=(h-text_h)/2+45,drawtext=enable='between(t,0,3.5)':fontfile=fonts/Roboto-Bold.ttf:text=:fontcolor=white:fontsize=104:x=(w-text_w)/2:y=(h-text_h)/2+45+text_h+20 [tmp]; [tmp][2:v] overlay=0:0:enable='between(t,39-5.2,39)'" ^
 -y ^
 -codec:a aac ^
 -s:v 1280x720 ^
 -codec:v libx264 -preset slower -tune animation -crf 22 "..\videos\film.mov.m4v"

1 个答案:

答案 0 :(得分:1)

默认情况下,叠加滤波器输出到YUV420P,所有播放器都支持YUV420P。因此,在使用它时,这种格式转换是一种隐含的副作用。

在这种情况下,看起来你的输入不是YUV420P。因此,当省略filter_complex时,转换为4:2:0并不会发生,WMP显然没有过滤器来解码非4:2:0 YUV格式。

添加-pix_fmt yuv420p以强制转换。