Search code examples
ffmpegjpegmp4

convert from jpg to mp4 by ffmpeg


I have 320 jpg(320x574) images which I have recorded them with 2004 fps. I want to make a .mp4 video of them. I have run below codes in cmd (win7) and it just make a video of jpg number 320 and if I go for this ('*.jpg') insted of 320 it does not work. I really appreciate any help.

ffmpeg -r 1/5 -i C:\data-Sam\320.jpg -c:v libx264 -r 30 -pix_fmt yuv420p C:\data-Sam\out.mp4

Solution

  • Depending on your file names you'll want:

    ffmpeg -f image2 -i /path/to/file/image%3d.jpg test.avi
    

    The image%3d would be for files named: image000.jpg, image001.jpg, image002.jpg, etc.

    If your files are named image0.jpg, image1.jpg, image2.jpg, etc. then you'd use /path/to/file/image%d.jpg.

    See FFmpeg image2 demuxer examples