10 April 2011

#NewBiesAssignment# Pictures to video using mplayer

Those who are working on Qt or any other toolkit, here is small code,
You can create small GUI application which do Picture to Video


---------- Forwarded message ----------
From: Girish Venkatachalam
Date: Sun, Apr 10, 2011 at 9:24 AM
Subject: [Ilugc] pictures to video using mplayer
To: Indian Linux User Group Chennai

There are several things that trip the unwary.

This is the command that worked for me:

$ mencoder mf://out-*jpg -mf w=300:h=400:fps=2:type=jpg -ovc lavc
-lavcopts vcodec=mpeg4:mbd=2:trell copy -oac copy -o f.avi

And before this I ensured that all pictures are of the same aspect
ratio. Obviously my pictures were of various aspect ratios.

You have to use ImageMagick like this:

$ convert i.jpg -resize !300x400 out-i.jpg

Only then the resizing will be done without minding about the aspect ratio.

You can create a video only using images of the same width and height.
Use the identify(1) command of ImageMagick
for ensuring this:

$ identify out-*
out-MadhubanBKWSUOmShantiBawan.jpg JPEG 300x400 300x400+0+0 8-bit
DirectClass 39.1kb
out-Navnath1.jpg[1] JPEG 300x400 300x400+0+0 8-bit DirectClass 46kb
out-Potala.jpg[2] JPEG 300x400 300x400+0+0 8-bit DirectClass 57kb

Do you see that they all are 300x400

Of course I wrote a script like this from the command line itself.

for i in *jpg
convert $i -resize !300x400 out-$i


By- Narendra Sisodiya

No comments: