View Full Version : Setting the language name in MP4 with mp4box
Kurtnoise
10th June 2005, 09:33
I submitted a new feature request (http://sourceforge.net/tracker/index.php?func=detail&aid=1213504&group_id=84101&atid=571741)....;)
More infos :
Submitted By: Kurtnoise (kurtnoise13)
Assigned to: Nobody/Anonymous (nobody)
Summary: Edit some mp4 atoms with mp4box
Initial Comment:
It could be great if we have the possibility to edit
the mdhd atom (for change/modify the language name) and
the hdlr atom where is stored the component name.
Thanks.
----------------------------------------------------------------------
>Comment By: Jean Le Feuvre (jeanlf)
Date: 2005-06-09 20:25
Message:
Logged In: YES
user_id=815447
I don't think the handler name will ever be editable through
MP4Box - this is purely informative data that should be
ignored by file readers. I'll add the track language support one
of these days, it is indeed badly missing.
;)
Kurtnoise
10th June 2005, 23:51
New mp4box compile please... :D I can't do it by myself... :o yes, I'm lazy.
10/06/05:
- added -lang option to MP4Box to change track language
- added -delay option to MP4Box to change initil media delay - ALTHOUGH 100% STANDARD, THIS MAY NOT BE SUPPORTED BY SOME PLAYERS
Elias
11th June 2005, 00:27
What's the command for the new language track option? I take it that it's the same language track as dumpster? If so, is it possible to add longer than 23 letters/numbers?
SeeMoreDigital
11th June 2005, 00:31
What's the command for the new language track option? I take it that it's the same language track as dumpster? If so, is it possible to add longer than 23 letters/numbers?I wonder what (country) language requires more than 23 digits?
Cheers
Elias
11th June 2005, 00:43
I wonder what (country) language requires more than 23 digits?
CheersGah! I was thinking about the Component Name field, in hdlr... never mind.
celtic_druid
11th June 2005, 04:25
http://mirror05.x264.nl/celtic_druid/mp4box.7z
SeeMoreDigital
11th June 2005, 09:49
Many thanks CD :cool:
Cheers
JoeBG
11th June 2005, 11:01
http://mirror05.x264.nl/celtic_druid/mp4box.7z
Many thanks cd :thanks:
@ all
What means ISO 631-2 language code? :confused:
Kurtnoise
11th June 2005, 11:02
Thanks...
Some examples for adding language tracks :
mp4box -lang 1=eng -add video.avi -lang 2=fre -add audio_1.aac -lang 3=ger -add audio_2.mp4 output.mp4
This adds English for trackID=1 in the video stream, French for trackID=2 in audio_1 file and German for trackID=3.
Another example with mp4 file (you need to know the trackID of your mp4 file to add the language track) :
mp4box -lang 201=eng -add input.mp4 output.mp4
I'll try to add this into Yamb asap...;)
bond
11th June 2005, 13:01
i splitted this to an own thread cause i think it doesnt deserve to get lost in a big "dont find anything anymore" thread
JoeBG
11th June 2005, 13:05
i splitted this to an own thread cause i think it doesnt deserve to get lost in a big "dont find anything anymore" thread
You donīt like this threat donīt you? :sly:
'll try to add this into Yamb asap...
:thanks:
bond
11th June 2005, 13:13
You donīt like this threat donīt you?
indeed, i cant imagine one single reason why it should be better to bunch multiple different issues in one big thread, when we can also discuss them in seperated threads
its not like setting the delay and the audio language is in any way related...
such big threads only lead to that people dont find any info anymore when using search
bond
11th June 2005, 14:00
What means ISO 631-2 language code? :confused:
hm where did you read about 631-2?
i think ISO 639-2 is the correct standard!? you can find it here (http://www.w3.org/WAI/ER/IG/ert/iso639.htm) for all languages
JoeBG
12th June 2005, 09:39
Thanks...
Some examples for adding language tracks :
mp4box -lang 1=eng -add video.avi -lang 2=fre -add audio_1.aac -lang 3=ger -add audio_2.mp4 output.mp4
This adds English for trackID=1 in the video stream, French for trackID=2 in audio_1 file and German for trackID=3.
Another example with mp4 file (you need to know the trackID of your mp4 file to add the language track) :
mp4box -lang 201=eng -add input.mp4 output.mp4
I'll try to add this into Yamb asap...;)
defenitly not works for me. Here is my commandline:
mp4box.exe -lang 1=ger -add Film.mp4 -lang 2=ger -add Deutsch.mp4 -sbr -lang 3=eng -add Englisch.mp4 -sbr NewMovie.mp4
And here is the muxing log:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
D:\Testvideo\Test2>"C:\cmd\mp4box.exe" -lang 1=ger -add Film.mp4 -lang 2=ger -ad
d Deutsch.mp4 -sbr -lang 3=eng -add Englisch.mp4 -sbr NewMovie.mp4
IsoMedia import - track ID 1 - Video (size 704 x 288)
IsoMedia import - track ID 1 - Audio (SR 44100 - 6 channels) - SBR AAC
IsoMedia import - track ID 2 - media type odsm sub-type MPEG
IsoMedia import - track ID 3 - media type sdsm sub-type MPEG
IsoMedia import - track ID 1 - Audio (SR 44100 - 6 channels) - SBR AAC
IsoMedia import - track ID 2 - media type odsm sub-type MPEG
IsoMedia import - track ID 3 - media type sdsm sub-type MPEG
Error: Bad Parameter
What is wrong with my commandline? I can mux all streams without the -lang commands.
SeeMoreDigital
12th June 2005, 11:45
i splitted this to an own thread cause i think it doesnt deserve to get lost in a big "dont find anything anymore" thread I totally agree with you guys.
I've placed "Please Note" notice over in my, GPAC's MP4Box Information and Discussions thread. I've also added a "Summary" box, which can be used to point to other MP4Box threads on this forum
Cheers
Kurtnoise
12th June 2005, 14:03
defenitly not works for me.
Works fine here...
Read once again what I wrote before...You need to know the right trackID from your mp4 files. So, first :
mp4box -info Film.mp4 and mp4box -info Deutsh.mp4 and mp4box -info English.mp4
You will have some infos concerning your files to find the right trackID, then use these ids to specify the language tracks.
bond
12th June 2005, 15:28
defenitly not works for me. Here is my commandline:
mp4box.exe -lang 1=ger -add Film.mp4 -lang 2=ger -add Deutsch.mp4 -sbr -lang 3=eng -add Englisch.mp4 -sbr NewMovie.mp4
What is wrong with my commandline? I can mux all streams without the -lang commands.
audio-only mp4 files have normally the aac stream with trackid 1
so your commandline should propably be
mp4box.exe -lang 1=ger -add Film.mp4 -lang 1=ger -add Deutsch.mp4 -sbr -lang 1=eng -add Englisch.mp4 -sbr NewMovie.mp4
btw using -sbr should only be necessary when your .mp4 files dont signal .mp4 already anyways (or if you use .aac)
i dont know an he-aac encoder that outputs .mp4 and doesnt signal he-aac
JoeBG
12th June 2005, 16:02
Works fine here...
Read once again what I wrote before...You need to know the right trackID from your mp4 files. So, first :
mp4box -info Film.mp4 and mp4box -info Deutsh.mp4 and mp4box -info English.mp4
You will have some infos concerning your files to find the right trackID, then use these ids to specify the language tracks.
Ok, every track ID is 1. But:
mp4box.exe -lang 1=ger -add Film.mp4 -lang 1=ger -add Deutsch.mp4 -sbr -lang 1=eng -add Englisch.mp4 -sbr NewMovie.mp4
does not work for me. This muxes all streams into NewMovie.mp4 but with language undetermined.
Doom9
12th June 2005, 16:39
just a guess but I think the position in the final MP4 matters.. so setting everything to one is obviously not going to work.
Now the example kurtnoise posted uses an avi (probably single stream) and AAC files (not MP4).. so my guess would be that if you used raw .264 input and raw .aac input and the same commandline kurtnoise posted, it would work. If you can confirm that, then you can proceed using different configurations. First try video-only.mp4 and raw AAC files (if the video-only mp4 has only one track I suppose the IDs would remain the same), then start using one audio mp4, two audio mp4s, etc.
Oh, and mark the video as having a language? Does video without audio have a language? Perhaps if you're a lipreader, but otherwise I tend to think it's kinda language less ;)
Kurtnoise
12th June 2005, 17:41
Indeed...Here are more details with mp4 files from my tests.
If the trackID equals to 3 digits then the language track is not recognize by mp4box (error message : bad format for track language...).
In the case we want to have/mux several streams, if the trackIDs specified for the language track are the same then mp4box will take the last id.
If first, we add the language track for only one stream then it works like a charm but if after this, we decide to mux/add these different streams into one mp4 file then the language for each tracks is not remain after the new process.
Maybe someone can confirm this ?
bond
12th June 2005, 18:43
my test with a single aac mp4 showed that the id set in the commandline refers to the one in the input mp4 and not to the one in the output one:
eg if you have an input mp4 with one aac stream with id=1 (which is always used by aac-only encoders) and you remux this by setting the language, the output mp4 will have the aac stream with id=101 (isma compliance) and the correct language signalled
Oh, and mark the video as having a language? Does video without audio have a language? Perhaps if you're a lipreader, but otherwise I tend to think it's kinda language less
i wouldnt say that video is languageless, eg think of the starwars movies where at the beginning you have the introduction displayed (in different languages in different countries of course), or think of video with hardburnt text (eg subs, or city names or whatever might be displayed)
Doom9
13th June 2005, 00:08
I think this feature still needs some work. Right now it best works if you first mux your mp4, then assign languages later on. But, that could easily be combined in one step. Rather than to have to specify language and ID, make the language tag an option for the add tag, so it would work like this:
mp4box -add -lang eng video.264 -add -lang eng audio.mp4 -add -lang ger audio2.mp4 -new output.mp4
bond
13th June 2005, 00:21
mp4box -add -lang eng video.264 -add -lang eng audio.mp4 -add -lang ger audio2.mp4 -new output.mp4
and what happens with input .mp4 files with multiple streams? i dont think you can avoid having to set the ids
Doom9
13th June 2005, 09:46
and what happens with input .mp4 files with multiple streams?I knew you'd say that. But, good design means you facilitate the usecase that happens the most. And when it comes to stream importing with mp4box, the stream given to -add is normally a single audio/video track stream. Sure, exceptions are possible, but show me one AAC encoder that writes multiple streams into an MP4 (now you'll say Nero which apparently can add a stream to an existing MP4.. but that's once again not the normal case.. standard is having an mp4 with a single aac track, a raw aac file or even an mp3 file as audio input).
Thus, if the input contains multiple tracks that can be labelled, label them all. Or, import track by track using -add input.mp4#trackno, or assign languages later.
bond
13th June 2005, 11:30
well there is another thing which is the case even with aac-only encoders: the mpeg-4 systems info, meaning the bifs and od tracks
mp4box doesnt ignore them and therefore "aac-only" files for mp4box have 3 tracks and not only 1
Doom9
13th June 2005, 11:38
mp4box have 3 tracks and not only 1But, setting the language for such a track makes no sense, does it? Basically you want to set the language for video, audio and subtitle tracks and that's it.
bond
13th June 2005, 11:51
still you never know for sure what id the audio stream in audio-only files has, you will have to implement some sort of check (which of course has to include mp1 - mp3 audio and all the other audio formats too, not to speak of non-standard streams). of course normally its trackid 1, but you simply cant be sure its always that way (eg isma compliance requiresthe audio stream to have trackid 101)
and than you still have the situation where you also have to support multiple a/v stream mp4 files
i dont say that there is no way to make it easier, but i think this could also get maybe more messy because of all the special cases which would start to exist
that said i trust in yamb to make it easy for the user to set the language for the track you want (a gui is a good solution to make this easier via "visualizing" the streams in a .mp4, so people dont really have to care about the ids)
edit: i dunno if its possible, but i can imagine that it makes sense setting the language for systems streams, as for example i showed that you can store subs via systems (in the bifs track)
Doom9
13th June 2005, 12:47
that said i trust in yamb to make it easy for the user to set the language for the track you want (a gui is a good solution to make this easier via "visualizing" the streams in a .mp4, so people dont really have to care about the ids)So muxing is
a) add your tracks and mux, then open the resulting file, visualize the streams and assign languages or
b) visualize each input file, write down IDs, mux with ID and language assignment
When you mux OGM or MKV you only have one step rather than two...
still you never know for sure what id the audio stream in audio-only files has, you will have to implement some sort of checkNot true. This is all already done. What do you think is going on when mp4box tells you "importing track X, type whatnot".. it knows exactly what it is importing).
Your argumentation strikes me as the typical linux lover argument towards anything that could make the process easier for the casual user: "our way is the proper way and we don't care if it's 10 times as complex". It doesn't matter if it's more "proper" to specify track IDs.. but if you make your joe average go through that second step and figuring out track IDs, you're going to lose a great many of them. Joe average will never care that there are additional tracks in the MP4 he gets from BeSweet.. for him it's a German or English AAC track and that's that.
bond
13th June 2005, 12:52
well make a feature request at sourceforge, i am sure jean will come up with something improved if possible :)
Doom9
18th June 2005, 13:55
I'm glad to see that it has been taken care of in the latest version.
Unfortunately, it seems only the 3 letter notation is supported, and while most programming environments seem to be able to list cultures, they usually return the two letter notation.
Also, it appears that the language assigned to the video input seems to be overruled by the audio language.
I tried this commandline:
mp4box -add video.264;lang=eng -add trailer-audio.mp4;lang=ger -add "Copy of english.srt";lang=eng -add french.srt;lang=fre -add spanish.srt;lang=spa -fps 25 -new languagetest.mp4
And ended up with both German video and audio. The subs however were correctly labelled.
Doom9
18th June 2005, 18:25
I've also found that far from all language codes are supported.. it would be great to have a list of supported tracks.
SeeMoreDigital
18th June 2005, 18:56
Here's the complete "Language/Country" list, as supplied with MuxMan: -
http://img271.echo.cx/img271/8499/countrylanguagecodes2lh.png
Cheers
bond
18th June 2005, 18:58
as doom9 wrote already: mp4box needs the three letters language indications, which i linked to already in a previous post
the issue doom9 reported must have been introduced in the latest mp4box version, cause with an older one it worked fine here with the most important languages i tested
Doom9
18th June 2005, 19:11
the issue doom9 reported must have been introduced in the latest mp4box version, cause with an older one it worked fine here with the most important languages i testedYou obviously didn't test anything exotic ;) I added a long list of languages that I think would be used to the latest MeGUI.. but some of them don't seem to have an effect. Plus, at leats in .NET, you can list all supported cultures and get the 2 letter code, plus a 2 digit subcode (like en-us, en-uk).. which would've been great for automatic listing. Now I had to hardcode everything.
SeeMoreDigital
18th June 2005, 19:27
Does anybody know why Jean Le Feuvre felt the need to change the previous two letter codes to three letter codes?
Cheers
bond
18th June 2005, 20:23
there never has been support for two letter language codes
SeeMoreDigital
18th June 2005, 21:09
I see... In that case I wonder why he decided to use three letter notification instead of two...
...and whether he would be inclined to change?
celtic_druid
19th June 2005, 05:06
http://cvs.sourceforge.net/viewcvs.py/gpac/gpac/doc/ISO%20639-2%20codes.txt?rev=1.1&view=markup
DeeGee
20th June 2005, 12:07
I find it easier to use this:
D:\DVD>mp4box -add "video_input.mp4"#video;lang=eng -add "audio_input.mp4"#trackID=1;lang=eng "combined_output.mp4"
As told in import help:
Importing Options
File importing syntax:
"#video" "#audio": base import for most AV files
"#trackID=ID": track import for IsoMedia and other files
"%X": imports only the first X seconds
";lang=LAN": sets imported media language code
";delay=delay_ms": sets imported media initial delay in ms
-add file: add file tracks to (new) output file
-cat file: concatenates file samples to (new) output file
* Note: creates tracks if needed
-dref: keeps media data in original file
-nodrop: forces constant FPS when importing AVI video
-packed: forces packed bitstream when importing raw ASP
-sbr: backward compatible signaling of AAC-SBR
-sbrx: non-backward compatible signaling of AAC-SBR
* Note: SBR AAC cannot be detected at import time
-fps FPS: forces frame rate for video and SUB subtitles import
* For raw H263 import, default FPS is 15
* For all other imports, default FPS is 25
-mpeg4: forces MPEG-4 sample descriptions when possible (3GPP2)
-agg N: aggregates N audio frames in 1 sample (3GP media only)
* Note: Maximum value is 15 - Disabled by default
-keepsys: keeps all MPEG-4 Systems info when using '-add' / 'cat'
bond
20th June 2005, 12:22
you cant use #video on .mp4 files
DeeGee
20th June 2005, 12:38
Huh? I have used it to import nero .mp4's that have all those extra info tracks and only the video track has been imported. Or then only dumb luck on my part. Well, I guess it's not hard to use the #trackID=ID way.
Edit. I did a fast test on my audio file and this is the result:
D:\DVD\Freddy_vs_Jason_D2\VIDEO_TS>mp4box -add "Ill Nino - How Can I Live AC3 T0
1 2_0ch 224Kbps DELAY 0ms.mp4" test.mp4
IsoMedia import - track ID 1 - Audio (SR 44100 - 2 channels) - SBR AAC
IsoMedia import - track ID 2 - media type odsm sub-type MPEG
IsoMedia import - track ID 3 - media type sdsm sub-type MPEG
Converting to ISMA Audio-Video MP4 file...
Saving to test.mp4: 0.500 secs Interleaving
D:\DVD\Freddy_vs_Jason_D2\VIDEO_TS>mp4box -add "Ill Nino - How Can I Live AC3 T0
1 2_0ch 224Kbps DELAY 0ms.mp4"#audio test2.mp4
IsoMedia import - track ID 1 - Audio (SR 44100 - 2 channels) - SBR AAC
Converting to ISMA Audio-Video MP4 file...
Saving to test2.mp4: 0.500 secs Interleaving
D:\DVD\Freddy_vs_Jason_D2\VIDEO_TS>
Doom9
20th June 2005, 12:39
http://cvs.sourceforge.net/viewcvs....1.1&view=markupNot all of those seem to work. I tried bantu (bnt) and it came up as unspecified in the end.
mezzanine
6th August 2005, 14:49
Anyone found a way to set the subtitles language-ids ?
Drachir
6th August 2005, 15:24
It work the the same way with every track "-add english.ttxt:lang=eng" ( not sure if it is an ; instead of : at Windows)
And in BIFS text this way:
ObjectDescriptor {
objectDescriptorID 30
esDescr [
ES_Descriptor {
ES_ID 5
OCR_ES_ID 1
muxInfo MuxInfo {
fileName "english.ttxt"
}
langDescr LanguageDescriptor {
languageCode "eng"
}
}
]
}
With an existent mp4 File:
>MP4Box -info yourFile.mp4 ( look for the TrackID of your SUB Track)
>MP4Box -lang TrackID=eng yourFile.mp4
SeeMoreDigital
6th August 2005, 17:24
>MP4Box -info yourFile.mp4 ( look for the TrackID of your SUB Track)
>MP4Box -lang TrackID=eng yourFile.mp4 Seems to work okay....
Just tried muxing a RAW 6Ch AAC file. And after adding the following text to YAMB's command line: -
http://img90.imageshack.us/img90/4844/languagesetting4jz.png
I got this: -
http://img68.imageshack.us/img68/1936/langident2lw.png
Cheers
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.