Ffmpeg

From Notes_Wiki
Revision as of 03:23, 13 November 2012 by Saurabh (talk | contribs) (Created page with "=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 abo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.