Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th April 2005, 17:17   #1  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
HowTo split/concatenate MP4 files with MP4Box

some might have already noticed it: MP4Box now supports splitting and concatenating of MP4 files too

splitting

splitting can be done timewise, sizewise (eg split every 700MB). parts of a MP4 can be extracted timewise (eg from sec 10 - 60)...

of course splitting video will be done at keyframes automatically. to avoid too much hassles with keyframes the splitting option will only work on mp4 files which have only 1 video stream!

the flags for splitting are:
- split seconds
- splits size (in kb)
- splitx Starttime:Endtime (in seconds)

eg if you want to split a 1400mb MP4 file into two parts a 700mb you can use the following cmdl:
Code:
MP4Box -splits 716800 input.mp4
concatenating

concatenating (or appending) can be done on all files which are similar (eg same resolution, some audio/video format...), framerate shouldnt matter (as MP4 supports variable framerate)

the flag for concatenating is:
- cat
it works in a similar way as "-add", which means you can even -cat two .avi or .mpg files into one MP4 file in one commandline

eg for concatenating two files you can use:
Code:
MP4Box -cat file1.mp4 -cat file2.mp4 output.mp4
both cat and split should work with all streams supported in MP4Box, like ASP, AVC, AAC, MPEG-1/2 Audio and Video (eg MP3), TTXT and even on Vobsubs and ALAC (apple's lossless audio codec using in itunes) and the chapters should be edited too

i did lots of tests with these functions, so it seems to be pretty stable already, but of course there can still be glitches as its a pretty new feature

get a binary supporting it here (compiled by celtic_druid)
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free

Last edited by bond; 2nd June 2005 at 21:02.
bond is offline   Reply With Quote
Old 19th April 2005, 19:31   #2  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
cool, I've been waiting for this.

Cu Selur
Selur is offline   Reply With Quote
Old 19th April 2005, 21:28   #3  |  Link
virus
Senior n00b
 
Join Date: Jan 2004
Location: Italy
Posts: 446
Quote:
Originally posted by bond
eg if you want to split a 1400mb MP4 file into two parts a 700mb you can use the following cmdl:
Code:
MP4Box -splits 700000 input.mp4
I'd say that 716800 (700 * 1024 KB) would be better here...
virus is offline   Reply With Quote
Old 20th April 2005, 19:19   #4  |  Link
JoeBG
stupid
 
JoeBG's Avatar
 
Join Date: Sep 2004
Location: Cologne
Posts: 638
Quote:
Originally posted by Selur
cool, I've been waiting for this.

Cu Selur
This is the answer to many user questions. Hope mezzanine will add this to his gui!!!
__________________
cu

Joe
------------------------
freedom is just another word for nothing left to loose
JoeBG is offline   Reply With Quote
Old 23rd April 2005, 08:33   #5  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
does anyone know if a frame accurate split is planed?
Selur is offline   Reply With Quote
Old 23rd April 2005, 12:19   #6  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
Quote:
does anyone know if a frame accurate split is planed?
Considering that frame accurate means GOP re-encoding I have very strong doubts that's ever going to happen. mp4box, and the whole gpac framework is not at all about video encoding.

Here's a piece of info not mentioned anywhere: you can split while muxing. mp4box first muxes all your streams, then it splits the final MP4 file.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 25th April 2005, 17:44   #7  |  Link
JoeBG
stupid
 
JoeBG's Avatar
 
Join Date: Sep 2004
Location: Cologne
Posts: 638
Re: HowTo split/concatenate MP4 files with MP4Box

Quote:
Originally posted by bond
[B]
Code:
MP4Box -cat file1.mp4 -cat file2.mp4 output.mp4
Does not work for me. I tried (AVC-videos only):

mp4box -cat Film.mp4 -cat Credits.mp4 Total.mp4
Total.mp4 only includes "Film.mp4"

Here is the log:
mp4box.exe" -cat Film.mp4 -cat Credits.mp4 Total.mp4
Appending file Film.mp4
No suitable destination track found - creating new one (type vide)
Appending file Credits.mp4
No suitable destination track found - creating new one (type vide)
Saving to Total.mp4: 0.500 secs Interleaving
__________________
cu

Joe
------------------------
freedom is just another word for nothing left to loose
JoeBG is offline   Reply With Quote
Old 25th April 2005, 17:50   #8  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally posted by JoeBG
Does not work for me. I tried (AVC-videos only):

mp4box -cat Film.mp4 -cat Credits.mp4 Total.mp4
Total.mp4 only includes "Film.mp4"
hm, try mp4box -cat Film.mp4 -cat Credits.mp4 -new Total.mp4
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 25th April 2005, 18:11   #9  |  Link
JoeBG
stupid
 
JoeBG's Avatar
 
Join Date: Sep 2004
Location: Cologne
Posts: 638
Quote:
Originally posted by bond
hm, try mp4box -cat Film.mp4 -cat Credits.mp4 -new Total.mp4
Edit:
Same output, just Film.mp4 is in Total.mp4

Here is the log:

D:\Testvideo\Test2>"C:\Programme\DVD Tools\mpeg4\GPac\mp4box.exe" -cat Film.mp4
-cat Credits.mp4 -new Total.mp4
Appending file Film.mp4
No suitable destination track found - creating new one (type vide)
Appending file Credits.mp4
No suitable destination track found - creating new one (type vide)
Saving Total.mp4: 0.500 secs Interleaving
__________________
cu

Joe
------------------------
freedom is just another word for nothing left to loose

Last edited by JoeBG; 25th April 2005 at 18:41.
JoeBG is offline   Reply With Quote
Old 25th April 2005, 19:21   #10  |  Link
JoeBG
stupid
 
JoeBG's Avatar
 
Join Date: Sep 2004
Location: Cologne
Posts: 638
@ bond

I´m testing all possible combinations since hours, but it does not work for me
__________________
cu

Joe
------------------------
freedom is just another word for nothing left to loose
JoeBG is offline   Reply With Quote
Old 26th April 2005, 14:07   #11  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
maybe the two samples use some features that are not combineable into one stream...
can you upload two short snips of both streams somewhere plz
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 26th April 2005, 15:46   #12  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
"Considering that frame accurate means GOP re-encoding.."
no, it shouldn't have to if one uses a mp4 shell.
iirc with a mp4 shell it should be possible that the split would still be at gop start/end, but the 1st part shouldn't show the frames behind the splitpoint that belong to the gop the splitpoint belongs too. The second part would start decoding at the start of the gop, but display would start at behind the splitpoint,..
Selur is offline   Reply With Quote
Old 26th April 2005, 15:47   #13  |  Link
JoeBG
stupid
 
JoeBG's Avatar
 
Join Date: Sep 2004
Location: Cologne
Posts: 638
I can join them with DOS and "-add" the joined file with mp4box; works perfekt. It´s a scene, cuttet out of the middle of a film. Similar avs Skripts for credits and film, just other trim parameters.

The encoding of the Credits was done with CQ 40. The encoding of the main-movie was with 2 pass.

Do you really need it upped somewhere?
__________________
cu

Joe
------------------------
freedom is just another word for nothing left to loose
JoeBG is offline   Reply With Quote
Old 26th April 2005, 15:59   #14  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally posted by JoeBG
Do you really need it upped somewhere? [/B]
no, but than i have no idea whats wrong
with the split option you could upload two small 500kb samples somewhere i could try

are you sure you used the same settings in both files, apart from the quant thingie? meaning, do both use cabac, same deblocking setting, same resolution, etc...
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Old 26th April 2005, 16:16   #15  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
if it's AVC, it might have something to do with the issue we discussed about joining raw streams when I introduced the separate credits encoding in megui. Does raw merging, then muxing the resulting stream into an mp4 work?
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 26th April 2005, 17:03   #16  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
Quote:
Originally posted by JoeBG
This is the answer to many user questions. Hope mezzanine will add this to his gui!!!
Indeed... If Mezzanine was able to follow mpucoder's MuxMan style of GUI, you may like to know that mpucoder made a provision for appending too!

My thanks to everybody... It looks like their are some exciting times ahead for the .MP4 container


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is online now   Reply With Quote
Old 26th April 2005, 17:25   #17  |  Link
JoeBG
stupid
 
JoeBG's Avatar
 
Join Date: Sep 2004
Location: Cologne
Posts: 638
Quote:
Originally posted by bond
no, but than i have no idea whats wrong
with the split option you could upload two small 500kb samples somewhere i could try

are you sure you used the same settings in both files, apart from the quant thingie? meaning, do both use cabac, same deblocking setting, same resolution, etc...
No, definitly not. I just choosed the same resolution and the same resize parameters, but apart of this the other settings differ. You know one is the Credit, the other is the main movie => they must have other settings

@ doom9

It is AVC, so you might be right with analysing the problem.
__________________
cu

Joe
------------------------
freedom is just another word for nothing left to loose
JoeBG is offline   Reply With Quote
Old 26th April 2005, 18:00   #18  |  Link
Doom9
clueless n00b
 
Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,579
Quote:
I just choosed the same resolution and the same resize parameters, but apart of this the other settings differ.
Then even if the merge would work, your result would not be playable properly. That's why I changed my separate credits jobs to use the 2pass parameters and just change the encoding mode to quantizer based and set the credits quantizer.. the rest of the settings is the same. aku listed a bunch of options that must match for a merge to be successful.. if you violate any of those, all bets are off and I had to find out the hard way that those details do matter.

Why are you not using MeGUI by the way? Even though there are potential problems even with MeGUI, so far nobody has reported a problem with separate end credits using x264. At least you cannot mess up the settings unless you edit the xml files.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org
Doom9 is offline   Reply With Quote
Old 28th April 2005, 17:54   #19  |  Link
JoeBG
stupid
 
JoeBG's Avatar
 
Join Date: Sep 2004
Location: Cologne
Posts: 638
Quote:
Originally posted by Doom9
Then even if the merge would work, your result would not be playable properly. That's why I changed my separate credits jobs to use the 2pass parameters and just change the encoding mode to quantizer based and set the credits quantizer.. the rest of the settings is the same. aku listed a bunch of options that must match for a merge to be successful.. if you violate any of those, all bets are off and I had to find out the hard way that those details do matter.
This helps a lot for understanding, thank you very much

Quote:
Originally posted by Doom9
Why are you not using MeGUI by the way?[/B]
I used MeGUI for creating the samples. You know I love your tool.

But to come back to facts. I can join them with DOS, I can add the result with mp4box and everything plays fine. No stuttering.

But I cannot join "Main movie" and "Credits" with mp4box.
__________________
cu

Joe
------------------------
freedom is just another word for nothing left to loose
JoeBG is offline   Reply With Quote
Old 28th April 2005, 20:17   #20  |  Link
bond
Registered User
 
Join Date: Nov 2001
Posts: 9,770
Quote:
Originally posted by JoeBG
But I cannot join "Main movie" and "Credits" with mp4box. [/B]
well i doubt anyone can really help without getting the samples and not just guess around...

did you make a bug report on sourceforge at least already?
__________________
Between the weak and the strong one it is the freedom which oppresses and the law that liberates (Jean Jacques Rousseau)
I know, that I know nothing (Socrates)

MPEG-4 ASP FAQ | AVC/H.264 FAQ | AAC FAQ | MP4 FAQ | MP4Menu stores DVD Menus in MP4 (guide)
Ogg Theora | Ogg Vorbis
use WM9 today and get Micro$oft controlling the A/V market tomorrow for free
bond is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:54.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.