<p>First you need to extract the frame that you wish to freeze. This is easy:</p>

<pre><code>avconv -i test.webm -vf "select='eq(n,1)'" out.jpeg
</code></pre>

<p>Then you want to put that frame for the appropriate time interval.</p>

<pre><code>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
</code></pre>

<p>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.</p>

<p>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 <code>trim</code>. 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.</p>

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

<p>How to build <code>avconv</code>:</p>

<ul>
<li>In terminal go to any directory where you are comfortable to place libav's code</li>
<li>run <code>git clone git://git.libav.org/libav.git libav</code></li>
<li>enter into libav direcotry</li>
<li>run <code>--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</code>
<ul>
<li>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</li>
</ul></li>
<li>Run <code>make</code>
<ul>
<li>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.</li>
</ul></li>
<li>Run <code>make install</code> (or if you chose to not place binary within your user directory, <code>sudo make install</code>).</li>
</ul>

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

CC BY-SA 3.0
2015-05-11T11:46:31.570Z
Thanks, I will test and let you know what are my results. Great and detailed answer!
Code_Ed_Student
CC BY-SA 3.0
2015-05-11T12:47:19.547Z
Alright it did give a couple of errors.Click this [GITHUB GIST](https://gist.github.com/J0N47H4N/b08ce29e08b50f1ccaea) for the full output.
Code_Ed_Student
CC BY-SA 3.0
2015-05-11T13:13:32.283Z
@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
CC BY-SA 3.0
2015-05-11T14:49:33.940Z
It seems that we have similar set up. Here is the script I use to install ffmpeg https://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.
Code_Ed_Student
CC BY-SA 3.0
2015-05-11T14:58:38.017Z
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.
Code_Ed_Student
CC BY-SA 3.0
2015-05-11T16:33:40.113Z
@Code_Ed_Student Ok, keep in mind that i don't have an ffmpeg setup, so my help will be limited. Can you try to just generate the frozen frame video `-loop 1 -i file.jpeg -filter_complex "[0:v]trim=start=0:end=5[final]" -map "[final]" -c:v libtheora out.ogv` let's see if this works, we'll continue from there.
v010dya
CC BY-SA 3.0
2015-05-11T22:18:57.630Z
Ok now showing progress. The issue was the `libtheora` I may not have that compiled with my ffmepg. Long story short I am just working with `mp4` files so i used `libx264`. However, I dont want to trim anything from the original video. For example the original video was 15 seconds long, by appending the freeze frame of 5 seconds to the beginning should make it 20 seconds long. How can we get it to that?
Code_Ed_Student
CC BY-SA 3.0
2015-05-12T05:57:43.543Z
@Code_Ed_Student With my setup you should have 5+15=20 second video, what did you get? And oh yes, i use libtheora so often that i type it almost automatically by now, you can use whatever codec and file format you wish.
v010dya
CC BY-SA 3.0
2015-05-12T07:59:19.983Z
The video is still 15 seconds long with the added freeze frame. Something is getting trimmed. The still image hops to another seen instead of starting from the frozen scene.
Code_Ed_Student
CC BY-SA 3.0
2015-05-12T08:10:47.783Z
@Code_Ed_Student Most likely changing timestamps didn't move your initial video. Can you go to the man page, there should be example useages of setpts filter. Give them a try on the file that you are encoding, do they work?
v010dya
CC BY-SA 3.0
2015-05-12T08:36:14.673Z
If this is working for you, could you post the video somewhere so I can see your results.
Code_Ed_Student
CC BY-SA 3.0
2015-05-12T09:46:49.527Z
@Code_Ed_Student I've relooked at the resulting file, and you are correct. It does terminate way earlier than it should. I believe that it a bug (apparently in both classic ffmpeg and avconv), i'm going to file a bug now.
v010dya
CC BY-SA 3.0
2015-05-12T12:26:16.063Z
Thanks! could you place the link here of the bug report.
Code_Ed_Student
CC BY-SA 3.0
2015-05-11T10:40:19.493Z
2015-05-12T12:41:05.227Z
2015-05-12T12:41:05.227Z
v010dya
<p>I am currently fiddling with ffmpeg to achieve a <code>freeze frame effect</code> and so far have been unsuccessful. I have been able to do this with adobe after effects shown <a href="https://www.youtube.com/watch?v=2wUZdNkiVw4" rel="nofollow">here</a>. 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?</p>

<p><strong><em>EDIT</em></strong></p>

<pre><code>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"
</code></pre>

CC BY-SA 3.0
2015-05-11T16:42:30.293Z
Do you want the effect to occur at the very beginning or at a particular duration?
llogan
CC BY-SA 3.0
2015-05-11T16:44:10.560Z
@LordNeckbeard at the very beginning
Code_Ed_Student
<video><ffmpeg>
Freeze frame effect with ffmpeg
Code_Ed_Student
# Freeze frame effect with ffmpeg

(Asked by: username_0 on 2015-05-11)

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?
EDIT
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"

**Tags:** video, ffmpeg

> **Comments:**
> **username_1**: Do you want the effect to occur at the very beginning or at a particular duration?  
> **username_0**: @LordNeckbeard at the very beginning  

---

## 1 answers

### Answer by username_2 on 2015-05-11. Score: 2 | Accepted answer

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

> **Comments:**
> **username_0**: Thanks, I will test and let you know what are my results. Great and detailed answer!  
> **username_0**: Alright it did give a couple of errors.Click this [GITHUB GIST](https://gist.github.com/J0N47H4N/b08ce29e08b50f1ccaea) for the full output.  
> **username_2**: @username_0 I am unsure what is happening with your setup, so i've added how to make avconv with the same options as mine.  
> **username_0**: It seems that we have similar set up. Here is the script I use to install ffmpeg https://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.  
> **username_0**: 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.  
> **username_2**: @username_0 Ok, keep in mind that i don't have an ffmpeg setup, so my help will be limited. Can you try to just generate the frozen frame video `-loop 1 -i file.jpeg -filter_complex "[0:v]trim=start=0:end=5[final]" -map "[final]" -c:v libtheora out.ogv` let's see if this works, we'll continue from there.  
> **username_0**: Ok now showing progress. The issue was the `libtheora` I may not have that compiled with my ffmepg. Long story short I am just working with `mp4` files so i used `libx264`. However, I dont want to trim anything from the original video. For example the original video was 15 seconds long, by appending the freeze frame of 5 seconds to the beginning should make it 20 seconds long. How can we get it to that?  
> **username_2**: @username_0 With my setup you should have 5+15=20 second video, what did you get? And oh yes, i use libtheora so often that i type it almost automatically by now, you can use whatever codec and file format you wish.  
> **username_0**: The video is still 15 seconds long with the added freeze frame. Something is getting trimmed. The still image hops to another seen instead of starting from the frozen scene.  
> **username_2**: @username_0 Most likely changing timestamps didn't move your initial video. Can you go to the man page, there should be example useages of setpts filter. Give them a try on the file that you are encoding, do they work?  
> **username_0**: If this is working for you, could you post the video somewhere so I can see your results.  
> **username_2**: @username_0 I've relooked at the resulting file, and you are correct. It does terminate way earlier than it should. I believe that it a bug (apparently in both classic ffmpeg and avconv), i'm going to file a bug now.  
> **username_0**: Thanks! could you place the link here of the bug report.  

---

