<p>You can use a combination of the trim and tpad filters for this.</p>
<pre><code>ffmpeg -i in.flv -vf &quot;trim=4,setpts=PTS-STARTPTS,tpad=start_duration=4:start_mode=clone&quot; -c:v libx264 -c:a copy out.flv
</code></pre>

CC BY-SA 4.0
2021-03-26T18:00:03.997Z
Thank you! It works.
Just a learner
CC BY-SA 4.0
2021-03-26T17:14:21.140Z
2021-03-26T17:14:21.140Z
Gyan
<p>I have a video file a.flv. I want to use ffmepg to edit it. As I understand, each second of the video is a series of frames. What I want is to take the first frame of the fifth second and replace all frames before it. So the result video has exactly the same video data from the beginning to the first frame of the fifth second. Is it possible to do this using ffmpeg?</p>

<ffmpeg>
How to use the frame at 5s and replace all frames before it using ffmpeg?
Just a learner
# How to use the frame at 5s and replace all frames before it using ffmpeg?

(Asked by: username_0 on 2021-03-26)

I have a video file a.flv. I want to use ffmepg to edit it. As I understand, each second of the video is a series of frames. What I want is to take the first frame of the fifth second and replace all frames before it. So the result video has exactly the same video data from the beginning to the first frame of the fifth second. Is it possible to do this using ffmpeg?

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2021-03-26. Score: 1 | Accepted answer

You can use a combination of the trim and tpad filters for this.
ffmpeg -i in.flv -vf "trim=4,setpts=PTS-STARTPTS,tpad=start_duration=4:start_mode=clone" -c:v libx264 -c:a copy out.flv

> **Comments:**
> **username_0**: Thank you! It works.  

---

