I am currently fiddling with ffmpeg to achieve a freeze frame effect and so far have been unsuccessful. I have been able to do this with adobe after effects shown here. However I would like to achieve a freeze frame effect(of 5 seconds duration) at the beginning of the video. How can I achieve this in ffmpeg?


ffmpeg -i "/media/test/test.mp4" -loop 1 -i "/media/sf_linux_sandbox/hashtag_pull/video-downloads/test/test.png" -an \
-filter_complex "[1:v]trim=start=0:end=5[ol];[0:v]setpts=125+PTS[nv];[nv][ol]overlay=eof_action=pass[final]" \
-map '[final]' -c:a copy -c:v libx264 -q 1 "/media/test/out.mp4"
  • Do you want the effect to occur at the very beginning or at a particular duration?
    – llogan
    May 11, 2015 at 16:42
  • @LordNeckbeard at the very beginning May 11, 2015 at 16:44

1 Answer 1


First you need to extract the frame that you wish to freeze. This is easy:

avconv -i test.webm -vf "select='eq(n,1)'" out.jpeg

Then you want to put that frame for the appropriate time interval.

avconv -i test.webm -loop 1 -i out.jpeg -an \
-filter_complex "[1:v]trim=start=0:end=5[ol];[0:v]setpts=125+PTS[nv];[nv][ol]overlay=eof_action=pass[final]" \
-map '[final]' -c:v libtheora -q:v 8 outtest.ogv

Firstly you will see that i didn't want to mess with audio, but if you'll find it too difficult, let me know and i will look into the quick way to align it as well.

Now what i'm doing here consists of several strange things. Firstly i am taking that frame that was generated before and i am creating a continuous loop video from it. And afterwards i cut first 5 seconds of it with the first filter trim. Then i do a quick and dirty move of all the timestamps of the main video by 5 seconds (125 frames). And finally comes an overlay filter, which places the grabbed frame entirely over the blank screen that was generated by shifting the video 5 seconds into the future.

Tested with avconv version v12_dev0-680-g3a724a7 built on Jan 22 2015 18:13:02

How to build avconv:

  • In terminal go to any directory where you are comfortable to place libav's code
  • run git clone git://git.libav.org/libav.git libav
  • enter into libav direcotry
  • run --enable-gpl --enable-version3 --disable-encoders --enable-encoder=mjpeg --enable-encoder=flac --enable-encoder=ffvhuff --enable-encoder=libspeex --enable-encoder=libtheora --enable-encoder=libvorbis --enable-encoder=libxvid --enable-encoder=libopenjpeg --enable-libschroedinger --enable-libopenjpeg --enable-libopus --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libxvid --bindir=/home/USERNAME/bin
    • Note that here i am assuming that you have ~/bin directory, that is added to your execution PATH. If you don't just remove that option
  • Run make
    • It is possible that you will not have some libraries, if you encounter such errors either install them or remove "enable" options for those libs. Keep in mind that removing those options can make it impossible to generate files with some codecs.
  • Run make install (or if you chose to not place binary within your user directory, sudo make install).

Edit: Unfortunately due to a bug, video becomes shorter than it should have been. I have reported it https://bugzilla.libav.org/show_bug.cgi?id=858

  • Thanks, I will test and let you know what are my results. Great and detailed answer! May 11, 2015 at 11:46
  • Alright it did give a couple of errors.Click this GITHUB GIST for the full output. May 11, 2015 at 12:47
  • @Code_Ed_Student I am unsure what is happening with your setup, so i've added how to make avconv with the same options as mine.
    – v010dya
    May 11, 2015 at 13:13
  • It seems that we have similar set up. Here is the script I use to install ffmpeg gist.github.com/xdamman/e4f713c8cd1a389a5917. I am aware avcon and ffmpeg are essentially from the same origin. However I been running several scripts with ffmpeg and therefore cant change now to avcon. Your help is appreciated. May 11, 2015 at 14:49
  • this got me the image thumbmail ffmpeg -i input.mp4 -vf "select=gt(scene\,0.5)" -frames:v 5 -vsync vfr out%02d.png. Now just need to get the rest of the command adapted for ffmepg for freeze effect. May 11, 2015 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.