简体   繁体   中英

FFmpeg: omitting -filter_complex results in missing video in some players

I created a not so simple ffmpeg command with a complex filter to append opening/closing credits to a video. In the same process the video is resized and re-encoded. This works fine in all players I tested.

When I leave out the -filter_complex arg and image inputs, the resulting file plays as expected in VLC but has only audio (no video) in Windows Media Player.

This is all done on Windows 10, using a standard windows batch file.

Any one an idea what's going on here? My ffmpeg foo is very limited.

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"

The overlay filter, by default, outputs to YUV420P, which is supported by all players. So when it is used, this format conversion is an implicit side-effect.

In this case, it looks like your input isn't YUV420P. So, when filter_complex is omitted, the conversion to 4:2:0 doesn't happen and WMP apparently has no filters to decode non 4:2:0 YUV formats.

Add -pix_fmt yuv420p to force the conversion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM