我有大约 10k 个 PNG 文件,我想将它们转换成视频。
通过浏览互联网,我发现了 ffmpeg 并选择运行以下命令:
ffmpeg -f image2 -r 25 -i img/* -vcodec libx264 -crf 22 video.mp4
Run Code Online (Sandbox Code Playgroud)
首先,运行此命令会产生提示File 'img/00001.png' already exists. Overwrite ? [y/N],这对我来说似乎有点奇怪,因为据我了解,该命令不应修改图像本身,而应创建一个新video.mp4文件?
无论如何,我不想按y10k次,所以我备份了我的图像并修改了命令:
ffmpeg -f image2 -r 25 -i img/* -vcodec libx264 -crf 22 -y video.mp4
Run Code Online (Sandbox Code Playgroud)
现在,程序对于 254 个图像似乎运行良好,但随后抛出错误:
[png @ 0x7facf0503800] ff_frame_thread_encoder_init failed
Error initializing output stream 255:0 -- Error while opening encoder for output stream #255:0 - maybe incorrect parameters such as bit_rate, rate, width …Run Code Online (Sandbox Code Playgroud)