[FFmpeg-user] Multiple parts of a video

Cecil Westerhof Cecil at decebal.nl
Tue Jun 14 14:42:39 EEST 2022


Cecil Westerhof via ffmpeg-user <ffmpeg-user at ffmpeg.org> writes:

> Michael Koch <astroelectronic at t-online.de> writes:
>
>> Am 31.05.2022 um 18:43 schrieb Cecil Westerhof via ffmpeg-user:
>>> Michael Koch <astroelectronic at t-online.de> writes:
>>>
>>>> I have a short example in chapter 2.57 of my book:
>>>> http://www.astro-electronic.de/FFmpeg_Book.pdf
>>> Just to make sure I understand it, I should do something like:
>>>      ffmpeg -ss %S1% -t %L1% -i %I1%     \
>>>             -ss %S2% -t %L2% -i %I1%     \
>>>             -ss %S3% -t %L3% -i %I1%     \
>>>             -lavfi "concat=n=3:v=1:a=0"  \
>>>             -an %OUT%
>>>
>>> But if I understand it well, this works on the iframes, would it not
>>> be better (but longer) to use:
>>>      ffmpeg -i %I1% -ss %S1% -t %L1%     \
>>>             -i %I1% -ss %S2% -t %L2%     \
>>>             -i %I1% -ss %S3% -t %L3%     \
>>>             -lavfi "concat=n=3:v=1:a=0"  \
>>>             -an %OUT%
>>
>> I think that won't work. If you write the options after the input file,
>> then they are applied to the next input file, and the options in the 
>> third line are applied to the output file.
>> The concat filter does also work with audio. I just didn't need audio in
>> my example.
>
> But if you put them before the input file they are not precise, but
> work on the iframe level. This can give quit extensive differences. (I
> was bitten by that in the past.) Or is that not the case in this
> specific scenario?

That is not the case anymore.

I am using (bash on Debian):
    ffmpeg -y                                                \
           -ss ${videoStart} -to ${cutStart} -i ${inputFile} \
           -ss ${cutEnd}     -to ${videoEnd} -i ${inputFile} \
           -vcodec         libx264                           \
           -crf            26                                \
           -acodec         libmp3lame -qscale:a 9            \
           -preset         veryfast                          \
           -lavfi "concat=n=2:v=1:a=1"                       \
           -an ${outputFile}

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list