View Full Version : Help with AAC encoding and HINTING
TheAgustin
18th September 2007, 18:17
I’m looking for some help on audio encoding a mov file.
From a .mov file (Animation codec) I’m making a .mp4 movie by using x264.exe
With mencoder I’m encoding the audio track of the original .mov file, obtaining an AAC audio file.
Then I use MP4Box to mux the encoded streams (the .mp4 and the .aac files) to an .mp4 container.
Using ffmpeg I’m remuxing the .mp4 file to a .mov container.
And the final touches are adding tags by using mp4tags.exe
(All the above in the listed order).
I would like to have more control when it comes to audio encoding.
It seems mencoder.exe doesn’t have all the options of faac.exe
Mencoder.exe “SourceFile.mov” -ovc copy -oac faac -faacopts br=128 -of rawaudio –o “output.aac”
What I actually would like to do is something similar to the commandline generated by MEGUI:
Faac.exe -q 100 -o "output.aac" -P -X -R 44100 -B 16 -C 2 --mpeg-vers 4 -Freeware Advanced Audio Coder
My problem is I’m unable to quickly dump the audio track from the original file to a location I can define myself. I tried dumping the audio track to a pcm-wav file using MPLAYER, but it dumps the audio to the same location of the mplayer.exe, and I need to be able to control this…
Any suggestion?
An finally, about hinting:
When should I hint the movie using mp4box.exe? after muxing video and audio using mp4box and prior to remuxing to mov with ffmpeg? After remuxing to mov and prior to adding metatags?
Thanks ya all for your help! :D
Have a great day.
Ranguvar
18th September 2007, 19:59
Couldn't you just remux the MOV into an MP4?
http://forum.doom9.org/archive/index.php/t-102064.html
MP4Box seems to do the remux directly :)
MP3 streams work in MP4 ;-)
TheAgustin
19th September 2007, 10:38
The original mov file has a video track encoded with Animation codec. I don't think I can do that remux directly.
So I have to h264 encode the video track and aac encode the audio.
It would be good I could dump the audio from the source .mov to a pcm wav. Mplayer is excellent for dumping audio, but it doesn't give me the chance to specify the output folder, and this is a problem :(
Thanks a lot for your time.
Still open to hear suggestions! :)
nm
19th September 2007, 13:06
It would be good I could dump the audio from the source .mov to a pcm wav. Mplayer is excellent for dumping audio, but it doesn't give me the chance to specify the output folder, and this is a problem :(
-dumpaudio -dumpfile PATH-TO-FILE
Works perfectly on Linux.
TheAgustin
19th September 2007, 13:23
It doesn't work for me (windows user).
With mplayerI can dump audio indeed:
mplayer -vo null -vc null -ao pcm:fast "sourcevideo"
But it's being dumped in the same location of the mplayer file.
Can I do a fast pcm dump with other tool, such as faac or ffmpeg?
I could use mencoder for extracting and aac encoding the audio track, but it doesn't give me as much settings as the faac tool, or does it and I'm missing something?
Thanks man! ;)
nm
19th September 2007, 13:40
Forgot that you wanted a PCM dump. You may need to do some string escaping to specify the drive letter on Windows:
-ao pcm:fast:file=%10%C:\out.wav
Where the %length% part specifies the length of the file name string.
Alternatively you could write a script that changes the current directory to whereever you want the files to go:
cd PATH-TO-DIR
c:\mplayer\mplayer -ao pcm:fast:file=out.wav ...
TheAgustin
19th September 2007, 13:56
I appreciate your help.
I've already been there, and escaping the strings is troublesome.
I recall having seen a third method for escaping too.
But given this situation, mplayer is not the way I want to go.
Isn't there any other tool to do the same? mencoder perhaps? ffmpeg?
It seems I'll have to go the mencoder way and just aac encode and extract at once, but it isn't really what I expected. I would have preferred using faac for audio encoding.
Thanks nm :D
Look forward to hearing any other suggestion.
TheAgustin
20th September 2007, 05:01
I'm feeling a little frustrated :(
I discovered that using mencoder for aac audio encoding and track extraction is making the audio sound horrible. It plays like jerky, with lots of clicks.
mencoder.exe "sourcefile.mov" -ovc copy -oac faac -faacopts br=128 -of rawaudio -o "target.aac"
It can't be compared to the excellent audio quality obtained in the MEGUI's aac output.
Isn't there any alternative I can try reaching my goal, besides mencoder?
Thanks ya folks!
Yours, Agustin Garzon
nm
20th September 2007, 11:27
I discovered that using mencoder for aac audio encoding and track extraction is making the audio sound horrible. It plays like jerky, with lots of clicks.
MEncoder is not designed to only output the audio track without video, so I'm not surprised it doesn't work the way you intended.
Isn't there any alternative I can try reaching my goal, besides mencoder?
First of all, get a decent shell (bash, available in cygwin) and whip up some simple scripts to glue things together. Or write a small program for some other easy language, like Python. That's the way to use complex command line tools like these for repeated tasks.
MPlayer's PCM output file escaping is not a problem when you call it through a script, but if you still don't like it for some reason, I think ffmpeg can also output a raw PCM or WAV file that can be encoded with faac separately.
TheAgustin
20th September 2007, 15:27
I've a pipeline of automated processes that goes from the rendering a movie to its final serving.
Somewhere in between the encoding takes place.
I wasn't able to get ffmpeg dumping the audio track out of the mov container. It seems I'll have to comply with the way mplayer asks for the target pcm to dump. It's not such a big deal, I wanted to consider all my options.
Is there any chance you can help me evaluate if I'm making the right things so my movie becomes streamable?
I'm simply using mp4box.exe -hint "file.mp4" command.
Is it enough? Movie will be http streamable after that?
Thanks for your patience and help :)
Cordially, Agustin
Drachir
23rd September 2007, 10:55
I'm simply using mp4box.exe -hint "file.mp4" command.
Is it enough? Movie will be http streamable after that?
Hinting isn't needed for progressive download over http. The file will only getting bigger -> more to download.
For progressive download the moov box needs to be at the beginning after the ftyp box. By default MP4Box places the moov box at the beginning.
Your player/environment need support to start playback before the file is completely downloaded. On client side you also need enough cache space for the progressive download.
TheAgustin
24th September 2007, 19:45
Dear Drachir, thanks for your response.
I was looking for your reply :p
I know you always try to make us understand the difference between streaming and progressive download.
In my case, a progressive download was fine.
By muxing audio and video into an .mp4 stream (using MP4box) is not enough to achieve progressive download. I have to wait for the file to fully download, I guess it's because the moov box remains at the end.
After using the -hint parameter in the MP4Box.exe the progressive download starts working. I also guess it's because that command moves the moov box to the beginning, just as required.
Thanks for your help :)
By the way, do you know if it makes any difference if I try hinting after using mp4tags? I'm scared that mp4tags may remove hinting information from mp4box, or mp4box may remove meta tag information from mp4tag.
Thanks! Cordially, Agustin
Drachir
25th September 2007, 08:47
...
By muxing audio and video into an .mp4 stream (using MP4box) is not enough to achieve progressive download. I have to wait for the file to fully download, I guess it's because the moov box remains at the end.
MP4Box should create the moov box at the beginning. You can dump the box structure with "MP4Box -diso yourFile.mp4", or open the file in a hex-editor to see where the moov box is located.
After using the -hint parameter in the MP4Box.exe the progressive download starts working. I also guess it's because that command moves the moov box to the beginning, just as required.
Curious, but well if it works for you. But keep in mind you will get a hint track for every a/v "elementary stream"(track) in your mp4 file.
The hint tracks contain information for rtp packet creation, used by a streaming server like DSS.
By the way, do you know if it makes any difference if I try hinting after using mp4tags? I'm scared that mp4tags may remove hinting information from mp4box, or mp4box may remove meta tag information from mp4tag.
I don't know mp4tags, but MP4Box will let iTunes tags inside the user data box untouched. You can set iTunes tags with MP4Box too. The user data box with iTunes tags is placed at the end of the file(AFAIK), so this information will be available after the file is completely downloaded.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.