View Full Version : Cutting and joining H264 AVC
hubereevez
25th February 2005, 00:50
Still hanging there.
Have two AVC-video files and one he-aac audio file created by nero.
Cannot happen movie & credits. Cannot mux avc with he-aac
;(
Help me please.......
hubereevez
6th March 2005, 17:41
It has been month now, that I'm trying to join h264 streams.
No editor could do that, at least, into mp4 !!!!
Moreover, babayaga told me, they asked nero to produce such an editor, but he thinks that, it's "container dependant" (mp4 tools), due to compliance.
But now, and as always, the solution comes from matroska.
I would like to build a mp4 compliant file to be able to play the movie on futur dvd/avc capable player. But I dismiss, fo now.
I think encoding credits separatly is important due to the gain of space (20 mins on 8Mo).
So, with the new mkvtoolnix, you'll be able to muw join, cut avc and He-aac, subs, chapter.
The only backside, is that demuxing is, for now, impossible (like with rv10 before :) ).
voilà
hubert
bond
6th March 2005, 23:29
just before everyone starts crying because this thread gets "abandoned":
1) its possible to join raw avc streams via dos commandline when they have the same resolution/encoding options used
2) its possible to mux the resulting joined raw avc stream correctly into .mp4 with mp4creator
3) its possible to mux he-aac with implicit sbr signalling into .mp4 with mp4creator
4) its possible to mux he-aac with explicit (and of course implicit) signalling into .mp4 with mp4box
5) its possible to join avc streams with he-aac streams with mp4creator
anything left?
hubereevez
6th March 2005, 23:57
1) and 2) now it's possible with 1.2.10 mp4creator. I did test it with bond, he was helping and questionning me on irc. There is no more seeking problem and/or black scene at the joining scene.
3 4 and 5) do not know, I have problem with muxing .aac files. the mehtod you decribe seems to be complicated.
anyway
This thread can be consider close. for peaolple, like me who are encoding separatly movie and credits, you can use mp4creator :
*extract video streams, renaming them : .h264
*join them, dos or download hjsplit
*mux them using frame command (-rate= )
Voilà
No need to be hard.
hubert
Doom9
7th March 2005, 08:25
anything left?split MP4 at timecode hh:mm:ss:ff, and split while muxing (based on timecode or size).
bond
7th March 2005, 09:27
Originally posted by Doom9
split MP4 at timecode hh:mm:ss:ff, and split while muxing (based on timecode or size). well my answers were related to huberts problems
you can split while muxing with the nero dshow muxer at a specific size...
Doom9
7th March 2005, 09:38
you can split while muxing with the nero dshow muxer at a specific size...I thought they had changed their filters to only allow them to be used by Recode and NVE3. Plus, Graphedit isn't really a user-friendly tool. CLI options for tools like mp4creator would be much more convenient and can easily be wrapped in a GUI (MeGUI, AutoAC and mp4muxer come to mind).
hubereevez
24th May 2005, 21:34
Give another try with cutting AVC in mp4 (want to cut 03:18 at the beginning of the movie). No luck with latest mp4box build(MP4Box - GPAC version 0.3.0-DEV 23/05/05).
J:\Programmes\Encodage\mp4>mp4box -splitx 78:7555 "E:\les charlots\débattent sur l'europe.mp4"
+ splitx
remove all mpeg4 systems media :confused:
Seems the only solution is to use the cutting fonction into mkv at this time. I'd rather keep my mp4 format for this.
Thanks
Hubert
DeeGee
24th May 2005, 21:59
Huh? MPEG4 systems media?
A file with AVC, 3x HE-AAC, 2x subtitle tracks and chapters splitted just fine with mp4box. try mp4box -info filename.mp4 to see what tracks the file has.
hubereevez
25th May 2005, 19:13
here is the info given by mp4box, from mp4 created by nero (only video, that's all)
* Movie Info *
Timescale 1000 - Duration 02:00:23.120
Fragmented File no - 3 track(s)
File Brand avc1 - version 0
File has root IOD
Scene PL 0x01 - Graphics PL 0xfe - OD PL 0xfe
Visual PL: No visual capability required (0xff)
Audio PL: ISO Reserved (0x00) (0x00)
Track # 1 Info - TrackID 1 - TimeScale 1000 - Duration 00:00:00.001
Track is present in Root OD
Media Type "odsm" - Media Sub Type "mp4s" - 1 samples
MPEG-4 Config: ObjectDescriptor Stream - ObjectTypeIndication 0x01
Self-synchronized
Track # 2 Info - TrackID 2 - TimeScale 1000 - Duration 00:00:00.001
Track is present in Root OD
Media Type "sdsm" - Media Sub Type "mp4s" - 1 samples
MPEG-4 Config: SceneDescription Stream - ObjectTypeIndication 0x01
Synchronized on stream 1
Track # 3 Info - TrackID 3 - TimeScale 25000 - Duration 02:00:23.120
Media Type "vide" - Media Sub Type "avc1" - 180578 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 592 x 320
Synchronized on stream 1
here is the help about -splitx
-splitx start:end extracts a new file from start to end (in seconds)
* Note: this removes all MPEG-4 Systems media
voilà
hubert
hubereevez, whats the exact problem?
mp4box removes the bifs/od streams when splitting a .mp4
the bifs/od streams are the systems information, the "scene". eg they can carry a dvd-like menu
now imagine you have a .mp4 which carries such a menu. when you now split the file simply in the middle, the menu info is not necessarily correct anymore (it can be still working, but more likely it will not), therefore mp4box will remove the systems streams when splitting, to avoid having f*ed up systems info in the splitted parts
after all its not mandatory having the systems streams in a .mp4
Originally posted by Doom9
[B]I thought they had changed their filters to only allow them to be used by Recode and NVE3. their muxer seems to work still :)
hubereevez
28th May 2005, 12:29
Please read my previous messages more carefully, Bond.
Said no luck with latest mp4box and nero recode. i have created a video-only mp4 !
WARNING: Track ID 1 (type odsm) not handled by spliter - skipping
WARNING: Track ID 2 (type sdsm) not handled by spliter - skipping
Adjusting chunk start time to previous random access at 717.12 sec
Then asking, what was this "mpeg4 media removing" (thanks for the clear and nice respons :))
Anyway, it seems i have a pb with these warnings. mp4box is crashing then (am i the only one here ?)
DATABASE>
<EXE NAME="MP4Box.exe" FILTER="GRABMI_FILTER_PRIVACY">
<MATCHING_FILE NAME="MP4Box.exe" SIZE="999424" CHECKSUM="0x1978C645" MODULE_TYPE="WIN32" PE_CHECKSUM="0x0" LINKER_VERSION="0x0" LINK_DATE="05/23/2005 02:16:46" UPTO_LINK_DATE="05/23/2005 02:16:46" />
..............
Originally posted by hubereevez
Anyway, it seems i have a pb with these warnings. mp4box is crashing then (am i the only one here ?) [/B] ok so a crash happens
can you upload such a small sample showing this somewhere?
hubereevez
28th May 2005, 12:45
Thanks for the quick respons, I can't cut a sample of my file since mp4box crashes. :rolleyes:
But I will try to re-encode a small part this week end. :)
NuPogodi
8th September 2005, 12:33
Hi, mp4-gurus! i've just met a tiny problem when used MP4Box (GPAC version 0.4.0, i guess the celtic_druid's compile) for cutting and joining AVC H264 (x264CLI, --bframes=2, --ref=3, --b-pyramid, etc.). Well, mp4box does sucessfully split such a video till the last i-frame... The question is how to extract the p & b-frames following the last i-frame? everytime when i define the end time (-splitx start_time_sec:end_time_sec) within the movie duration range, mp4box ignores them. As soon as i use the command with the end time which exceeds the movie duration, mp4box does not output at all (just gives me a warning that the video stream is too long or smth like this).
Well, i've found the only workaround - i've added, at least, one keyframe to the end of a movie and cut with the end time = original movie duration + 1sec. It requires some additional efforts, so my question is: Does somebody know more convenient way?
bond
1st October 2005, 10:20
it doesnt make sense to extract p/b-frames only without an i-frame before them
alos avc is very advanced and allows you to have frames referencing to frames before the last i-frame, therefore it might also be that you need two i-frames to get a correct snip
NuPogodi
4th October 2005, 14:03
it doesnt make sense to extract p/b-frames only without an i-frame before them
You didnot catch a problem. Ok, let me explain the whole situation... i've compressed a movie, but some frames somewhere in the middle look, to my opinion, too "bad" and require higher bitrate. Should i recompress a whole movie? too long, too stupid, too... so, i want to recompress only "bad" frames and to join them with the rest (of already encoded video). In other words, i have to take just encoded movie and to extract by mp4box (-splitx begin_time:end_time)
i) its part preceeding this "bad" encoded frames and
ii) its part following "bad" frames -- till the last movie frame (whatever it is - i, p or b), but not till the last i-frame.
Then i have
iii) to recompress the clip in-between (i still have the sources) and finally
iv) to join all 3 clips into a whole movie.
The problem appears on the step ii). No matter what i'm doing (i actually tried to play around "end_time"), mp4box always extracts the clip ii) ended at the last i-frame of the whole movie and ignores the following p,b-frames (few seconds).
alos avc is very advanced and allows you to have frames referencing to frames before the last i-frame, therefore it might also be that you need two i-frames to get a correct snip
Do you mean: two preceeding i-frames? i don't think so - otherwise how mp4box can cut (without reencoding)? maybe, one i-frame preceeding and one following i-frame? it sound quite reasonable, but i did not meet movies ended by i-frame, i.e. the last movie frame (p- or b-) refers to preceeding frames only... i still don't understand what does prevent mp4box to cut at this frame?
bond
4th October 2005, 14:50
is it this what you mean:
you want to have two parts after splitting:
1) part1 goes from the beginning till where the bad frames begin
2) part2 goes from the bad frames end till the end of the whole movie
i assume splitx has hardcoded to only cut on keyframes, thats why it stops outputting the frames after the last keyframe
edit: i reproduced the same/similar problem and made a bug report here (https://sourceforge.net/tracker/index.php?func=detail&aid=1312928&group_id=84101&atid=571738)
as alternative you could try cutting the stream not with splitx, but with split, which will split the movie every x seconds and should give you the same part1 and part2 you want, but needs to split the original stream 2 times
the other question is of course: what are these bad frames? any screenshot? x264 shouldnt give you "bad frames" unless there is a bug
NuPogodi
4th October 2005, 17:37
is it this what you mean:
you want to have two parts after splitting:
1) part1 goes from the beginning till where the bad frames begin
2) part2 goes from the bad frames end till the end of the whole movie
Yes (not exactly between the beginning and the end of "bad" frames, but the closest preceeding and the closest following keyframes).
i assume splitx has hardcoded to only cut on keyframes, thats why it stops outputting the frames after the last keyframeWell, i guess any split (split, splits, splitx) is possible only at keyframes. The problem is that, ATM, mp4box splits on the keyframe which preceeds the "end_time" and does not output when "end_time" exceeds the movie duration.
edit: i reproduced the same/similar problem and made a bug report here (https://sourceforge.net/tracker/index.php?func=detail&aid=1312928&group_id=84101&atid=571738)Thanks a lot...
as alternative you could try cutting the stream not with splitx, but with split, which will split the movie every x seconds and should give you the same part1 and part2 you want, but needs to split the original stream 2 timesI've already found few workarounds
1. to join original movie with some trash and to split the joined movie at "end_time" = movie duration + 1 sec
2. or to split original movie till the last keyframe, recompress the following frames and to join them, etc.
the other question is of course: what are these bad frames? any screenshot? x264 shouldnt give you "bad frames" unless there is a bug
I've used the word "bad" just for brevity. In fact, these frames show a rainy street and require very high bitrate to see that it does look like a rain. It is definitely not a bug, just a bit wrong encoding settings.
bond
4th October 2005, 17:44
Well, i guess any split (split, splits, splitx) is possible only at keyframes. The problem is that, ATM, mp4box splits on the keyframe which preceeds the "end_time" and does not output when "end_time" exceeds the movie duration.well you should try it, split/splits might output till the end on the last split
I've used the word "bad" just for brevity. In fact, these frames show a rainy street and require very high bitrate to see that it does look like a rain. It is definitely not a bug, just a bit wrong encoding settings. ok, but beaware that you cant join avc streams with different settings in some cases (higher bitrate is of course fine)
NuPogodi
5th October 2005, 11:52
ok, but beaware that you cant join avc streams with different settings in some cases (higher bitrate is of course fine)
i've already tried and found another non-documented "feature" of mp4box. It seems that mp4box can join any streams - no matter, whether they were compressed at the same x264cli-settings or not.
i) When the settings are the same, the second videoclip is just appended to the end of the first (as, actually, is expected). So, the ouput is one videotrack with the duration = duration1 + duration2.
ii) When the settings for two joined segments are different, mp4box produces mp4-ouput with two independent videotracks... when i at first joined such segments, i wondered why the ouput size (KB) = size1 + size2, but the output duration = duration1. Fortunately, there are mkvtools and mmg (thanks to Mosu).
bond
5th October 2005, 18:30
i've already tried and found another non-documented "feature" of mp4box. It seems that mp4box can join any streams - no matter, whether they were compressed at the same x264cli-settings or not.
i) When the settings are the same, the second videoclip is just appended to the end of the first (as, actually, is expected). So, the ouput is one videotrack with the duration = duration1 + duration2.
ii) When the settings for two joined segments are different, mp4box produces mp4-ouput with two independent videotracks... when i at first joined such segments, i wondered why the ouput size (KB) = size1 + size2, but the output duration = duration1. Fortunately, there are mkvtools and mmg (thanks to Mosu).thats exactly the behaviour it should have, you are not able/shouldnt be able to mux segments with different encoding settings
bond
7th October 2005, 13:09
seems to be fixed now:
https://sourceforge.net/tracker/?func=detail&atid=571738&aid=1312928&group_id=84101
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.