[MEncoder-users] 2 Channel AC3 problem

Paulo Licio de Geus paulo at las.ic.unicamp.br
Sat May 23 18:26:42 CEST 2009


> specifically some of the streams contain 2 channel AC3.


> If I try to convert these using -channels 6 -oac lavc -lavcopts
> acodec=ac3:bitrate=384 then the output convert is only 2 channel Dolby
> Digital rather then a 2 channel AC3 output.
>
>   

You'd better off keep sound as it is. What would you fill the other
channels with?

> If I try -oac copy I'm getting the AC3 retained correctly but am
> getting noticeable 'clipping' during sound playback which isn't on the
> source material (does -oac copy do anything funky to the material?)
>
>   

> Also as mkv output is not working what do people recommend under linux
> to produce x264/AC3 files?
>
>   

This is what I do to reencode:

- extract all needed streams
    - mkvmerge -i material.??? to get a listing of the streams
    - then mkvextract tracks material.??? 0:video.mkv 1:audio.ac3 2:sub.srt

- reencode the video stream with proper settings, including -ofps ???
-mc 0 -noskip -nosound. The below selected parts from my script gives me
results undistinguishable (to me) from the original material:

VFEXTRA="-vf-add hqdn3d=2:1:2"
    X264ENCOPTS1="-x264encopts
subq=6:partitions=all:8x8dct:me=umh:frameref=5:bframes=3:b_pyramid:weight_b:"
    X264ENCOPTS1=${X264ENCOPTS1}${NRx264}
    X264ENCOPTS2=$X264ENCOPTS1; X264ENCOPTS3=$X264ENCOPTS1

    mencoder "$MKVFILE" $SCALE $VFEXTRA -ovc x264 \
        ${X264ENCOPTS1}threads=auto:bitrate=$BITRATE:turbo=1:pass=1 \
        -of rawvideo -ofps $MFPS -mc 0 -noskip -nosound -o /dev/null

    mencoder "$MKVFILE" $SCALE $VFEXTRA -ovc x264 \
    ${X264ENCOPTS2}threads=auto:bitrate=$BITRATE:pass=2 \
    -of rawvideo -ofps $MFPS -mc 0 -noskip -nosound -o $VOUT


- Repackage into mp4: MP4Box -fps $FPS -add video.h264 video.mp4
    This solved all my audio de-sync problems

- Optional. If you have dts, convert to ac3 because dts is way too
expensive space-wise.
    dcadec -o wavall audio.dts | aften - audio.ac3

- Repackage into mkv

$ mkvmerge -i audio.ac3
File 'audio.ac3': container: AC3
Track ID 0: audio (AC3)
$ mkvmerge -i video.mp4
File 'video.mp4': container: Quicktime/MP4
Track ID 1: video (avc1)
$ mkvmerge -i sub.srt
File 'sub.srt': container: SRT
Track ID 0: subtitles (SRT)

Here is the final mkvmerge command, not quite following the above info
though, with an added bonus:

mkvmerge --title "2008 tt0800080 The incredible Hulk 720p and 1080p" -o
film.mkv --language 0:eng --default-track 0 --track-name 0:English -a 0
-D -S audio.ac3 --language 1:eng --default-track 1 --track-name 1:720p
-d 1 -A -S ../tmp2/video.mp4 --language 1:eng --track-name 1:1080p -d 1
-A -S video.mp4 --language 0:eng --track-name 0:English -s 0 -A -D
sub.srt --language 0:por --default-track 0 --track-name 0:Portuguese
--sub-charset 0:ISO-8859-1 -s 0 -A -D sub-pt.br.srt --track-order
0:0,1:1,2:1,3:0,4:0

Now, mplayer film.mkv will play at 720p by default, and mplayer -vid 1
film.mkv will play the 1080p video track instead. This way I preserve in
a single file the original 1080p resolution together with the
possibility of lowly machines to play the 720p track. By encoding 720p
at 2000Kbps and 1080p at 5000Kbps in 2-pass, I end up, for a typical
100-min movie, with a just over 5GB file containing two video tracks.
This is much smaller than the 4.4GB (720p) and 8GB (1080p) that you
usually find in torrents.

I pieced this together from uncountable pages I researched and my own
tests to spare some gigabytes per movie. I'm afraid I can't give proper
credits.

Another extra information I found out is that my machine (Core2 2.6GHz)
won't play a typical 1080p movie smoothly, but the reason seems to be
that there is too much data to be processed by the x264 decoder on its
own. I tried to get VDPAU working on the nvidia quadro NVS140M, but it
didn't make a difference. By reenconding with smaller sizes like the
above commands, it is now able to play the 1080p tracks smoothly, even
though the original resolution is maintained.

-- 
Paulo Licio de Geus		    Internet: paulo at las.ic.unicamp.br
Instituto de Computação - UNICAMP   Av. Albert Einstein, 1251 
caixa postal: 6176		    fax: +55 19 3521-5847 (só em último caso)
13083-852  Campinas SP Brazil       http://www.las.ic.unicamp.br/paulo
cell: +1 (805) 901-1280 (Ventura CA USA)
skype: paulo.licio.de.geus
fuso horário atual: GMT-7 (-4h SP)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mencoder-users/attachments/20090523/91ab3a23/attachment.pgp>


More information about the MEncoder-users mailing list