Wednesday, July 10, 2013

Make a slideshow using avconv on Debian Linux

I have some images and I make a slide show with these images.

$ mkdir tmp

The next command names the images with numbers.

$ i=0; for file in ./*.png; do cp $file ./tmp/$i.png; i=$((i+1)); done

$ cd tmp



$ mkdir a
$ mkdir b
$ mkdir video
$ mkdir backUp


Copy all images to folder "a".

Leading zeros are added to file names.

$ cd ./a
$ rename 's/\d+/sprintf("%07d",$&)/e' *.png

$ cd ..


Folder "a" contains files:
001.png 002.png 003.png ...

Folders "b" and "video" are empty.

The following commands converts the images and put them into folder "b".

Then images in folder "b" are used to make a video in folder "video".

The level of sound is 0. The option "-an" ensures a quiet environment.

The folder "backUp" contains copies of the same files.

The files in the "b" folder are deleted afterwards by the "rm" command. If another video is generated, the previous (deleted) images will not affect the next video.

#### Doing so will overwrite the file out.webm!
#### Go back to the backUp folder if necessary.
$ convert ./a/*.png \
-delay 9 \
-morph 9 \
./b/%07d.b.png &&\
avconv \
-an \
-r 1 \
-i './b/%07d.b.png' \
-r 60 \
-s 1280x960 \
-b 4096k \
-y \
./video/out.webm &&\
cp ./video/out.webm \
./backUp/\
out$(date +"%Y_%m_%d_%H_%M_%S").webm &&\
rm ./b/*.png

No comments: