Log in

View Full Version : Append two videos (h264) with mp4box [solved]


pixelartist
28th November 2007, 16:36
Hello all,

i am experiencing a few strange things, maybe one of you can help out.

I have converted two videos with h264 and now i wan to append one to the other, but he just adds the sound and delays the original sound.

Video1(mp4box -info):
* Movie Info *
Timescale 1000 - Duration 00:00:21.080
Fragmented File no - 2 track(s)
File Brand isom - version 512
Created: GMT Fri Jan 2 00:00:00 1970

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:00:21.080
Media Info: Language "English" - Type "vide" - Sub Type "avc1" - 527 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 640 x 480 - Profile Baseline @ Level 3
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:00:20.970
Media Info: Language "English" - Type "soun" - Sub Type "mp4a" - 983 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1

Video2 (mp4box -info):
* Movie Info *
Timescale 1000 - Duration 00:01:59.960
Fragmented File no - 2 track(s)
File Brand isom - version 512
Created: GMT Fri Jan 2 00:00:00 1970

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:01:59.960
Media Info: Language "English" - Type "vide" - Sub Type "avc1" - 2999 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 640 x 480 - Profile Baseline @ Level 3
Pixel Aspect Ratio 1:1 - Indicated track size 640 x 480
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:01:59.957
Media Info: Language "English" - Type "soun" - Sub Type "mp4a" - 5623 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1

I am getting the following results:

Appending file file1.mp4
No suitable destination track found - creating new one (type vide)
No suitable destination track found - creating new one (type soun)
Appending file file2.mp4
No suitable destination track found - creating new one (type vide)
Saving file3.mp4: 0.500 secs Interleaving


And finally the third video:
* Movie Info *
Timescale 600 - Duration 00:02:20.926
Fragmented File no - 3 track(s)
File Brand isom - version 1
Created: GMT Wed Nov 28 15:30:51 2007

File has root IOD
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 25 - Duration 00:00:21.080
Media Info: Language "English" - Type "vide" - Sub Type "avc1" - 527 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 640 x 480 - Profile Baseline @ Level 3
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 48000 - Duration 00:02:20.928
Media Info: Language "English" - Type "soun" - Sub Type "mp4a" - 6606 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
Synchronized on stream 1

Track # 3 Info - TrackID 3 - TimeScale 25 - Duration 00:01:59.960
Media Info: Language "English" - Type "vide" - Sub Type "avc1" - 2999 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 640 x 480 - Profile Baseline @ Level 3
Pixel Aspect Ratio 1:1 - Indicated track size 640 x 480
Synchronized on stream 1

As you see, he doesnt seem to recognize the streams/tracks :eek: - after all i have 1 audio and two video streams, which still should be one.

I just one file1.mp4 in front of file2.mp4 .. ending up in file3.mp4.

Further information:
MP4Box -version
MP4Box - GPAC version 0.4.2
GPAC Copyright: (c) Jean Le Feuvre 2000-2005
(c) ENST 2005-200X


and

FFmpeg version SVN-r10851, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --enable-gpl --enable-pp --enable-libvorbis --enable-libogg --enable-liba52 --enable-libdc1394 --enable-libgsm --disable-debug --enable-libx264 --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-libxvid --enable-pthreads
libavutil version: 49.5.0
libavcodec version: 51.47.0
libavformat version: 51.17.0
built on Nov 8 2007 17:46:56, gcc: 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)

So does any of you know how to get this right?:confused:

Kurtnoise
28th November 2007, 16:55
It's time for you to upgrade your MP4Box build...

cacepi
30th November 2007, 04:07
Look at Track 1 of Video 2:


Track # 1 Info - TrackID 1 - TimeScale 25 - Duration 00:01:59.960
Media Info: Language "English" - Type "vide" - Sub Type "avc1" - 2999 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 640 x 480 - Profile Baseline @ Level 3
Pixel Aspect Ratio 1:1 - Indicated track size 640 x 480

I'll bet you anything that's the problem; MP4Box is reporting a PAR assigned to this track, but not to Track 1 of the first video.

Either try demuxing them to raw streams and see if you can -cat them together or assign a PAR to Track 1 of the first video when using -add:

mp4box -add Video01.mp4#TrackID=1:par=1:1 -add Video01.mp4#TrackID=2 -add Video02.mp4 -new NewVideo.mp4

Oh, and upgrade MP4Box like Kurtnoise said.

pixelartist
30th November 2007, 17:13
Okay,

now i have localised the error why i dont have the actual version.

https://bugs.launchpad.net/ubuntu/+source/gpac/+bug/160403

says that there is not the actual version in my repo. :(

After playing a while with the different repos .. i totally f*cked my system. Right now i have to clear all dependecies between the packages. I will reinstall everything from the multimedia repo, cause this seems a lot easier than my way (configuring everything manually)..

Next week i will try it and post my results!

pixelartist
6th December 2007, 15:59
Okay,

i am late, but i am still on this problem.

What have i done?

I set up 3 different virtual systems and tried everything i read, but there seem to be different problems:

1. As i posted above - if you are using the actual ubuntu version you will get an restricted ffmpeg version (which most of you know). I tried a self compiled version and the standart. It seems if you get it right, both versions of ffmpeg will get you results.

BUT you wont get any actual version of gpac. This will be integrated into the "hardy heron" version of ubuntu, published in April 2008. :(

2. If you try to ad the actual version of gpac you will get a hell of dependancy problems - which will lead to confusion (on my side).

3. I decided to compile and install everything by hand and finally i got everything: a working version of ffmpeg and actual version of gpacs mp4box.

BUT mp4box 0.4.4 doesnt solve my problem :angry:

Right now i am a bit helpless - everything works until i am using the h264 lib.

Now to the question:

I changed the resolution to 320 x 240 which should effect anything, i just want u to know.
The PAR Problem cacepi mentioned ... i tried your solution with "repacking" but this didnt lead to the solution. I got another track which wasnt my intention.
I am not sure what the message "Pixel Aspect Ratio 1:1 - Indicated track size 640 x 480" will tell me, cause i am converting both videos the same way, so they should have the same specifications, shouldnt they?

Are there any other informations you need to help me with this .. i ll be happy to give 'em, just to solve this :D

Kurtnoise
6th December 2007, 16:30
1/ Use a fresh cvs build.
2/ Use -force-cat command:

MP4Box -force-cat -cat file1.mp4 -add file2.mp4 output.mp4

pixelartist
8th January 2008, 16:31
Hello again,

i am still trying it :)

I am running the latest version of the mp4box (0.4.4 rc2) but i am not on step further than the last post.

if i am trying
MP4Box -force-cat -cat file1.mp4 -add file2.mp4 output.mp4
He doesnt like the command and says i should refer to the manual, which read x times now.

Is there any other way to append two videos? I tried mencoder, but this solutions seems to be two steps back ...

I just need to append two h264 ffmpeg converted videos .. i know the solution is out here! :rolleyes:

Kurtnoise
8th January 2008, 20:18
As I said earlier, use a fresh CVS build...So, you need to compile it by yourself. Not very complicated.

pixelartist
10th January 2008, 16:58
I am happy to report its done!

It works!

Finally ...

MP4Box -version
MP4Box - GPAC version 0.4.5-DEV (build 13)
GPAC Copyright: (c) Jean Le Feuvre 2000-2005
(c) ENST 2005-200X

Its not possible to use the standart "cat" command .. it just works with the -force parameter given earlier.

I want to thank all who helped out.

P.S. This Video stops playing after 3 secs on an ipod shuffle, but this will be an other thread :)