View Full Version : MP4Box Hack
defunkt
8th October 2005, 20:01
Made a quick & dirty change to MP4Box which may be of use to others. New command line parameter -handler allows you to specify the stream handler text (displayed by Haali's splitter in the stream selection menu) as tracks are added. i.e.
mp4boxer -add "myvideo.264" -handler "AVC Main Profile" -fps 25 -out "mymovie.mp4"
mp4boxer -add "myaudio.aac" -handler "AAC LC 5.1 Soundtrack" -out "mymovie.mp4"
mp4boxer -add "director.m4a#audio" -handler "AAC HE 2.0 Commentary" -out "mymovie.mp4"
Download: http://www.mytempdir.com/250505
tedgo
8th October 2005, 22:58
Thank you. It's a good idea.
This is one thing i missed so far on creating mp4.
Would be great if megui and/or yamb would use your mp4box modification one day to simplify the specification of stream handler text.
guada2
9th October 2005, 08:56
Why have called it Mp4Boxer?
However it's a good idea.
I tried to replace it by Mp4Box (into m2d mp4muxer) to make me an idea on my problem.
It is undoubtedly an error.
Apparently, the mode Realtime de Nero digital is very complicated.
Thank you nevertheless, defunkt .
bond
9th October 2005, 13:53
nice stuff defunkt
edit: i made a first test with a mp4 with an aac, a bifs and an od stream and it didnt work out, none of the streams had the defined name set.
i assume it will be necessary to also set the tracknumber in the cmdl for defining which stream should get the name
btw are you forcing utf-8? here is what the specs say:
name is a null-terminated string in UTF-8 characters which gives a human-readable name for the track type (for debugging and inspection purposes). you might want to change -handler to -name?
also it would be good if you make a patch submission on gpacs sourceforge page:
http://sourceforge.net/tracker/?atid=571740&group_id=84101&func=browse
defunkt
10th October 2005, 08:09
@Bond - Are we talking about the same field? I'm refering to moov/trak/mdia/hdlr, by default MP4Box places something like "GPAC ISO Video Handler" in this box. Just tested again and it's still working as intended for me with or without bifs/OD, please advise.
JoeBG
10th October 2005, 17:12
Does it also work with importing audio from mp4 files and not as raw?
bond
12th October 2005, 17:53
@Bond - Are we talking about the same field? I'm refering to moov/trak/mdia/hdlr, by default MP4Box places something like "GPAC ISO Video Handler" in this box. Just tested again and it's still working as intended for me with or without bifs/OD, please advise.yeah we are talking about the same thing, doesnt work here
tedgo
13th October 2005, 01:11
It works good for me. I used it with the following cmd:
MP4Boxer.exe -nodrop -add "Track1.avi#video:lang=ger" -handler "XviD MPEG4 ASP Videostream" "Film.mp4"
MP4Boxer.exe -add "Track2.aac:lang=ger" -handler "Dolby Surround" "Film.mp4"
MP4Boxer.exe -add "Track3.aac:lang=ger" -handler "Dolby Surround Audiokommentar" "Film.mp4"
MP4Boxer.exe -add "Track4.srt:lang=ger" -handler "Deutsch - Erzwungen" "Film.mp4"
MP4Boxer.exe -add "Track5.srt:lang=ger" -handler "Deutsch für Hörgeschädigte" "Film.mp4"
MP4Boxer.exe -chap "Chapters.txt" "Film.mp4"
But i have one question:
Is it possible to get a shorter command without writing the mp4 each time and wasting so much time for it?
I tried:
MP4Boxer.exe -nodrop -add "Track1.avi#video:lang=ger" -handler "XviD MPEG4 ASP Videostream" -add "Track2.aac:lang=ger" -handler "Dolby Surround" -add "Track3.aac:lang=ger" -handler "Dolby Surround Audiokommentar" -add "Track4.srt:lang=ger" -handler "Deutsch - Erzwungen" -add "Track5.srt:lang=ger" -handler "Deutsch für Hörgeschädigte" -chap "Chapters.txt" "Film.mp4"
But only the last -handler was written to all streams...
And another question:
Is it possible to add support for german special characters like ä, ö, ü and ß for stream handler and chapters to mp4box/mp4boxer? Because "Deutsch für Hörgeschädigte" is shown as "Deutsch fr H rgesch digte" as stream handler and it looks also strange like "Deutsch fuer Hoergeschaedigte", the solution i used so far with dumpster.
The same for chapters.
defunkt
13th October 2005, 07:28
Only works when tracks are being created, can't be used to update existing track handler text - I did say it was quick & dirty.
@tedgo: I should be able to make it handle multiple tracks in one go provided mp4box writes them in command line order. I don't know much about extended character sets but I'll look into it.
tedgo
13th October 2005, 09:59
@defunkt
:thanks:
It would be great if you're able to integrate the two mentioned "functions" in mp4boxer. It would make it another step easier for me to change completely from mkv to mp4 :cool:
defunkt
14th October 2005, 22:37
Sorry, I took a look and it would take more time than I have to spend on it right now. All I can suggest (if you're not already doing so) is allowing two characters on the command line and then using dumpster to replace these with the 2-byte utf-8 sequence, i.e...
ß = C3 9F
ä = C3 A4
ö = C3 B6
ü = C3 BC
bond
14th October 2005, 22:44
submit your patch to gpac
tedgo
15th October 2005, 14:54
@defunkt
Thank you. I haven't known that dumpster works with special characters, i always used e.g. ae instead of ä.
I'll try it out, but this will not work for most of my mp4 files, because they are bigger than 2Gigs and dumpster does only open files smaller than 2Gigs :(
So i hope you or someone else will work on it one day to get support for special charsets in mp4box/mp4boxer. Not only for the stream handler text but also (and maybe more important) for the chapters.
defunkt
15th October 2005, 18:56
@bond: Someone should make a feature request but I doubt JLF would be interested in this 'patch' as it's ruthlessly minimal.
@tedgo: You don't actually have to use dumpster, any hex editor (like xvi32 (http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm#download)) can do the byte replacement and open any size file.
tedgo
15th October 2005, 19:21
XVI32 would be a good idea, but in according to its feature list it is also limited to files up to 2Gigs...
defunkt
16th October 2005, 10:25
Okay, new build. This one allows you to stuff byte codes in the -handler command line parameter. If a backslash is encountered then the following four characters are assumed to represent two bytes in hex. For example...
MP4Boxer -add "Track5.srt:lang=ger" -handler "Deutsch f\C3BCr H\C3B6rgesch\C3A4digte" "Film.mp4"...if you actually want to use a backslash then enter two backslashes "\\".
With a bit of luck this might also work for your chapter names though I have no way of testing this as I've never bothered with chapters myself. Let me know if it works or, if not, provide me with a chapter file.
Download HERE (http://www.mytempdir.com/250505).
Zero1
4th November 2005, 10:54
Hi defunkt, this patch seems ideal, just the type of thing I was looking for.
Is it possible for anyone to repost it? Seems the hosting period expired. If you like I could host it for you :)
Many thanks
*Edit*
After browsing some other mp4box related threads, specifically the Information and requests thread, I found that Kurtnoise13 has it hosted somewhere. The post is found here http://forum.doom9.org/showpost.php?p=728937&postcount=217
Again thanks to you guys, I'll go and mux some new stuff now :thanks:
Kurtnoise
5th November 2005, 01:04
Update (http://kurtnoise.free.fr/mp4tools/) your version...:) There were issues with avc contents.
JoeBG
8th November 2005, 06:45
Will this be improved in the future? Would be nice to be able to at the -handler functionality to all streams that are to get muxed. I mean multiple handler settings. In the moment only the last handlersetting is added to all streams in 1 commandline. This means, that all streams in my films have the name "German TTXT". :)
Elias
8th November 2005, 07:05
@ defunkt: this is great! I have to ask, do you know how many letters can be squeezed down into the hldr field? With dumpster, I can only add 23 letters, but I know that it can be more than that in an mp4 file, since I've seen mp4 files with more letters. Also, you should definitely send this code to the developer of MP4Box, because it needs to be there!
defunkt
8th November 2005, 10:19
New build - should allow multiple handler params for more then one track added on the same command line, i.e....
mp4boxer.exe -add "video.264" -handler "Video Stream" -add "audio.aac" -handler "Audio Stream" "out.mp4"
Link updated in first post.
@elias Never tried it but I assume the 23 character limit is simply down to the fact that you're just poking bytes in the existing string placed there by mp4box "GPAC ISO Video Handler" = 22 characters (+ NULL?) Only limit on the above method is 255 character buffer for combined handler text on the same command line. No idea if MPEG standard specifies a maximum.
Elias
8th November 2005, 10:54
@elias Never tried it but I assume the 23 character limit was simply down to the fact that you're just poking bytes in the existing string placed there by mp4box "GPAC ISO Video Handler" = 22 characters (+ NULL?) The above method should have no effective limit.That's a possibility, but shouldn't MP4Box be updated to be able to handle more than 22 characters + null?
bond
8th November 2005, 12:56
submit your patch to gpacany news? :(
Elias
8th November 2005, 13:12
I've done some more testing, and defunkt appears to be completely right! mp4 files done by QTPro can insert a maximum character set of 25, since Apple tags with 25 characters in the component hldr field. Still though, why does this field become limited with the amount of characters done by the original mp4 muxer? Shouldn't there be a maximum character input for this field (like 256 characters or something?), independent of any mp4 muxer?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.