2

I have a lot of images (>11.000) and I want to create a video with avconv as timelaps. With ffmpeg i did the trick with:

ffmpeg -r 25 -i "/mnt/stora/dahopi/Pictures/Gartencam/%*.jpg" \
       -vf scale=800:600 -c:v mpeg4 -vtag xvid -qscale:v \
       10 gartencam.avi

But with avconv this does not work. I think the problem is the file selector %*.jpg and I wonder if I have a chance to create the video without filename modification.

If not - do you know another tool to do the trick?

  • Why not just use ffmpeg? – llogan Sep 2 '16 at 19:17
1

I'm afraid your are right about the error being due to the file selector. Quoting the manual:

      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. It is the
      same syntax supported by the C printf function, but only formats accepting a
      normal integer are suitable.

If you want you can start at an integer greater than 0:

  -start_number start
  Specify the first number in the sequence

You do not need to really rename: you can create symbolic links with the ln command, which would take really little space on your disk.

I advise you to make a backup of your pictures before trying scripts

You can try to use this bash script:

#! /bin/bash
INPUTDIR="$1"
OUPUTDIR="$2"

SORTEDLIST="$(cd "$INPUTDIR" && ls -1 | sort -n)"

COUNT="$(echo -e "$SORTEDLIST"|wc -l)"
echo "Found $COUNT files"

ZEROES="$(echo -e "$COUNT"|wc -c)" # (will count \n)
echo "Using $ZEROES characters to display integers"

COUNTER="0"
for file in $SORTEDLIST; do
    ID="$(printf "%0${ZEROES}d" "$COUNTER")"

    echo "ln -s $INPUTDIR/$file $OUPUTDIR/$ID.jpg"
    ln -s "$INPUTDIR/$file" "$OUPUTDIR/$ID.jpg"

    COUNTER=$((COUNTER + 1))
done

This script assumes that all all your images are located inside a directory containing only the images that you want to include in your video. To use it:

  • create an output directory that will contain your links: mkdir output
  • execute it ./script.sh nameofthefoldercontainingyourimages output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.