Skip to content

Instantly share code, notes, and snippets.

@cutalion
Last active August 29, 2015 13:56
Show Gist options
  • Save cutalion/8821181 to your computer and use it in GitHub Desktop.
Save cutalion/8821181 to your computer and use it in GitHub Desktop.
Thumbnail creation with ffmpeg

Processor: Intel Core i3

time ./m_ffmpeg.sh dinner.m4v
./m_ffmpeg.sh dinner.m4v 48,54s user 5,34s system 142% cpu 37,897 total

time ./m_thumbnailer.sh dinner.m4v ./m_thumbnailer.sh dinner.m4v 66,21s user 5,61s system 156% cpu 45,918 total

ffmpeg on Ubuntu 13.04

$> ffmpeg -version

ffmpeg version 0.8.9-6:0.8.9-0ubuntu0.13.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:09:48 with gcc 4.7.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
ffmpeg 0.8.9-6:0.8.9-0ubuntu0.13.04.1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 0
libpostproc  52.  0. 0 / 52.  0. 0

$> avconv -version

avconv version 0.8.9-6:0.8.9-0ubuntu0.13.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:09:48 with gcc 4.7.3
avconv 0.8.9-6:0.8.9-0ubuntu0.13.04.1
libavutil    51. 22. 1 / 51. 22. 1
libavcodec   53. 35. 0 / 53. 35. 0
libavformat  53. 21. 1 / 53. 21. 1
libavdevice  53.  2. 0 / 53.  2. 0
libavfilter   2. 15. 0 /  2. 15. 0
libswscale    2.  1. 0 /  2.  1. 0
libpostproc  52.  0. 0 / 52.  0. 0
#!/usr/bin/zsh
rm -rf thumbs
mkdir thumbs
for i in {0..99}; do
avconv -loglevel quiet -ss 00:00:04 -i $1 -vf "scale=512:-1, select='eq(pict_type, I)'" -c:v png -pix_fmt rgb24 -vframes 1 thumbs/$i.png
done
#!/usr/bin/zsh
rm -rf thumbs
mkdir thumbs
for i in {0..99}; do
ffmpegthumbnailer -i $1 -q 10 -t 00:00:04 -s 512 -o thumbs/$i.png
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment