[FFmpeg-user] How to concatenate multiple mp4 files without re-encoding to an intermediate format

Dennis mediastream at gmail.com
Fri Aug 31 16:44:52 CEST 2012


On 8/31/12, Rares Pop <raresp at axz.ro> wrote:
> Tom,
>
> Many thanks !
> With a minor correction (required by ffmpeg) it worked.
> ffmpeg -i "concat:concat.ts|concat2.ts" -c copy -absf aac_adtstoasc
> concatAll.mp4
>
> All of the commands executed very fast since no re-encoding was necessary.
> This was our goal after all since we're processing a lot files. Adding round
> of transcoding was not an option.
> Thanks again.
>
> Rares
>
>
> On Aug 31, 2012, at 2:56 PM, Tom Evans <tevans.uk at googlemail.com> wrote:
>
>> On Fri, Aug 31, 2012 at 11:33 AM, Carl Eugen Hoyos <cehoyos at ag.or.at>
>> wrote:
>>> Rares Pop <raresp <at> axz.ro> writes:
>>>
>>>> ffmpeg -i concat:'file1.mp4|file2.mp4' -vcodec copy -acodec copy  -y
>>>> asset.mp4
>>>
>>>> Result: asset.mp4 file is the same as file1.mp4.It behaves
>>>> like it ignores file2.mp4
>>>
>>> So it seems that this is unsupported.
>>> You can try to concatenate the raw h264 and the raw aac streams
>>> and mux the resulting streams but this may lead to A/V desync
>>> (that you can try to eliminate by cutting the streams or inserting
>>> silence but this will have to be done manually).
>>>
>>> Please do not top-post here, Carl Eugen
>>>
>>
>> Would re-muxing to TS as an intermediate help with this? Seems to work
>> ok..
>>
>> ffmpeg -i source1.mp4 -c copy -bsf h264_mp4toannexb -t 30 out1.ts
>> ffmpeg -i source2.mp4 -c copy -bsf h264_mp4toannexb -t 30 out2.ts
>> ffmpeg -i "concat:out1.ts|out2.ts" -c copy out.mp4
>> ffprobe out.mp4 2>&1| grep Duration
>>  Duration: 00:01:00.08, start: 0.000000, bitrate: 2086 kb/s
>>
>> Cheers
>>
>> Tom
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> --
>> This message has been scanned for viruses and
>> dangerous content by MailScanner, and is
>> believed to be clean.
>>
>
> ---------------------
> Rares Pop
> Chief Executive
> M: +40 745 028 869 | E: raresp at axz.ro | Skype: ra_axz
> www.azoth.eu | A: Grigore Alexandrescu 54, Bucuresti - Romania
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list