1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Command line program to convert image to video

Discussion in 'YouTube' started by 39ster, Jul 15, 2011.

  1. 39ster

    39ster Junior Member

    Joined:
    Dec 12, 2009
    Messages:
    174
    Likes Received:
    58
    I need a command line program to encode a video using an image file (png, jpeg, etc). I tried ffmpeg and mencoder but can't figure out how to set the duration. The video will always be 0 seconds long. I need to show the image for like 5-10 seconds. Anyone know how? It must be command line (for automation)
     
  2. Baraba

    Baraba Regular Member

    Joined:
    Jun 25, 2010
    Messages:
    436
    Likes Received:
    138
    ffmpeg -r 10 -b 1800 -i Baraba.jpg Baraba.mp4
     
  3. 39ster

    39ster Junior Member

    Joined:
    Dec 12, 2009
    Messages:
    174
    Likes Received:
    58
    Just tried and the video is still only 0 seconds in duration. The image only shows for like a millisecond.

    EDIT:

    part of the console output:

    Input #0, image2, from 'test.png':
    Duration: 00:00:00.02, start: 0.000000, bitrate: N/A

    I need to set the duration but don't know how.
     
  4. 39ster

    39ster Junior Member

    Joined:
    Dec 12, 2009
    Messages:
    174
    Likes Received:
    58
    Okay just figured the option "-loop 1" and "-vframes num"

    so for others who need help with this, do the command line like:

    ffmpeg -loop 1 -vframes 10 -r 10 -b 1800 -i test.png out.mp4

    where -vframes 100 determines how much frames you want to write...so this is 100 frames at 10 frames/sec (-r 10). so it would be 10 seconds long.