I have an online class that provides MP4 versions of class lectures, but the lectures are broken into chunks that are each a few minutes long. I'm trying to concatenate the chunks into whole lectures, and several online discussions recommend MP4Box on Ubuntu. I use the following command:
$ MP4Box -cat chunk1.mp4 -cat chunk2.mp4 -new lecture.mp4
I've also tried
$ MP4Box -add chunk1.mp4 -cat chunk2.mp4 lecture.mp4
Both videos play fine on their own. The problem is that when I concatenate the videos, I receive the following warning:
WARNING: Concatenating track ID 1 with different PPS - result file might be broken
The resulting video, played using VLC media player, is inconsistent. For example, if I concatenate only chunks 1 & 2, the audio for both tracks is fine, but the video of chunk 1 is just a gray screen. Once it gets to what used to be chunk 2, everything works great.
I ran MP4Box -info on each chunk, and despite the warning, they appear to have the same PPS. In fact, everything about their configuration appears identical. Those results are included below.
On Windows I used a one-click GUI tool (Any Video Converter Free) for this, and I didn't ever have to mess with the configuration settings. So I'm a total noob to merging video on Linux. Not sure what else to look for or try. All the discussion I can find on troubleshooting concatenation is related to SPS errors, which I'm not seeing.
$ MP4Box -info chunk1.mp4
* Movie Info *
Timescale 600 - Duration 00:00:55.100
2 track(s)
Fragmented File: no
File suitable for progressive download (moov before mdat)
File Brand isom - version 1
Created: GMT Tue Dec 30 16:59:35 2014
File has root IOD (9 bytes)
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: AAC Profile @ Level 2 (0x29)
No streams included in root OD
Track # 1 Info - TrackID 1 - TimeScale 30000 - Media Duration 00:00:55.055
Media Info: Language "Undetermined" - Type "vide:avc1" - 1650 samples
Visual Track layout: x=0 y=0 width=852 height=480
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 852 x 480
AVC Info: 1 SPS - 1 PPS - Profile Main @ Level 3.1
NAL Unit length bits: 32
Pixel Aspect Ratio 1:1 - Indicated track size 852 x 480
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 44100 - Media Duration 00:00:55.100
Media Info: Language "Undetermined" - Type "soun:mp4a" - 2373 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 44100
Synchronized on stream 1
And for the second file:
$ MP4Box -info chunk2.mp4
* Movie Info *
Timescale 600 - Duration 00:04:11.981
2 track(s)
Fragmented File: no
File suitable for progressive download (moov before mdat)
File Brand isom - version 1
Created: GMT Wed Nov 19 15:19:33 2014
File has root IOD (9 bytes)
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: AAC Profile @ Level 2 (0x29)
No streams included in root OD
Track # 1 Info - TrackID 1 - TimeScale 30000 - Media Duration 00:04:11.951
Media Info: Language "Undetermined" - Type "vide:avc1" - 7551 samples
Visual Track layout: x=0 y=0 width=852 height=480
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 852 x 480
AVC Info: 1 SPS - 1 PPS - Profile Main @ Level 3.1
NAL Unit length bits: 32
Pixel Aspect Ratio 1:1 - Indicated track size 852 x 480
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 44100 - Media Duration 00:04:11.982
Media Info: Language "Undetermined" - Type "soun:mp4a" - 10852 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 44100
Synchronized on stream 1