[FFmpeg-user] Cutting part of four files and concatenating
Cecil Westerhof
Cecil at decebal.nl
Sat May 28 17:24:31 EEST 2022
"amindfv at mailbox.org" <amindfv at mailbox.org> writes:
>> time ffmpeg -y -i audio1.mp4 -i audio2.mp4 -i audio3.mp4 -i audio4.mp4 \
>> -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a][3:v][3:a]
>> concat=n=4:v=1:a=1[v][a]" \
>> -map "[v]" -map "[a]" \
>> -vcodec libx264 -preset veryfast \
>> mergedAudio.mp4
>>
>> I was wondering if this is the correct way to do this.
>> I especially would like to know if it could be done in one swoop. Now
>> the video is converted two times.
>
>
> I don't know if it can be done in one fell swoop (and I'd love to know
> if that's possible!) but the last step might be possible to do without a
> re-encode with:
>
> $ cat combined.txt
> file '/home/foo/audio1.mp4'
> file '/home/foo/audio2.mp4'
> file '/home/foo/audio3.mp4'
> file '/home/foo/audio4.mp4'
>
> $ ffmpeg -y -f concat -safe 0 -i combined.txt -c copy mergedAudio.mp4
I should have thought about that.
I do it a little bit differently:
files=$(
for i in $(seq 1 4) ; do
printf "file $(pwd)/audio%d.mp4\n" $i
done
)
ffmpeg -y -f concat -safe 0 -i <(echo "${files}") -c copy mergedAudio.mp4
Thanks.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
More information about the ffmpeg-user
mailing list