combing two .mp4 files using MP4Box makes only the first part of the video play audio, the second one doesn't.

Olivier Aubert olivier.aubert at liris.cnrs.fr
Tue Sep 18 19:13:53 UTC 2012


Hello Shirish


I had the exact same issue last week. The trouble is that MP4Box seems
to consider that audio tracks are always incompatible, even if they have
the same parameters, and thus creates a new sound track when combining
both files.

I found a solution by separately merging the audio and the video tracks,
and combining the result. To merge the audio tracks, I specify
-force-cat so that audio tracks are merged into the same track.

Basically:

MP4Box -force-cat -cat b1.mp4#audio -cat b2.mp4#audio a.mp4
MP4Box -cat b1.mp4#video -cat b2.mp4#video v.mp4
MP4Box -add v.mp4 -add a.mp4 bmiddle.mp4

Regards,
Olivier

On Wed, 2012-09-19 at 00:31 +0530, shirish शिरीष wrote:
> Hi all,
> Dunno if it's a bug or not.
> 
> Hi all,
>  I was looking for an mp4 merge tool and came across this. I used the
> small tutorial given at
> http://www.thetechrepo.com/main-articles/530-combine-mp4m4v-files-in-linuxubuntu
> 
> For seeing whether it works I combined two files which are similar at
> least on the technical parameters :-
> 
> $ mediainfo b1.mp4
> General
> Complete name                            : b1.mp4
> Format                                   : MPEG-4
> Format profile                           : Base Media / Version 2
> Codec ID                                 : mp42
> File size                                : 28.5 MiB
> Duration                                 : 9mn 51s
> Overall bit rate mode                    : Variable
> Overall bit rate                         : 405 Kbps
> Encoded date                             : UTC 2011-01-03 14:48:08
> Tagged date                              : UTC 2011-01-03 14:48:08
> gsst                                     : 0
> gstd                                     : 591783
> gssd                                     : BADC23401HH1347937888871802
> gshh                                     :
> o-o---preferred---bom03s03---v16---lscache2.c.youtube.com
> 
> Video
> ID                                       : 2
> Format                                   : AVC
> Format/Info                              : Advanced Video Codec
> Format profile                           : Baseline at L2.1
> Format settings, CABAC                   : No
> Format settings, ReFrames                : 1 frame
> Format settings, GOP                     : M=1, N=30
> Codec ID                                 : avc1
> Codec ID/Info                            : Advanced Video Coding
> Duration                                 : 9mn 51s
> Bit rate                                 : 353 Kbps
> Maximum bit rate                         : 687 Kbps
> Width                                    : 400 pixels
> Height                                   : 326 pixels
> Display aspect ratio                     : 1.227
> Frame rate mode                          : Constant
> Frame rate                               : 25.000 fps
> Color space                              : YUV
> Chroma subsampling                       : 4:2:0
> Bit depth                                : 8 bits
> Scan type                                : Progressive
> Bits/(Pixel*Frame)                       : 0.108
> Stream size                              : 24.8 MiB (87%)
> Title                                    : (C) 2007 Google Inc. v08.13.2007.
> Encoded date                             : UTC 2011-01-03 14:48:09
> Tagged date                              : UTC 2011-01-03 14:48:09
> 
> Audio
> ID                                       : 1
> Format                                   : AAC
> Format/Info                              : Advanced Audio Codec
> Format profile                           : LC
> Codec ID                                 : 40
> Duration                                 : 9mn 51s
> Bit rate mode                            : Variable
> Bit rate                                 : 48.0 Kbps
> Maximum bit rate                         : 57.1 Kbps
> Channel(s)                               : 1 channel
> Channel positions                        : Front: C
> Sampling rate                            : 44.1 KHz
> Compression mode                         : Lossy
> Stream size                              : 3.50 MiB (12%)
> Title                                    : (C) 2007 Google Inc. v08.13.2007.
> Encoded date                             : UTC 2011-01-03 14:48:08
> Tagged date                              : UTC 2011-01-03 14:48:09
> 
> 
> $ mediainfo b2.mp4
> General
> Complete name                            : b2.mp4
> Format                                   : MPEG-4
> Format profile                           : Base Media / Version 2
> Codec ID                                 : mp42
> File size                                : 34.8 MiB
> Duration                                 : 12mn 0s
> Overall bit rate mode                    : Variable
> Overall bit rate                         : 404 Kbps
> Encoded date                             : UTC 2011-01-03 14:57:13
> Tagged date                              : UTC 2011-01-03 14:57:13
> gsst                                     : 0
> gstd                                     : 721396
> gssd                                     : BADC23464MH1347938738207834
> gshh                                     :
> o-o---preferred---bom04s04---v14---lscache7.c.youtube.com
> 
> Video
> ID                                       : 2
> Format                                   : AVC
> Format/Info                              : Advanced Video Codec
> Format profile                           : Baseline at L2.1
> Format settings, CABAC                   : No
> Format settings, ReFrames                : 1 frame
> Format settings, GOP                     : M=1, N=30
> Codec ID                                 : avc1
> Codec ID/Info                            : Advanced Video Coding
> Duration                                 : 12mn 0s
> Bit rate                                 : 352 Kbps
> Maximum bit rate                         : 847 Kbps
> Width                                    : 400 pixels
> Height                                   : 326 pixels
> Display aspect ratio                     : 1.227
> Frame rate mode                          : Constant
> Frame rate                               : 25.000 fps
> Color space                              : YUV
> Chroma subsampling                       : 4:2:0
> Bit depth                                : 8 bits
> Scan type                                : Progressive
> Bits/(Pixel*Frame)                       : 0.108
> Stream size                              : 30.3 MiB (87%)
> Title                                    : (C) 2007 Google Inc. v08.13.2007.
> Encoded date                             : UTC 2011-01-03 14:57:14
> Tagged date                              : UTC 2011-01-03 14:57:14
> 
> Audio
> ID                                       : 1
> Format                                   : AAC
> Format/Info                              : Advanced Audio Codec
> Format profile                           : LC
> Codec ID                                 : 40
> Duration                                 : 12mn 0s
> Bit rate mode                            : Variable
> Bit rate                                 : 48.0 Kbps
> Maximum bit rate                         : 59.0 Kbps
> Channel(s)                               : 1 channel
> Channel positions                        : Front: C
> Sampling rate                            : 44.1 KHz
> Compression mode                         : Lossy
> Stream size                              : 4.26 MiB (12%)
> Title                                    : (C) 2007 Google Inc. v08.13.2007.
> Encoded date                             : UTC 2011-01-03 14:57:13
> Tagged date                              : UTC 2011-01-03 14:57:14
> 
> 
> These I then decided to merge using the tutorial as a guide :-
> 
> $ MP4Box -cat b1.mp4 -cat b2.mp4 -new bmiddle.mp4
> Appending file b1.mp4
> No suitable destination track found - creating new one (type soun)
> No suitable destination track found - creating new one (type vide)
> Appending file b2.mp4
> No suitable destination track found - creating new one (type soun)
> Saving bmiddle.mp4: 0.500 secs Interleaving
> [/code]
> 
> The end result bmiddle.mp4 plays but the audio in the second part does
> not play.
> 
> Doing an inspection using mediainfo showed me this :-
> 
> $ mediainfo bmiddle.mp4
> General
> Complete name                            : bmiddle.mp4
> Format                                   : MPEG-4
> Format profile                           : Base Media
> Codec ID                                 : isom
> File size                                : 63.3 MiB
> Duration                                 : 21mn 52s
> Overall bit rate mode                    : Variable
> Overall bit rate                         : 405 Kbps
> Encoded date                             : UTC 2012-09-18 04:34:29
> Tagged date                              : UTC 2012-09-18 04:34:29
> 
> Video
> ID                                       : 2
> Format                                   : AVC
> Format/Info                              : Advanced Video Codec
> Format profile                           : Baseline at L2.1
> Format settings, CABAC                   : No
> Format settings, ReFrames                : 1 frame
> Format settings, GOP                     : M=1, N=30
> Codec ID                                 : avc1
> Codec ID/Info                            : Advanced Video Coding
> Duration                                 : 21mn 52s
> Bit rate                                 : 352 Kbps
> Maximum bit rate                         : 687 Kbps
> Width                                    : 400 pixels
> Height                                   : 326 pixels
> Display aspect ratio                     : 1.227
> Frame rate mode                          : Constant
> Frame rate                               : 25.000 fps
> Color space                              : YUV
> Chroma subsampling                       : 4:2:0
> Bit depth                                : 8 bits
> Scan type                                : Progressive
> Bits/(Pixel*Frame)                       : 0.108
> Stream size                              : 55.1 MiB (87%)
> Title                                    : (C) 2007 Google Inc. v08.13.2007.
> Encoded date                             : UTC 2011-01-03 14:48:09
> Tagged date                              : UTC 2012-09-18 04:34:29
> 
> Audio #1
> ID                                       : 1
> Format                                   : AAC
> Format/Info                              : Advanced Audio Codec
> Format profile                           : LC
> Codec ID                                 : 40
> Duration                                 : 9mn 51s
> Bit rate mode                            : Variable
> Bit rate                                 : 48.0 Kbps
> Maximum bit rate                         : 57.1 Kbps
> Channel(s)                               : 1 channel
> Channel positions                        : Front: C
> Sampling rate                            : 44.1 KHz
> Compression mode                         : Lossy
> Stream size                              : 3.50 MiB (6%)
> Title                                    : (C) 2007 Google Inc. v08.13.2007.
> Encoded date                             : UTC 2011-01-03 14:48:08
> Tagged date                              : UTC 2012-09-18 04:34:29
> 
> Audio #2
> ID                                       : 3
> Format                                   : AAC
> Format/Info                              : Advanced Audio Codec
> Format profile                           : LC
> Codec ID                                 : 40
> Duration                                 : 12mn 0s
> Bit rate mode                            : Variable
> Bit rate                                 : 48.0 Kbps
> Maximum bit rate                         : 59.0 Kbps
> Channel(s)                               : 1 channel
> Channel positions                        : Front: C
> Sampling rate                            : 44.1 KHz
> Compression mode                         : Lossy
> Stream size                              : 4.26 MiB (7%)
> Title                                    : (C) 2007 Google Inc. v08.13.2007.
> Encoded date                             : UTC 2011-01-03 14:57:13
> Tagged date                              : UTC 2012-09-18 04:34:29
> 
> Why are there two Audio tracks given Audio #1 and Audio #2 ?
> 
> Did I do something wrong ? If yes, then what ? Trying to figure how
> the tool works.
> 
> Looking forward for answers.





More information about the pkg-multimedia-maintainers mailing list