Ram Laxman Yadav bio photo

Ram Laxman Yadav

Ruby on Rails Developer

Email Twitter LinkedIn Github Stackoverflow

How ever in practice we often need to create thumbnails of the video. I am using the linux library to create the thumbnail of a video. Here is the example of it:

1. Install library:

  • Open terminal and run sudo apt-get install ffmpeg.

2. Create thumbnail of first frame:

  • Run ffmpeg -i INPUT_FILE -ss 00:00:1 -vframes 1 -y TARGET_FILE

    Here INPUT_FILE is the video file you want to create a thumbnail of, TARGET_FILE is the name of thumbnail, -y is to replace the target file if exists.

3. Create thumbnail every second:

  • Run ffmpeg -i INPUT_FILE -vf fps=1 thumbnail%d.png

    Output one image every second, named thumbnail.png, thumbnail.png, thumbnail.png, etc.

4. Create thumbnail every minute:

  • Run ffmpeg -i INPUT_FILE -vf fps=1/60 img%03d.jpg

    Output one image every minute, named img001.jpg, img002.jpg, img003.jpg, etc. The %03d dictates that the ordinal number of each output image will be formatted using 3 digits.

5. Create thumbnail of a remote file:

  • Run ffmpeg -i INPUT_FILE_WITH_REMOTE_URL -ss 00:00:1 -vframes 1 -y TARGET_FILE