[In Progress] MP4/M4V Audio Track Title Tags

Archive of historical feature requests.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

[In Progress] MP4/M4V Audio Track Title Tags

Post by WARRZONE »

I would like whatever you type in as the audio track name to become the track title in the video file's tag data. Title is the tag that appears in MediaInfo. Handbrake does not currently write a title tag. Right now, the only way to do it that I know of is to remux the file with MP4Box or some front end of it like MkvToMp4. I have problems with this though. 1) It can change the tags already there, particularly the video fps and 2) it is a big hassle taking me anywhere between 7 min to 18 min per video depending on the hard drive speed and other factors. This feature would be really useful for commentary tracks. I know this won't be much use in iTunes because it goes by language instead of titles e.g. English, English, English (AC3). However, it would be nice with MPC-HC and VLC. Instead of seeing SoundHandler, SoundHandler, SoundHandler or Track 1, Track 2, Track 3, you would see English AAC Stereo, English AC3 5.1, Commentary by George Lucas or whatever you choose to type in.

I don't need this for MKV's, but I think it should be the same. However, it is not needed as urgently as it is for MP4/M4V's because it is not nearly as hard to edit MKV tags. You just go to mkvmerge Header Editor, edit, save, and done.
Last edited by WARRZONE on Thu Nov 06, 2014 3:11 am, edited 2 times in total.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

Thanks for pointing this out. I had not realized that avformat was not writing out udta atom for tracks. Should not be hard to correct this, but may take some time since this needs to be pushed upstream to libav.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

Could you post an example command line for MP4Box that you use to add the title? I want to check that you are modifying the same mp4 atom that I am setting.
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: MP4/M4V Audio Track Title Tags

Post by WARRZONE »

JohnAStebbins wrote:Could you post an example command line for MP4Box that you use to add the title? I want to check that you are modifying the same mp4 atom that I am setting.
I was using the MP4Box GUI, which I couldn't get to work right because it would not mux the chapter text file into M4Vs. With Mp4ToMkv, it names the track title, according to MediaInfo, whatever you type in the comment box. Only letters, numbers, underscores, spaces, and periods work properly for track names in MP4/M4Vs. MKVs can have almost anything. I think the old syntax was something like -name tkID=name. I'm not sure what the new one is. You could try this though:

Code: Select all

"c:\path to\mp4box.exe" -add input.mp4:lang=eng:name="English AAC Stereo" output.mp4
Anyway, I think it is "name" that you are getting after, even though MediaInfo calls it "Title".
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

Well, that's odd. -name changes the track handler description (hdlr atom). It does indeed change the "Title" that mediainfo shows. But once again, mediainfo is retarded IMO. Neither VLC or QuickTime or iTunes use this field for the audio title, but instead use metadata stored in a user data atom (udta).

The hdlr atom describes the "handler" for the track (i.e. video or audio handler) and the description field in this atom is meant to describe the handler of the track and not the track contents.

Have you tested VLC, etc after using "MP4Box -name"? In my test, VLC uses udta and not hdlr. I know from past experience that QuickTime also uses udta. If MPC is using hdlr, it is broken IMO.
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: MP4/M4V Audio Track Title Tags

Post by WARRZONE »

You found out that the MediaInfo Title tag is the trak.hdlr.name atom or handlerName, not the trak.udta.name atom or userDataName?

You're right that MP4Box only changes the handlername and leaves the UserDataName blank. I found the definition GPAC gives for handler name:
-name trackID=NAME : sets track handler name. Handler name is sometimes used to identify the track content (for example, audio language).

I found out that mp4track can edit the userDataName. I am assuming it can work with M4Vs and not just MP4s, otherwise it is useless with AC3. I can't figure out how to install it, but here is the command:
mp4track "output.m4v" --track-id 1 --udtaname "English AAC Stereo"
mp4track "output.m4v" --track-id 2 --udtaname "English AC3 5.1"

You can also use this to see the track data:
mp4track "output.m4v" --list

I read on libav.org that the handlerName atom is typically used for a track title. Because of that and GPAC's definition, I think we can set handlerName to whatever we want. It is not invalid behavior. I'm not sure why GPAC used audio language as an example because that's what lang is for.

To be safe, I would copy whatever the handlerName string is to also be the userDataName string so that they are identical. iTunes used to say lang (userDataName). Now it just says lang, but Apple could always update it so it goes back the way it was. I'm not sure how reliable iTunes or QuickTime is for testing, or maybe I should say useful instead of reliable. I don't like how iTunes arranges tracks alphabetically by languages and codecs instead of going by track ID numbers. QuickTime seems to be the same, but it says English (United States) for each track.

I'll be glad when this gets implemented in HandBrake. Right now, there is almost no reason to take the time to type in track names other than to differentiate them in the queue. If multiple subtitle tracks are in the works, this would be useful for them too.
Last edited by WARRZONE on Sat Aug 02, 2014 4:12 am, edited 1 time in total.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

Did you verify which field MPC uses? I would rather not waste time on hdlr if we don't have a verifiable case of a player that uses that field.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

I got tired of waiting, so I fired up my windows7 vm, installed MPC and ran a test. It does indeed use hdlr.name for the audio track name. Stupid, but meh :roll:

So I have a patch I just submitted to libav that writes the track name in both places. After that patch has been reviewed by the libav developers, I'll add a patch to HandBrake's patch set to solve the problem.
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: MP4/M4V Audio Track Title Tags

Post by WARRZONE »

Awesome, I'm looking forward to it. Some re-encoding may soon be in order. I wish HandBrake did video passthrough so that I could remux the videos I have already encoded, but apparently from reading other feature requests, that is too complicated to implement.

I will try to hold off on encoding M4V's for my Apple devices for now. What do you think is usually the time frame for these sort of things to show up in the nightly builds? I am clueless as to an estimate.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

WARRZONE wrote:Awesome, I'm looking forward to it. Some re-encoding may soon be in order. I wish HandBrake did video passthrough so that I could remux the videos I have already encoded, but apparently from reading other feature requests, that is too complicated to implement.

I will try to hold off on encoding M4V's for my Apple devices for now. What do you think is usually the time frame for these sort of things to show up in the nightly builds? I am clueless as to an estimate.
Depends on how many revisions I have to go through during the patch review. Could be tomorrow, could be next week.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

This should be fixed in the next nightly build
https://trac.handbrake.fr/changeset/6270
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: MP4/M4V Audio Track Title Tags

Post by WARRZONE »

It is working (using svn6306). Thank you very much!
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by WARRZONE »

Okay, I have run into a problem. I think I know what the problem is, but I think HandBrake should account for it, or give you a tool tip of invalid characters and max character length.

I was converting Star Wars: Episode VI to M4V so that it has 4 audio tracks (the two main ones and two commentaries). Here are the audio settings I used (using HandBrake-svn6306_x86_64-Win_GUI.exe):

Source: 1 English (DTS-HD MA) (6.1 ch) Codec: ACC (FDK) Mixdown: Dolby Pro Logic II Track Name: AAC Stereo
Source: 1 English (DTA-HD MA) (6.1 ch) Codec: AC3 Passthru Track Name: AC3 5.1
Source: 2 English (AC3) (2.0 ch) Codec: AAC (FDK) Mixdown: Stereo Track Name: Commentary with George Lucas, Carrie Fisher, Ben Burtt and Dennis Muren
Source: 3 English (AC3) (2.0 ch) Codec: AAC (FDK) Mixdown: Stereo Track Name: Commentary from Archival Interviews with Cast and Crew

The problem is that the track names of the last two audio tracks are messed up in the converted video.
Track 3: Commentary with George Lucas
Track 4: Carrie Fisher

I think the problem is that commas do not work, but Handbrake did not warn me of that. I checked other videos and HandBrake cuts off the track name at the comma in those videos as well. Still, I do not know why it takes the part after the comma of the track's name and replaces the next track's name with it. Also, do you know if there is a certain length limitation for track names? Would HandBrake stop my typing or warn me if it got too long?
Last edited by WARRZONE on Thu Aug 21, 2014 12:45 am, edited 1 time in total.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

Yup, sounds like a buglet in the generation of the command line. I'm assuming you are using the windows gui. You might want to try the preference option which makes the gui work direct with libhb instead of going through the cli. This is an experimental option and may misbehave under some circumstances, but it should solve *this* problem. In the future the windows gui will work exclusively through libhb and we will drop the cli option, so this will be the long term solution to this when it is ready.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by s55 »

Probably not escaping the ,
Will look into it
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by WARRZONE »

Okay, so commas are valid then. I thought it was weird that a backslash would be allowed, but not a comma.
JohnAStebbins wrote:You might want to try the preference option which makes the gui work direct with libhb instead of going through the cli.
I looked all through Options > Preferences, and did not see anything like that to select. Like mentioned above, I'm using HandBrake-svn6306_x86_64-Win_GUI.exe.

I found this from searching HandBrake-0.9.9/win/CS/HandBrakeWPF/UserSettingConstants.cs -- public const string EnableLibHb = "EnableLibHb";
In the notes for 0.10 changes it says, "LibHB is now used for scanning instead of the CLI." So was the option already removed and is libhb already the default?
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by s55 »

The option was disabled as I'm no longer working on it. We are going to be replacing it with a new JSON API.

So, while scan does libhb, encode does not.
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by WARRZONE »

Alright, it sounds like there is nothing I can do. Once the comma bug is squashed, if you could give an update here, that would be great.

In the meantime, I will truncate the track names, e.g. Commentary with George Lucas... I'll keep a list of those videos so I can re-encode them later.
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by s55 »

hopefully fixed in tomorrows nightly.
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by WARRZONE »

Using svn6362 64-bit Win GUI, this update has made it worse. Using the Star Wars example video above, now all the audio tracks are named "ACC".
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by JohnAStebbins »

Most likely an issue with how the option is quoted and escaped. In a bash shell, the proper syntax would be:

Code: Select all

HandBrakeCLI -i ~/Videos/Samples/DVD/Alien.iso -t 1 -c 5 -E aac -a 1,1,1 -A "\"A, A\",\"B, B\",\"C, C\"" -o ttt.mp4
So, there is an initial " to encapsulate the entire string as a single option. Then an escaped quote surrounding each item in the comma separated list of names, so that the parser in HandBrakeCLI can skip over the commas embeded in the track name.

In my earlier testing and communication with s55, I tested only strings that had no spaces. In such a test case, example below (without initial quotes) would have worked which is probably how it ended up getting coded in the win gui

Code: Select all

HandBrakeCLI -i ~/Videos/Samples/DVD/Alien.iso -t 1 -c 5 -E aac -a 1,1,1 -A \"A,A\",\"B,B\",\"C,C\" -o ttt.mp4
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by WARRZONE »

Just letting you know that the problem still hasn't been fixed. In Win GUI 6422, all the audio track names still show up as "ACC".
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by mduell »

WARRZONE wrote:In Win GUI 6422, all the audio track names still show up as "ACC".
I bet they don't.
WARRZONE
Posts: 21
Joined: Wed Jul 23, 2014 1:54 am

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by WARRZONE »

mduell wrote:
WARRZONE wrote:In Win GUI 6422, all the audio track names still show up as "ACC".
I bet they don't.
I hope you don't gamble often then. The picture below clearly shows AAC for all track names. It does this in MPC-HC as well. The screenshot is actually of Episode I, since that is all I tested. It is almost identical to the Episode VI example in my post above. Only a couple names in the third track are different.

Image
Deleted User 11865

Re: [Implemented] MP4/M4V Audio Track Title Tags

Post by Deleted User 11865 »

Can you post a MediaInfo report for this file?
Post Reply