ffmpeg / avconv image to video file…

So while playing around with one of the local ski resorts website I decided, hey wouldn’t it be neat to time lapse the whole day by grabbing a frame a second from the public web cam. After collected my images I decided to convert them into a single video stream with ffmpeg. I thought I would be clever and just use the place holder option %d in the input file name and go from there. Well this didn’t work with a very ambiguous error

$ avconv -f image2 -i %d.jpeg -r 24 -s 640x480 foo.avi
avconv version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 18:01:36 with gcc 4.6.3
[image2 @ 0xdf27c0] max_analyze_duration reached
Input #0, image2, from '%d.jpeg':
  Duration: 00:02:32.64, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj422p, 640x480, 25 fps, 25 tbr, 25 tbn, 25 tbc
No such file or directory: %d.jpeg

Well that’s frustrating. The directory of images was based on epoch time (seconds since 1970). So each image contained the second it was captured as the file name. After some meddling around I discovered that ffmpeg / avconv isn’t so smart and requires that you start your image sequence at 0 and increment upward 1 by 1 for all images you wish to encode. A quick fix was to just rename the images to do this and then the video encoding completed successfully.

 

Leave a Reply

Your email address will not be published. Required fields are marked *