how to convert a Image to video using avconv

Elby picture Elby · Dec 4, 2012 · Viewed 9k times · Source

i want to create a video from a image i used following code

shell_exec("avconv -f image2 -r 50 testimage.jpg output.mpg");

But when i trying to playing output video it shows stream contains no data

Answer

Shyam K picture Shyam K · Dec 4, 2012

The avconv manual says

For creating a video from many images:

avconv -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi

The syntax foo-%03d.jpeg specifies to use a decimal number composed of three digits padded with zeroes to express the sequence number.

There is a -s WxH in that line which is missing from your code. Maybe that is the cause. -s WxH is used to specify the size of the video, W - width and H - height. Here is a list of formats supported

On increasing the playback time, again the manual says

-t duration (output)

Stop writing the output after its duration reaches duration. duration may be a number in seconds, or in hh:mm:ss[.xxx] form.