How to merge mp4 audio dash fragment with another audio

1.2k views Asked by At

I have 1 audio file from dash stream

 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file_191282-377206_header.mp4':   Metadata:

 major_brand     : iso6
 minor_version   : 1
 compatible_brands: mp42dashmsdhmsixiso6avc1isom
 creation_time   : 2016-04-29T11:04:26.000000Z   Duration: 00:00:30.02, start: 14.997333, bitrate: 49 kb/s
 Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 48 kb/s (default)

Also in exiftool output:

 Movie Data Size                 : 180193
 Movie Data Offset               : 6388

I try to merge with another audio and save metadata info like Movie Data Size/Offset and start/duration time. I try with ffmpeg/MP4Box commands like:

MP4Box -new -add file_191282-377206_header.mp4 -add out000.mp4
ffmpeg -i file_191282-377206_header.mp4 -i out000.mp4 -codec copy -shortest output.mp4
ffmpeg -i file_191282-377206_header.mp4 -i out000.mp4 -filter_complex amerge -ac 2 -c:a aac output.mp4

All the time information erased or changed.

So question is how to merge 2 audio files inside mp4 and not change Movie Size/Offset and start/duration time?

1

There are 1 answers

1
VC.One On

Try to merge the actual audio (AAC) not the media container (MP4).
So extract the AAC from each media file, then merge those audios.
Finalise by putting the merged audio back into a new MP4 output.