Log in

View Full Version : Concatenate h264 stream from different sources? keeps joining as 2 different tracks


link626
21st January 2013, 17:28
I'm trying to join two h264 video streams into one mp4 with one track.
But mp4box keeps outputting an mp4 file containing two separate tracks.
If I try to force it into one track with avidemux, the 2nd part of the video stream is corrupt.

Both video streams have the same resolution.

Mp4box info of the two h264 files-


-info 1111.mp4
* Movie Info *
Timescale 600 - Duration 00:00:09.008
Fragmented File no - 1 track(s)
File Brand isom - version 1
Created: GMT Mon Jan 21 11:46:47 2013

File has root IOD
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: No audio capability required (0xff)
No streams included in root OD

Track # 1 Info - TrackID 1 - TimeScale 30000 - Duration 00:00:09.009
Media Info: Language "Undetermined" - Type "vide:avc1" - 270 samples
Visual Track layout: x=0 y=0 width=704 height=386
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 704 x 386
AVC Info: 1 SPS - 1 PPS - Profile High @ Level 3
NAL Unit length bits: 32
Pixel Aspect Ratio 1:1 - Indicated track size 704 x 386
Self-synchronized



-info 4444.mp4
* Movie Info *
Timescale 600 - Duration 00:03:50.230
Fragmented File no - 1 track(s)
File Brand isom - version 1
Created: GMT Mon Jan 21 11:29:47 2013

File has root IOD
Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
Visual PL: AVC/H264 Profile (0x15)
Audio PL: No audio capability required (0xff)
No streams included in root OD

Track # 1 Info - TrackID 1 - TimeScale 11988 - Duration 00:03:50.230
Media Info: Language "Undetermined" - Type "vide:avc1" - 6900 samples
Visual Track layout: x=0 y=0 width=704 height=386
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 704 x 386
AVC Info: 1 SPS - 1 PPS - Profile High @ Level 3.1
NAL Unit length bits: 32
Pixel Aspect Ratio 1:1 - Indicated track size 704 x 386
Self-synchronized




Anyone know why I can't join these two files into one stream in an mp4 container?

I'm trying to do the same thing I've done with xvid, where you can join 2 different video sources as long as resolution is the same.

poisondeathray
21st January 2013, 17:42
High@Level3.0 vs. High@Level3.1 . Even if it's just a "label", usually everything has to match for the highest probability to append streams successfully

You might be able to patch one to match the other using H264 Level Editor, or this ffmpeg patched build , then join . But if there are other differences in the streams, you might have problems anyways
http://forum.doom9.org/showthread.php?t=152419
http://www.videohelp.com/tools/H264-AVC-Level-Editor

Another approach would be to re-encode the 1st one using the same settings as the 2nd, then try appending

link626
21st January 2013, 22:15
modified the profile level of 1111.mp4 to 3.1, forced cat, and error message and video still corrupt....


D:\>MP4Box.exe -force-cat -cat 1111.h264 -cat 4444.h264 testing.mp4
AVC-H264 import - frame size 704 x 386 at 29.970 FPS
AVC Import results: 270 samples - Slices: 2 I 266 P 2 B - 1 SEI - 2 IDR
Appending file 1111.h264
No suitable destination track found - creating new one (type vide)
AVC-H264 import - frame size 704 x 386 at 29.970 FPS
AVC Import results: 6900 samples - Slices: 23 I 1868 P 5009 B - 0 SEI - 23 IDR
Stream uses forward prediction - stream CTS offset: 2 frames
Appending file 4444.h264
WARNING: Concatenating track ID 1 even though sample descriptions do not match
Saving to testing.mp4: 0.500 secs Interleaving




Anything else need to match up?

Guest
21st January 2013, 22:19
Anything else need to match up? Yes, the SPS's and PPS's must match.

link626
22nd January 2013, 10:35
Got it to work finally after lots of trial and error and tons of remuxing.

Used x264gui to reencode the 9 second intro to match the profile settings of the 4444.mp4,
then used mp4box to extract h264 raw streams,
-concat'd the two h264 streams to mp4,
extract the h264 again from the concat'd file,
then remuxed to final output file.