Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques 911101 – how to make an h264 video from jpeg files?

  • 911101 – how to make an h264 video from jpeg files?

    Posted by Hamid Sherkat on January 20, 2013 at 9:27 am

    hi
    i’ve some jpeg files. i want to put them into sequence in an h264 video. i don’t know what the best method for this purpose. i don’t want to use an application for this purpose. the environment is Linux (Ubuntu 10.10). i think the best method is to use ffmpeg library. but i don’t know what’s the easiest and the most straightforward method.
    please help me
    thx

    Stephen Dixon replied 13 years, 6 months ago 3 Members · 3 Replies
  • 3 Replies
  • Stephen Dixon

    January 21, 2013 at 12:06 pm

    if you’ve got an image sequence, Something like this will work
    ffmpeg -i myjpeg_0%3d.jpg -vcodec libx264 -preset slow -profile main -crf 20 -r 30 movie.mp4

  • the 0%3d stands for a three digit, zero-padded decimal number. If your jpegs have four digits then use 0%4d 5 digits 0%5d and so on, “myjpeg” is obviously the name of your images.
  • the -vcodec sets the codec to libx24 (h264 encoder)
  • the preset and profile settings will produce good quality movies that play on lots of machines
  • the -crf setting is your quality setting. Confusingly higher numbers are lower quality / smaller file size and lower numbers higher quality / bigger files.
  • -r sets the frame rate
  • movie.mp4 is the name of your output file.
  • Stephen Dixon
    Editor, Animator, Motionographer
    Museum Victoria

  • Lou Logan

    January 21, 2013 at 10:16 pm

    [stephen dixon] “ffmpeg -i myjpeg_0%3d.jpg -vcodec libx264 -preset slow -profile main -crf 20 -r 30 movie.mp4”

    Default input frame rate is 25, so setting frame rate as an output option will cause ffmpeg to duplicate frames to deal with going from 25 to 30. Sometimes this is desired but usually not. Instead, “-r 30” can be used as an input option (before “-i”) and the output will inherit that same frame rate.

    [hamid sherkat] “i’ve some jpeg files. i want to put them into sequence in an h264 video.”

    In addition to what stephen mentioned see the FFmpeg and x264 Encoding Guide for a detailed explanation and examples.

    If your input files are not in sequential order see Using ffmpeg with decimal wildcard for other methods and examples.

  • Stephen Dixon

    January 22, 2013 at 5:03 am

    Good catch! I’ve never realised this, since I work in 25fps all the time.

    Stephen Dixon
    Editor, Animator, Motionographer
    Museum Victoria

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy