ffmpeg PNG到mp4-黑屏 [英] ffmpeg PNG to mp4 - Black screen
问题描述
我可以使用此行创建mpg视频
I can create a mpg video using this line
ffmpeg -f image2 -i 100%03d0.png movie.mpg
但是,如果我尝试创建mp4视频,则会收到黑屏视频.
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
我的数字目录如下所示: 1000010.png,1000020.png,... 1001260.png
My directory with figures looks like: 1000010.png,1000020.png,...1001260.png
推荐答案
添加-pix_fmt yuv420p
应该可以解决问题:
Adding -pix_fmt yuv420p
should solve the problem:
ffmpeg -i input_%03d.png -pix_fmt yuv420p movie.mp4
来自 FFmpeg Wiki :
"默认情况下,使用libx264时,取决于您的输入,ffmpeg 将尝试避免颜色二次采样.从技术上讲这是 首选,但不幸的是,几乎所有的视频播放器(不包括 基于FFmpeg的播放器,许多在线视频服务仅支持 YUV颜色空间具有4:2:0色度二次采样.
"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.
使用选项-pix_fmt yuv420p
或-vf format=yuv420p
将
最大限度地提高兼容性."
Using the options -pix_fmt yuv420p
or -vf format=yuv420p
will
maximize compatibility."
这篇关于ffmpeg PNG到mp4-黑屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!