Win/ffmpeg - How to generate a video from images under ffmpeg?

爷,独闯天下 提交于 2019-12-24 18:33:10

问题


I know this is with great possibility a duplicate of same questions, but I dont get it working. So how can I under windows generate a mp4 video with h265 codec and 30fps of a bunch of images.

What I have done so far is to try this answers from this post:

Duplicate Question

If I try this:

 C:\\ffmpeg-3.4.2-win64-static\\bin\\ffmpeg -r 1/5 -i img%%03d.jpg -c:v libx264 -vf fps=25 -pix_fmt yuv420p out.mp4

I get the following output:

img%%03d.jpg: No such file or directory

I got filename like this:

img0001.jpg / img0002.jpg until img0030.jpg

So maybe I got the filename syntax wrong - I just dont know...

I have also tried this command:

C:\\ffmpeg-3.4.2-win64-static\\bin\\ffmpeg -framerate 29 -pattern_type glob -i img%%03d.jpg -c:v libx265 -crf 28 -c:a aac -b:a 128k output.mp4

but I get the same error..

Please help me I am not really into this ffmpeg stuff and need advice!

Maybe you can also show me how to set a directory of images in the ffmpeg params.

Thank you and greets!


回答1:


Use

ffmpeg -framerate 30 -i "img%04d.jpg" -c:v libx265 -crf 28 output.mp4

Since your numbering has four digits (0001..), you need %04d.

Depending on how you're executing this command, you may need to escape the %

-pattern_type glob applies for wildcard matching, but your filename template is a smoothly numbered sequence so it's incorrect in this context.




回答2:


You need to use img%%04d.jpg instead of img%%03d.jpg, because your filenames contain 4 digits.



来源:https://stackoverflow.com/questions/51856036/win-ffmpeg-how-to-generate-a-video-from-images-under-ffmpeg

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