ffmpeg PNG to mp4 - Black screen

江枫思渺然 提交于 2019-11-30 09:16:21

问题


I can create a mpg video using this line

ffmpeg -f image2 -i 100%03d0.png movie.mpg

But If I try creating an mp4 video I get a video with a black screen.

ffmpeg -f image2 -i 100%03d0.png movie.mp4

My directory with figures looks like: 1000010.png,1000020.png,...1001260.png


回答1:


Adding -pix_fmt yuv420p should solve the problem:

ffmpeg -i input_%03d.png -pix_fmt yuv420p movie.mp4

From FFmpeg Wiki:

"By default when using libx264, and depending on your input, ffmpeg will attempt to avoid color subsampling. Technically this is preferred, but unfortunately almost all video players, excluding FFmpeg based players, and many online video services only support the YUV color space with 4:2:0 chroma subsampling.

Using the options -pix_fmt yuv420p or -vf format=yuv420p will maximize compatibility."



来源:https://stackoverflow.com/questions/25869206/ffmpeg-png-to-mp4-black-screen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!