PDA

View Full Version : WDTV: Transcoding AAC 6-chan to AC3 6 chan



RMerlin
07-29-2010, 09:33 AM
Unlike my PS3, my WDTV can only handle AC3 when it comes to 5.1 audio. I have a few DVDs that I had ripped in H264 with AAC 5.1 audio. Can you tell me what I should put into my WDTV profile to have it transcode any AAC with more than 2 channels into AC3 (but keeping AAC 2 channels as it is)? That way the WDTV would pass the audio to my receiver, for proper 5.1 surround.

Thanks!

Paul
07-29-2010, 09:38 AM
Is it for Matroska, QT or MPEG-TS containers?

RMerlin
07-29-2010, 09:48 AM
I used mp4 for my container. Here's a sample:


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'f:\Video\Movies\Science Fiction\Star Trek\StarTrek.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1
Duration: 02:06:49.13, start: 0.000000, bitrate: 1191 kb/s
Stream #0.0(und): Video: h264, yuv420p, 720x480 [PAR 32:27 DAR 16:9], 999 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Stream #0.1(und): Audio: aac, 48000 Hz, 5.1, s16, 188 kb/s

Paul
07-29-2010, 11:36 AM
Try something like this (it's untested though, so I don't know if it'll work or not):



<avcontainer id="mov,mp4,m4a,3gp,3g2,mj2" name="qt" format="mp4" encode="1" mimetype="video/m4v">
<video>
<format id="h264" encode="1" codec="libx264" preferredtranscoded="1">
<copyts>1</copyts>
<samequality>1</samequality>
<bitrate>25000000</bitrate>
</format>
</video>
<audio>
<format id="ac3" encode="1" codec="ac3" preferredtranscoded="1">
<channels>2</channels>
<channels>6</channels>
<bitrate>448000</bitrate>
<maxbitrate>448000</maxbitrate>
<minbitrate>64000</minbitrate>
<samplingrate>48000</samplingrate>
</format>
</audio>
<audio>
<format id="aac" encode="0" codec="aac">
<channels>2</channels>
</format>
</audio>
<ffmpegadditional>-threads 4 -coder 1 -flags +loop -cmp +chroma -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 3 -refs 2 -directpred 1 -trellis 1 -flags2 +bpyramid+mixed_refs+wpred+dct8x8+fastpskip -wpredp 2</ffmpegadditional>
</avcontainer>


Please let me know if it works or not. If it works, I think it'll be a good addition to the device profile for everyone to use. If it fails in transcoding, can you please post the transcoding log so that I could fix the issue? Thanks!

RMerlin
07-30-2010, 06:16 AM
Hi Dennis,

I had to take out the following block for transcoding to occur:



<avcontainer id="mov,mp4,m4a,3gp,3g2,mj2" name="qt" encode="0" mimetype="video/m4v">
<video>
<format id="h264" encode="0">
</format>
</video>
<audio>
<format id="aac" encode="0" codec="aac">
</format>
</audio>
</avcontainer>


After that, the file was properly being transcoded. However for some reason the WDTV was still only playing two channels. Same thing happened when I took the transcoded file and tried to play it back locally using KMPlayer on my desktop - only two channels were played. I did some research, and turns out AC3 isn't officially supported in an mp4 container.

I manually transcoded a test sample in an mpegts container instead of an mp4 container (using the same settings Mezzmo was using when transcoding), and then it properly played in 5.1 on my desktop, as well as on my WDTV (5.1 audio was properly passed to my receiver, and decoded to my surround speakers).

Is it possible to adjust the profile so it will also convert that mp4 container into an mpegts container? So the end result would be:

Input: H264, AAC 5.1, MP4
Output H264, AC3 5.1, MPEG-TS

(or if you can think of a better choice for a container, that would work too :)

I also prepared a sample H264/AAC 6 channels file in case you wanted to test it yourself:

http://www.lostrealm.ca/temp/Sample-h264-aac.mp4

Keep me informed.

Paul
07-30-2010, 08:33 AM
Hi,

Yes, sorry I didn't mention it, but it was meant to replace that container.

Ok, to transcode to MPEG-TS with h264/AC3 you'll need the following container (replace the current mpegts container):



<avcontainer id="mpegts" name="mpegts" encode="1" format="mpegts" mimetype="video/mpeg">
<video>
<format id="h264" encode="1" codec="libx264" preferredtranscoded="1">
<copyts>1</copyts>
<samequality>1</samequality>
<bitrate>25000000</bitrate>
</format>
</video>
<video>
<format id="mpeg2video" encode="0">
</format>
</video>
<audio>
<format id="mp2" encode="0">
</format>
</audio>
<audio>
<format id="s16be" encode="0">
</format>
</audio>
<audio>
<format id="ac3" encode="1" codec="ac3" preferredtranscoded="1">
<channels>2</channels>
<channels>6</channels>
<bitrate>448000</bitrate>
<maxbitrate>448000</maxbitrate>
<minbitrate>64000</minbitrate>
<samplingrate>48000</samplingrate>
</format>
</audio>
<audio>
<format id="aac" encode="0">
</format>
</audio>
<ffmpegadditional>-threads 4 -copyinkf -sc_threshold 1000000000 -vbsf h264_mp4toannexb</ffmpegadditional>
</avcontainer>


and also probably change the mp4 one to:



<avcontainer id="mov,mp4,m4a,3gp,3g2,mj2" name="qt" encode="0" mimetype="video/m4v">
<video>
<format id="h264" encode="0">
</format>
</video>
<audio>
<format id="ac3" encode="0">
<channels>2</channels>
</format>
</audio>
<audio>
<format id="aac" encode="0" codec="aac">
<channels>2</channels>
</format>
</audio>
</avcontainer>


Let me know if that achieves the result you're looking for :) If not, I'll grab your file and try it here.

RMerlin
07-30-2010, 02:12 PM
Worked perfectly (I applied the two changes you last recommended) :) An mp4 with AAC 5.1 was correctly transcoded to AC3 5.1 and played in surround on my system, and another mp4 with AAC 2.0 was streamed without being transcoded, just as expected. I think this is worth adding to the next WDTV profile. Thanks!

Paul
07-30-2010, 02:14 PM
Great! Thanks for letting me know. I'll add this to the WD TV Live profile for the next Mezzmo update.

sgmitr
08-28-2010, 12:53 AM
Great! Thanks for letting me know. I'll add this to the WD TV Live profile for the next Mezzmo update.

Hi, I chanced upon this thread while searching for the exact problem with FAT+.
I have both MP4 and MKV, but my receiver cannot accept AAC. I tried various method to convert AAC to AC3, but haven't quite figured out how to correct the channel mix-up. And the task itself is quite laborious.

The solution exchanged in here looks perfect, is there a way for it to work in Free Agent Theatre+ ?

Thanks.

RMerlin
08-28-2010, 07:15 AM
As long that device can passthrough the AC3 audio to your receiver (not all of them do), it should work, yes. Which device profile do you use?