1

I have a few hundreds of still images. The files are named according to the Canon convention - IMG_2501.JPG, IMG_2502.JPG, IMG_2503.JPG, ....

I've tried:

% avconv -f image2 -i IMG_%04d.JPG avconv_out.avi

avconv version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
built on Nov  9 2013 19:09:46 with gcc 4.8.1
IMG_%04d.JPG: No such file or directory

I guess that IMG_%04d.JPG is not found because avconv expects IMG_0000.JPG, IMG_0001.JPG, .... I can create a symlink for that, but it's a really ugly hack.

How do I create a video from these still photos using avconv without renaming?

Braiam
  • 66,947
  • 30
  • 177
  • 264
Adam Matan
  • 12,289
  • 24
  • 71
  • 90
  • What about adding `avconv -start_number 2501 -f image2 -i ...` ? – jmunsch Dec 27 '13 at 17:26
  • It will probably fail if a picture is missing from the sequence, which happens every now and then (I stop the camera, make a few calibration pictures, delete them and continue). – Adam Matan Dec 30 '13 at 16:31

1 Answers1

1

Try to rename them first

a=1
for i in *.JPG; do
  new=$(printf "%04d.JPG" ${a}) #04 pad to length of 4
  mv ${i} ${new}
  let a=a+1
done
user279043
  • 11
  • 1
  • 2
    A better approach would be to create links, which will keep the filenames the same (it matters to some people), in this case substitute `mv` for `ln`. You can then do the conversion and delete all the links. – v010dya Nov 10 '14 at 09:30