[FFmpeg-user] Multiple parts of a video

Michael Koch astroelectronic at t-online.de
Tue May 31 14:15:02 EEST 2022


Am 31.05.2022 um 11:17 schrieb Bo Berglund:
> On Sun, 29 May 2022 13:17:55 +0200, Michael Koch <astroelectronic at t-online.de>
> wrote:
>>>> 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
>> https://trac.ffmpeg.org/wiki/Concatenate
>>
>> "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.
>>
>> Michael
> 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
> command.

I have a short example in chapter 2.57 of my book:
http://www.astro-electronic.de/FFmpeg_Book.pdf

Michael



More information about the ffmpeg-user mailing list