Reputation: 33
Here is what I am trying to do for 2 days now and I can't find anything about it. I have an mp4 file (2 minutes long) from that mp4 file I want to remove some parts, I do NOT want to cut some parts and merge them afterwards. Let me give you an example which I saw from Mike Baum's question about something similar.
Here is the video
================================
From this video I want to remove some part for example I want to remove from minute 1.25 to 1.80 and I want that part to just get removed NOT exported.
================||==========||===
As you can see the part in between the two "||" should get removed and then the video's length should become 1.45 minutes because we removed 0.55 minutes so the video will become this
===================
.
Also this thing can happen more than once per video. Can anyone help me with this? Thanks in advance!
Upvotes: 0
Views: 1312
Reputation: 33
After finally using the right search word "trimming" I found what I was looking for!
ffmpeg -i utv.ts -filter_complex \
"[0:v]trim=duration=30[av];[0:a]atrim=duration=30[aa];\
[0:v]trim=start=40:end=50,setpts=PTS-STARTPTS[bv];\
[0:a]atrim=start=40:end=50,asetpts=PTS-STARTPTS[ba];\
[av][bv]concat[cv];[aa][ba]concat=v=0:a=1[ca];\
[0:v]trim=start=80,setpts=PTS-STARTPTS[dv];\
[0:a]atrim=start=80,asetpts=PTS-STARTPTS[da];\
[cv][dv]concat[outv];[ca][da]concat=v=0:a=1[outa]" -map [outv] -map [outa] out.ts
Upvotes: 1