Please Help!

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Please Help!

Post by FaiT »

I have spent days attempting this and I am fed up enough to simply beg the help of the community. I use handbrake to encode my videos but the audio encoder present (faac) is sub par to nero. So I encode the video, Closed Captions, and Chapters with Handbrake and the audio with nero through megui.

My Problem is thus: I Need to mux the video file with multiple audio files such that it is itunes compatible.

I have tried Many gui's over the past couple of days and experimented with the MP4box CLI to no avail. Quicktime will do what I want in an .mov file but I need an .mp4 or .m4v. Both quicktime and MP4Box will only give me a single audio track as output. MP4Muxer gives me both tracks (audio and commentary) but they play simultaneously in Itunes.

I've read that MP4Box is capable of this but I haven't been able to acomplish it. A simple guide (or extensive if you're feeling generous) would set my world right, however any help, tips, advice, or links would be appreciated.
match
Enlightened
Posts: 111
Joined: Sun Mar 14, 2010 5:08 pm

Re: Please Help!

Post by match »

phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

If you wanted to know the content type and track layout
of an existing mp4

mp4box.exe -info "test.mp4"

The following would extract track 1: <filname>_track<#>.<tracktype>

mp4box.exe -raw 1

would create

test_track1.h264

mp4box.exe -raw 2

test_track2.aac


But you want to do the opposite, and add files to an mp4

mp4box.exe -add "test_track1.h264":lang=en:fps=23.976 -add "test_track2.aac":lang=en -add "test_track3.aac":lang=fr:disable "new.mp4"

:lang=en is added to denote the default language of the track
:fps=23.976 is added, otherwise it defaults to 25.000 fps
:disable is added to disable the track, so you dont hear both being played

This should do what you want/need
The second audio track is selectable as an audio source, depending upon the player of course
Its just not the default, nor automatic per say
Deleted User 13735

Re: Please Help!

Post by Deleted User 13735 »

Since you're already using MeGUI, why not just do everything there?
http://www.bubblevision.com/underwater- ... -Vimeo.htm
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

You are all absolutely amazing! Due to the delay between posting a thread and having a mod approve it I had already learned much of this from another forum but thank you. I was just looking up how to set the language and you just showed me how. Query: what effect does -fps have on the video if it set wrong? Or, for example, what if it is a variable fps video?
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

@phibertron you are a credit to the community thank you for having the perfect answer to my question.
@match I did try it although it makes itunes compatible chapters, multiple audio streams play simultaneously. Thanks for the suggestion though.
@musicvid I read that whole guide thanks for linking it. As far as I can tell, although I have access to it, I don't need vegas cause thats for content I generate - Im doing DVD backups. AVISynth + megui does exactly the same thing as handbrake with a slight advantage for interlaced content - I am doing DVD movie backups which are rarely interlaced but handbrake adds chapters and closed captions which I can do with megui but it takes longer. Finally muxing with megui rendered a file with multiple audio tracks that was playable in vlc and media player classic but in Itunes it played both tracks simultaneously, hence my question.

All in all handbrake provides similar quality to megui in every way but audio (audio as well on a mac) but simplifies the process significantly. Thanks for the link though, it was a good read and I learned a couple things :) .
Deleted User 13735

Re: Please Help!

Post by Deleted User 13735 »

I knew you probably wouldn't have a frameserving route into Avisynth/MeGui, but I thought the rest of Nick's research might be of use, and I'm glad it was.
Since we are friends we have spent months rendering the same projects in Handbrake and MeGui w/ QTGMC, and the latter does have a slight edge right now.

If you're interested in our research, my Handbrake thread is here:
http://www.sonycreativesoftware.com/for ... eID=745821
Nick's parallel MeGui thread is here:
http://www.sonycreativesoftware.com/for ... eID=755224
And Jerry's draft page with links to all articles and tests, including my Handbrake settings is here:
http://www.jazzythedog.com/testing/dnxhd/HD-Guide.aspx
(My Handbrake to the Web tutorial will be on Youtube within a week).


I agree it would be nice to have Nero AAC in Handbrake eventually, as would QTGMC (although it's slow as h-e-l-l).
Nick did some renders in MeGUI with x264 + Nero AAC, but they broke Youtube.

Feel free to email my username at gmail if you have more questions.
Last edited by Deleted User 13735 on Sun Mar 27, 2011 5:28 pm, edited 3 times in total.
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

Thank You very much. It's really nice of you to offer all your info and I'm very grateful :) I'll look into that workflow after I nail down the one I'm trying right now. All I've got left is how to specify track name in mp4box such that it is readable by Itunes. I don't know if mp4box can do it but I know handbrake can. By default an itunes audio track should read "Audio Track X" but If done in handbrake it reads "Stereo" or I assume "5.1" but I haven't tried the latter.
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

musicvid wrote:I knew you probably wouldn't have a frameserving route into Avisynth/MeGui, but I thought the rest of Nick's research might be of use, and I'm glad it was.
Since we are friends we have spent months rendering the same projects in Handbrake and MeGui w/ QTGMC, and the latter does have a slight edge right now.

If you're interested in our research, my Handbrake thread is here:
http://www.sonycreativesoftware.com/for ... eID=755224
Nick's parallel MeGui thread is here:
http://www.sonycreativesoftware.com/for ... eID=755224
And Jerry's page with my Handbrake settings is here:
http://www.sonycreativesoftware.com/for ... eID=755224

I agree it would be nice to have Nero AAC in Handbrake eventually, as would QTGMC (although it's slow as h-e-l-l).
Nick did some renders in MeGUI with x264 + Nero AAC, but they broke Youtube.

Feel free to email my username at gmail if you have more questions.
Those links are identical, I would be interested in the 1st and 3rd topics if you would be willing to repost the links :D Thanks!
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

FaiT wrote:@phibertron you are a credit to the community thank you for having the perfect answer to my question.
There is no perfect way, there are only better ways LOL!
FaiT wrote:You are all absolutely amazing! Due to the delay between posting a thread and having a mod approve it I had already learned much of this from another forum but thank you. I was just looking up how to set the language and you just showed me how. Query: what effect does -fps have on the video if it set wrong? Or, for example, what if it is a variable fps video?
If the fps you set in mp4box is not the fps of the video
then the video/audio will not sync right

If the source video is vfr, mp4box has no way to deal with vfr that I know of
But if you use the framerate of the source, not the maximum or minimum, it is sometimes ok
(unless someone else has input to add or a know how to deal with it)
I have a possible solution, that I am working on, just havent worked out the kinks yet
FaiT wrote:Thank You very much. It's really nice of you to offer all your info and I'm very grateful :) I'll look into that workflow after I nail down the one I'm trying right now. All I've got left is how to specify track name in mp4box such that it is readable by Itunes. I don't know if mp4box can do it but I know handbrake can. By default an itunes audio track should read "Audio Track X" but If done in handbrake it reads "Stereo" or I assume "5.1" but I haven't tried the latter.
If you wanted to add descriptive names to tracks
Then add the name=<title> attribute like below

mp4box.exe
-add "test_track1.h264:fps=23.976:lang=en:name=Test Video"
-add "test_track2.aac:lang=en:name=English Audio"
-add "test_track3.aac:lang=fr:name=French Audio:disable" "new.mp4"

Note:
If you run mp4box -info on the resultant mp4
It will now show the track name's you have used
Why I dont know...
But you can see that it does work if you used mediainfo
mediainfo will show the inforamtion as title:<title>
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

Thanks again Phibertron, I tried that as well as -name trackID=NAME and both named my audio tracks but Itunes wouldn't read the name, media player classic and mediainfo would. Like I said I know that this is possible 'cause handbrake does it, I just don't know if mp4box can. To be clear, this is of low importance, my real problem (switching audio tracks) is fixed and I am so very grateful for that. If I can't figure this out I will just make the files and remux down the line when I learn how to do it. The language tags work just not the track names I eventually want them to say "Dolby Surround" and "Audio Commentary" "Director's Commentary" "Cast Commentary" etc...
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

FaiT wrote:Like I said I know that this is possible 'cause handbrake does it, I just don't know if mp4box can.
Yeah that is a bummer, I'll keep digging around also, as I too am curious is to how to do it

On a side note :D

This is how I deal with VFR and MP4BOX
This also works for CFR

In either case you dont need to know what the fps= anymore
It works 100% of the time for me
There are other ways I have been working on
But they are way more involved, this is the simplest at the moment
But you need the originall file created by handbrake to do it

Using the original file that handbrake created
We are going to copy the video track only
Doing it this way keeps the VFR settings
Note: the #1 is for track 1, which should be the video track

-add "Handbrake Encoded VFR.mp4"#1:lang=en:name="VFR Video"

We then add the other audio file that you created

-add "Nero Encoded.aac":lang=en:name="AAC Audio"

We then add the another audio file that you created

-add "Nero Encoded.ac3":lang=en:name="AC3 Audio":disable

Code: Select all

mp4box.exe -add "Handbrake Encoded VFR.mp4"#1:lang=en:name="VFR Video" -add "Nero Encoded.aac":lang=en:name="AAC Audio" -add "Nero Encoded.ac3":lang=en:name="AC3 Audio":disable "output.mp4"
If you examine the Handbrake Encoded VFR.mp4 and the output.mp4
The frame rate mode and settings will be the same

Code: Select all

Frame rate mode                  : Variable
Frame rate                       : 23.976 fps
Minimum frame rate               : 12.288 fps
Maximum frame rate               : 29.970 fps
as opposed to the following if we had used something like this
mp4box.exe -add "vfr_track1.h264":lang=en:fps=23.976:name="VFR Video"

Code: Select all

Frame rate mode                  : Constant
Frame rate                       : 23.976 fps
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

OMG Thanks! My next vfr video is still a couple hours from being done but I'll definitely be trying this. I was just contemplating changing my framerate settings to constant when I saw this. Thanks Again! And yeah, if you happen to stumble upon track names that play in itunes I'd be interested, the problem for me is that Itunes is a music player/ripper app so my google searches like "mp4box audio track names itunes" usually pop up with posts on ripping cd's.
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

FWIW, you can also add itunes tagging with mp4box

For EX:
mp4box.exe -itags cover="cover.jpg":name="Movie Name" "Movie Name.mp4"

Code: Select all

mp4box.exe -tag-list

Supported iTunes tag modifiers:
        album_artist    usage: album_artist=album artist
        album   usage: album=name
        tracknum        usage: track=x/N
        track   usage: track=name
        artist  usage: artist=name
        comment usage: comment=any comment
        compilation     usage: compilation=yes,no
        composer        usage: composer=name
        created usage: created=year
        disk    usage: disk=x/N
        tool    usage: tool=name
        genre   usage: genre=name
        name    usage: name=name
        tempo   usage: tempo=integer
        writer  usage: writer=name
        group   usage: group=name
        cover   usage: cover=file.jpg,file.png
        encoder usage: encoder=name
        gapless usage: gapless=yes,no
Quick question for you
FaiT wrote: By default an itunes audio track should read "Audio Track X" but If done in handbrake it reads "Stereo" or I assume "5.1" but I haven't tried the latter.
Out of curiosity, Where is it that you seeing the audio name from within itunes on a video file?

Is it when you click on "Get Info"
and on the summary tab you see
Channels: Stereo, Dolby Digital 5.1
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

If you have at least two audio streams and you play a movie (in itunes or on an ipod touch) you can switch between them. If the audio is done in handbrake it will read "English: Stereo" when muxing with mp4box it detects the language tag hence it still says English but fails to read the track name so it says what I assume is the default "Audio Track X" where X is the audio track integer.
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

So this is what I've been using after all the advice I've been given:

mp4box -add video.m4v:lang=en -add audio1.m4a:group=1:lang=en:name="Dolby Surround" -add audio2.m4a:disable:group1:lang=en:name="Director's Commentary" output.m4v

Frame rate mode : Variable
Frame rate : 23.952 fps
Minimum frame rate : 3.112 fps
Maximum frame rate : 227.848 fps

Frame rate mode : Variable
Frame rate : 23.953 fps
Minimum frame rate : 3.112 fps
Maximum frame rate : 227.848 fps

As far as variable framerate it seems to work with just the -add operation. The "lang=X" works just fine in Itunes. "group=1" for every audio track and "disable" on every audio track except the default one is what's necesary for audio track switching in iTunes. Like I said "name=X" doesn't seem to work in Itunes but I thought I'd leave it in anyway since some players do read it (just not my ipod :( ).

I'm hesitant to believe the media info information posted above since it sounds crazy but I think that them being nearly identical speaks to this functioning properly even if the min and max don't look right.
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

I did stumble across this, yeah i know its not for mp4box
But it might be a starting point to figure out how handbrake is doing it

https://trac.handbrake.fr/wiki/CLIGuide

-A or --aname: sets an audio track's name. Only available in .mp4 files. This is useful for the AppleTV, which otherwise gets confused when more than one track is in the same language and codec.

Also found this interesting thread

http://forum.videolan.org/viewtopic.php?f=2&t=81265
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

@Phibertron Thanks for the info and all the help. I've decided that for me, its a cosmetic change and for now I'm just going to enjoy multiple audio tracks. I've read around and it seems as though there are two ways to add track names (I've tried both) in mp4box and neither one is recognized by itunes. Like i said though it's no big deal. The files I make need to be compatible with itunes (ipod touch 4g) and PS3 and to my surprise not only did this muxing technique work with itunes/ipod it also allows me to select audio tracks on PS3! So my plan is to backup my movies to files then burn them 4 at a time to DVD-5's for backup. So I can put them on my ipod and play them on my computer and if my computer crashes I have them on disk which I can also pop into my PS3 and it plays like the DVD only without the annoying ads and "Operation cannot be completed at this time" when you want to get to the DVD menu :D . All in all I'm very happy, and you don't need to trouble yourself on behalf to dig up more stuff, though I certainly appreciate it, in a couple more days I'll post a thread on doom9 and see if they know a way but either way I'm happy with what I've got.

Thanks phibertron and everyone else that contributed :) !
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

No Worries :D

But for sanity sake, use a plan for track assingment

Audio Track 1 AAC
Audio Track 2 AC3
Audio Track 3 ?
Audio Track 4 ?

I mess around and made one with 6 tracks, to see how bad it could get
You could also leverage the lang= to your advatange
You could choose to know that the dutch is for directors comments or something
or some other language for something else
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

So I was just testing some footage (X-Men the first of the trilogy) and I noticed that the audio was out of sync like how you described it would be if the fps wasn't correctly set. mediainfo says its variable but the synching issue is on the PS3, vlc, and itunes so I don't think its the player. I'm just gonna encode with constant frame rate for now but you said you knew a couple of things about variable so I was just curious if you had a suggestion (I already tried your earlier suggestion which appeared to me to just ad #1 after -add video.mp4 such that -add video.mp4#1 if there was more to it I missed it.
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

Due to VFR not always working for me on certain client devices
I usually use CFR encodes, it all possible

Either of the two below would copy the video track to the new mp4
without having to know the fps, or whether it was vfr or cfr
as it would be taking it from the source mp4

This would choose track 1 (usually video)

-add "Handbrake Encoded.mp4"#1

This would choose the video track
(yes its literally #video)

-add "Handbrake Encoded.mp4"#video

But if you extracted the .h264 like this

mp4box -raw 1 "Handbrake Encoded.mp4"

it would create the .h264 file
and you would then do the following
but you would have to know the fps to do it correctly
and it would not work for vfr correctly

-add "Handbrake Encoded_track1.h264":lang=en:fps=23.976

using the -add "Handbrake Encoded.mp4"#1 or -add "Handbrake Encoded.mp4"#video
is probably the safest route to go with respect to fps
and to use cfr encodes gives you more device compatability
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

I'll probably just use CFR then for compatibility, thanks for the tips - I'll try them out :) . Once again thank you for your time.
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

You know, I am now obssesed into finding out how to add that atom with mp4box :twisted:

FWIW
I found something that really gets the heart of the matter

http://code.google.com/p/mp4v2/issues/detail?id=9
phibertron
Bright Spark User
Posts: 211
Joined: Thu Oct 22, 2009 2:37 am

Re: Please Help!

Post by phibertron »

DUDE! I have a solution for you

While I haven't figured out yet how to edit the trak.udta.name / userDataName with mp4box
I went through some tools I used to use, one of them is mp4track.exe

You can download it from here

http://kurtnoise.free.fr/mp4tools/mp4v2 ... k-r355.zip

Note:
kurtnoise does some dev/packing work on mp4box
So we might be able to get him to add the ability to mp4box
since he put these tools up also

If we look at an mp4 encoded with handbrake
We see that it uses the userDataName to hold the string

mp4track "handbrake encoded.mp4" --list

track[1] id=2
type = audio
enabled = true
inMovie = true
inPreview = false
layer = 0
alternateGroup = 1
volume = 1.0000
width = 0.00000000
height = 0.00000000
language = English
handlerName =
userDataName = Stereo

If we look at an mp4 mp4box creates
We see that it uses the handlerName to hold the string

mp4track "mp4box encoded.mp4" --list

track[1] id=2
type = audio
enabled = true
inMovie = false
inPreview = false
layer = 0
alternateGroup = 1
volume = 1.0000
width = 0.00000000
height = 0.00000000
language = English
handlerName = Stereo
userDataName = <absent>

So get that string into the userDataName
We do the following command with mp4track
Just change --track-id for each track with appropriate --udtaname

mp4track "mp4box encoded.mp4" --track-id 2 --udtaname "Stereo"

We can see that it does the trick we want
and itunes does read it correctly

mp4track "mp4box encoded.mp4" --list

track[1] id=2
type = audio
enabled = true
inMovie = false
inPreview = false
layer = 0
alternateGroup = 1
volume = 1.0000
width = 0.00000000
height = 0.00000000
language = English
handlerName = Stereo
userDataName = Stereo

Muhahahaha
Now my brain get some rest LOL!
FaiT
Posts: 47
Joined: Wed Mar 23, 2011 9:54 pm

Re: Please Help!

Post by FaiT »

phibertron you are simply the most amazing person (unless you are really an alien intelligence or religious Deity) ever, period. I haven't given this a try yet but I will as soon as i post this. The audio sync problem I had wasn't because of vfr - I tried every combination I could (constant - force 23.976 etc.) didn't work. So I encoded the handbrake video with an audio stream and voila when I added my nero stream it was synched. I will now try deleting the handbrake audio before and after adding the Nero audio to see if it stays in sync.
Post Reply