FFmpeg-如何将图片转换为 mp4?

FFmpeg-如何将图片转换为 mp4?

我正在使用 ubuntu 并且想要创建一个包含一些图片的 .mp4 文件,但我遇到了这个错误:

width not divisible by 2 (5333x3000)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

我尝试用这个进行转换:

unoconv -f pdf test1.pptx && convert -density 400 test1.pdf picture.png && ffmpeg -y -r 1/5 -i picture-%01d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p test.mp4

答案1

删除不必要的 ffmpeg 选项。

#!/bin/bash
unoconv -f pdf test1.pptx
convert -density 400 test1.pdf picture.png
ffmpeg -r 1/5 -i picture-%01d.png test.mp4

或者

unoconv -f pdf test1.pptx; convert -density 400 test1.pdf picture.png; ffmpeg -r 1/5 -i picture-%01d.png test.mp4

而不是这样:

ffmpeg -y -r 1/5 -i picture-%01d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p test.mp4

改用这个:

ffmpeg -r 1/5 -i picture-%01d.png test.mp4

相关内容