Ffmpeg
Home > CentOS > CentOS 6.x > Sound and video related tools > Ffmpeg
Creating video thumbnails using ffmpeg
If we want to host video on website then we can also display thumbnail(s) related to video to give idea of to viewers about the video. To create thumbnails for video we can use ffmpeg. The command that can be used is
ffmpeg -itsoffset -4 -i test.avi -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 test.jpg
Note that:
- We can completely ignore option '-itsoffset -4' if we want thumbnail of first frame in video. We can also change the parameter 4 which is in seconds.
- 'test.avi' is the name of video file, it can also be .mpg or .mpeg etc.
- '-s 320x240' is used to specify dimensions of thumbnail.
- 'test.jpg' is the name of output file.
Learned from http://blog.prashanthellina.com/2008/03/29/creating-video-thumbnails-using-ffmpeg/
Tip
To use the above technique on number of videos one can use following script
for FILE1 in *.mp4; do ffmpeg -itsoffset -4 -i $FILE1 -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 ${FILE1/%.mp4/.jpg}; done
after replacing .mp4 at both places with appropriate extension.
Converting ogg files to mp3 using ffmpeg
ffmpeg can be used to convert ogg audio files to mp3 files using:
for name in *.ogg; do ffmpeg -i "$name" -ab 128k "${name/.ogg/.mp3}"; done;
Ref: http://linuxforums.org.uk/index.php?topic=9836.0
Converting wmv to avi using ffmpeg
To convert wmv to avi using ffmpeg use:
ffmpeg -i input.wmv output.avi
Note that it may not work for files that use MSS2 format.
Home > CentOS > CentOS 6.x > Sound and video related tools > Ffmpeg