[FFmpeg-user] Multiple parts of a video

Bo Berglund bo.berglund at gmail.com
Tue May 31 12:17:46 EEST 2022

On Sun, 29 May 2022 13:17:55 +0200, Michael Koch <astroelectronic at t-online.de>
>>> Using concat filter.
>> That is exactly what I already know: cutting the different parts.
>> Probably one command for each part and then concatenate them.
>> So n + 1 commands.
>> My question was: can it be done with one command?
>Please have a look at
>"Concat demuxer", "Concat protocol" and "Concat filter" are three 
>different things.
>You did use the concat demuxer. Now if you want to do all in one line, 
>you must use the concat filter.

Stepping in here due to the interesting topic:

I am daily using a tool I created myself to use ffmpeg to remove ads from
recorded mp4 TV news videos.
What I do is the following:
- I manually scan the video to find the start/end times of the ads (seconds)
- From this list the tool creates the ffmpeg commands to extract the parts
*between* the ads as separate numbered mp4 files
- Then a list of these small files is written to a file $JOINFILE
- This is then used in an ffmpeg call like this:
  ffmpeg -f concat -safe 0 -i $JOINFILE -c copy $TARGETFILE
- When this is done the small files and $JOINFILE are deleted

So reading this thread I get the feeling that there is a way to use the list of
cut times in a *single ffmpeg command* to create the output mp4 file *without*
creating the list file and essentially doing everything in this single ffmpeg

> Paul B Mahol <onemda at gmail.com> writes:
> Using concat filter.

And this is repeated several times..

But the exact way to do this complete extraction given the multiple time slots
into a final single mp4 file using the concat filter is not described.

Please note that I *do* use concat in my command and I still have to first
separately cut out the parts to be concatenated...

How can these two steps be merged into a single ffmpeg command is something I
would also like to know.

The current strategy I use (as shown above) is producing a final video that has
some artifacts of the ads at the cut points and I hope that by doing it in a
single operation these will not be present.

Bo Berglund
Developer in Sweden

More information about the ffmpeg-user mailing list