<p>I have done this sort of thing using ffmpeg and powershell core (both free software).</p>
<p>You can use any other scripting language to loop over ffmpeg once for each section of video that you want to keep. The ffmpeg command that you want looks like this:</p>
<pre><code>ffmpeg -ss [start_time] -i [input_file] -to [end_time] [output_file]
</code></pre>
<p>So, and example would be:</p>
<pre><code>ffmpeg -ss 00:10:01 -i source_vid.mp4 -to 00:30:00 output_vid_2.mp4
</code></pre>
<p>And if you have a whole lot of such pieces to cut in a batch, you can then use powershell or some other scripting language to loop through a list of pieces to cut:</p>
<pre><code>$segment_list = @(
@{ id = &quot;1&quot;
   start_time = &quot;00:00:00&quot;
   end_time = &quot;00:05:00&quot;
},
@{ id = &quot;2&quot;
   start_time = &quot;00:10:01&quot;
   end_time = &quot;00:30:00&quot;
}
)

foreach($segment in $segment_list) {
   ffmpeg -ss $segment.start_time -i source_vid.mp4 -to $segment.end_time (&quot;output_&quot; + $segment.id + &quot;.mp4&quot;)
}
</code></pre>

CC BY-SA 4.0
2020-07-08T01:33:51.503Z
2020-07-08T01:33:51.503Z
James Mc
<p>I am new to video editing.
I have a video of 30 minutes. I want to delete some part of it and keep some part. for example</p>
<ul>
<li>00:00:00  till 00:05:00 (keep)</li>
<li>00:05:01  till 00:10:00 (delete)</li>
<li>00:10:01  till 00:30:00 (keep)</li>
</ul>
<p>I have many timestamps like above. What is the best quick way to do this?</p>

CC BY-SA 4.0
2020-07-08T02:17:28.587Z
Does this answer your question? [Good open source Video Editors?](https://video.stackexchange.com/questions/2274/good-open-source-video-editors)
Michael Liebman
<video-editor>
Cropping a video by timestamps
brainHax
# Cropping a video by timestamps

(Asked by: username_0 on 2020-07-08)

I am new to video editing.
I have a video of 30 minutes. I want to delete some part of it and keep some part. for example

* 00:00:00 till 00:05:00 (keep)
* 00:05:01 till 00:10:00 (delete)
* 00:10:01 till 00:30:00 (keep)

I have many timestamps like above. What is the best quick way to do this?

**Tags:** video-editor

> **Comments:**
> **username_1**: Does this answer your question? [Good open source Video Editors?](https://video.stackexchange.com/questions/2274/good-open-source-video-editors)  

---

## 1 answers

### Answer by username_2 on 2020-07-08. Score: 2 | Accepted answer

I have done this sort of thing using ffmpeg and powershell core (both free software).
You can use any other scripting language to loop over ffmpeg once for each section of video that you want to keep. The ffmpeg command that you want looks like this:
ffmpeg -ss [start_time] -i [input_file] -to [end_time] [output_file]

So, and example would be:
ffmpeg -ss 00:10:01 -i source_vid.mp4 -to 00:30:00 output_vid_2.mp4

And if you have a whole lot of such pieces to cut in a batch, you can then use powershell or some other scripting language to loop through a list of pieces to cut:
$segment_list = @(
@{ id = "1"
   start_time = "00:00:00"
   end_time = "00:05:00"
},
@{ id = "2"
   start_time = "00:10:01"
   end_time = "00:30:00"
}
)

foreach($segment in $segment_list) {
   ffmpeg -ss $segment.start_time -i source_vid.mp4 -to $segment.end_time ("output_" + $segment.id + ".mp4")
}


---

