Wednesday, March 16, 2011

Movie with ffmpeg/mencoder/image magic

Working options for ffmpeg/mencoder :

To convert PS to png (or jpg) with true color use:

convert -density 300 -type TrueColor -quality 100 file.ps file.png (or jpg)

-type TrueColor suppresses the grey tiles for png. quality is for jpg

For convert to png, to suppress transparent background and have white, use:

convert image.png -background white -alpha remove -alpha off white.png

ffmpeh with offsets
http://ffmpeg.org/ffmpeg-all.html#image2-1

http://hamelot.io/visualization/using-ffmpeg-to-convert-a-set-of-images-into-a-video/


New FFMPEG on mac

ffmpeg  -r 7.5  -i rho.%4d.jpg -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p -vcodec libx264 rhomovie.mp4


ffmpeg  -r 2.5  -i rho%4d.jpg -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"  movie.mp4

for quicktime add:  -pix_fmt yuv420p -vcodec libx264 
(https://superuser.com/questions/820134/why-cant-quicktime-play-a-movie-file-encoded-by-ffmpeg)



The divisible by 2 issue with H264
http://stackoverflow.com/questions/20847674/ffmpeg-libx264-height-not-divisible-by-2

For WMV format :
ffmpeg -f image2 -qscale 1 -r 2.5 -b 9600  -i img%4d.jpg movie.wmv


batch convert using mogrify (image magic)

mogrify -format jpg *.png


For JPG :
1. Jayanti's :
mencoder mf://*.jpg -mf w=400:h=400:fps=5:type=jpg -ovc copy -oac copy -o movie.avi

2.my ffmpeg :
ffmpeg -f image2 -qscale 1 -r 5 -b 9600 -y -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2 -i img%4d.jpg movie.mp4

3. my mencoder :
mencoder "mf://*.png" -mf fps=5 -o movie.mp4 -ovc lavc -lavcopts vcodec=mpeg4:vhq:trell:vbitrate=9600


For PNG:
1. my mencoder :
mencoder "mf://*.png" -mf fps=5 -o test.avi -ovc lavc -lavcopts vcodec=mpeg4:vhq:trell:vbitrate=9600

2. Jayanti's :
mencoder mf://*.png -mf w=400:h=400:fps=5:type=png -ovc copy -oac copy -o movie.avi


Image Magic mpeg convert :
convert -delay 10 -alpha off *.jpg movie.mp4

-delay {time} Set the time delay (in 1/100th of a second) to pause after drawing the images that are read in or created after this setting has been defined.

You can specify a different scale for the time delay by specifying a 'x' scaling (giving in ticks per second). For example '10x1' is 10, 1 second ticks, while '10x100' is 10, one hundredth of a second ticks.

Basically the 'x' is equivalent to a fraction '/' sign. For example if you specify '1x160' will set a delay that is appropriate for 160 frames per second.

wesite : http://www.imagemagick.org/Usage/anim_basics/




Others :

working cmd line:
ffmpeg -f image2 -qscale 1 -r 5 -b 9600 -y -i img%4d.jpg movie.mp4


mplayer man :

for jpg
mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc \
-lavcopts vcodec=mpeg4:mbd=2:trell -oac copy -o output.avi

for png
mencoder mf://*.png -mf w=800:h=600:fps=25:type=png -ovc copy -oac copy -o output.avi

website :
http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html


gary's home page :

mencoder "mf://*.jpg" -mf fps=10 -o test.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800





ffmpeg working cmdline opts:
ffmpeg -f image2 -qscale 1 -r 5 -b 9600 -y -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 -pass 1/2 -i img%4d.jpg test.mp4

or

ffmpeg -f image2 -qscale 1 -r 5 -b 9600 -y -i img%4d.jpg movie.mp4




Websites :
http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-enc-images.html
http://electron.mit.edu/~gsteele/ffmpeg/
http://www.miscdebris.net/blog/2008/04/28/create-a-movie-file-from-single-image-files-png-jpegs/
http://www.idlcoyote.com/graphics_tips/weboutput.php
wesite : http://www.imagemagick.org/Usage/anim_basics/


Other audio/video encoding tid-bits :

http://howto-pages.org/ffmpeg/


Mp4 - mp3 :

ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3
 
http://donnieknows.com/blog/mp4-video-mp3-file-using-ffmpeg-ubuntu-910-karmic-koala


Reduce video size:
https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg

No comments:

Post a Comment