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 的播放器,许多在线视频服务仅支持具有 4:2:0 色度子采样的 YUV 色彩空间.
"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屋!