[MEncoder-users] mencoder, ac3 audio and mts conversion to avi

Alex Morris axman.5389 at gmail.com
Sat May 24 03:40:47 CEST 2008


Hello,

I'm using the m2tstoavi conversion scripts found at
http://www.olmosconsulting.com/hdr-sr1/

The tools make use of mencoder, and ffmpeg to transcode the high definition
video and Dolby audio to a format suitable to be held an avi container.
Sorry if my use of these terms is wrong, I'm new to this.

The m2tstoavi process basically separates the mts file into a yuv video and
ac3 audio file, then combines them to an avi file.  In theory..

I have MEncoder 1.0rc2-SUSE Linux 10.3.
ffmpeg version SVN-r12823
configuration: --prefix=/usr --mandir=/usr/share/man --libdir=/usr/lib
--shlibdir
=/usr/lib --enable-pthreads --enable-shared --enable-swscale
--disable-static --ena
ble-libmp3lame --enable-libfaad --enable-libfaadbin --enable-libfaac
--enable-libxv     id --enable-libx264 --enable-liba52 --enable-liba52bin
--enable-postproc --enable-s     hared --enable-libdc1394 --enable-libtheora
--enable-gpl
  libavutil version: 49.6.0
  libavcodec version: 51.54.0
  libavformat version: 52.13.0
  libavdevice version: 52.0.0
  built on May  3 2008 20:21:48, gcc: 4.2.1 (SUSE Linux)

AVCHD .mts files are created with Panasonic HDC-SD9P.
mencoder video codec in use = -ovc x264.
mencoder audio codecs tried = -oac lavc with options of ac3.  I also tried
-oac copy.

The Problems;

I try to select -oac lavc -lavcopts acodec=ac3,channels=6,abitrate=384
for the audio portion of the transcoding from ac3 to avi.

This creates the avi with no sound.  Video is nice, very smooth and high
res. No audio.  I find this in the program output;

LAVF_header: av_find_stream_info() failed
RAWDV file format detected.
VIDEO:  [DVSD]  720x576  24bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
[V] filefmt:65536  fourcc:0x30323449  size:1920x1080  fps:25.00
ftime:=0.0400
==========================================================================
Opening audio decoder: [libdv] Raw DV Audio Decoder
Unknown/missing audio format -> no sound
ADecoder init failed :(
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
Cannot find codec 'dvaudio' in libavcodec...
ADecoder init failed :(
ADecoder init failed :(
Cannot find codec for audio format 0x56444152.
Read DOCS/HTML/en/codecs.html!

I don't understand what's happening.

Q: If mplayer identifies the audio sample as ac3, should I be using ac3
codec in the transcoding process?
Q2: When I run mencoder -oac help, it lists lavc as present.  Why does my
use of mencoder apparently ignore the lavcopts I chose?
Q3: What is mencoder's use of lavc telling me when ffmepg cannot find
dvaudio in libavcodec?

I think this method should work, because I can play the audio-only portion
of the sample with mplayer, like this;

mplayer -rawaudio format=0x2000:channels=6:bitrate=38400 -demuxer rawaudio
00000.mts.ac3

Playing 00000.mts.ac3.
rawaudio file format detected.
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 243.8 (04:03.7) of 24.5 (24.4)  0.9%

Exiting... (End of file)

I'm confused about the above attempts, but I don't give up.  I try a
different method, more in the line of what Mr Olmos suggested, that is using
-oac copy.

Just trying -oac copy with no options fails, giving this info;

Audio format 0x56444152 is incompatible with '-oac copy', please try '-oac
pcm'
instead or use '-fafmttag' to override it.

I give the option -fafmttag 0x2000 based on success with mplayer.  This
creates an avi file, with audio. Yay! But..  The audio transcode portion
gave this info during processing;

Forcing output audio format tag to 0x2000.
audiocodec: framecopy (format=2000 chans=0 rate=0 bits=16 B/s=3600000
sample-12928)
Warning, len isn't divisible by samplesize!

And at the very end of the process, I think during x264 processing, I get
segfault.

Video stream: 12760.488 kbit/s  (1595060 B/s)  size: 46835291 bytes  29.363
secs  736 frames

Audio stream: 28835.243 kbit/s  (3604405 B/s)  size: 1152000 bytes  0.320
secs
x264 [info]: slice I:5     Avg QP:16.00  size:163282
x264 [info]: slice P:730   Avg QP:18.35  size: 63039
x264 [info]: mb I  I16..4: 63.0%  0.0% 37.0%
x264 [info]: mb P  I16..4: 33.1%  0.0%  4.6%  P16..4: 27.2% 11.6%  3.2%
0.0%  0.0%    skip:20.4%
x264 [info]: final ratefactor: 17.70
x264 [info]: kb/s:15277.6
Segmentation fault

This does create an avi file, with audio.  But the video is now choppy, the
zoom-in is not as smooth, and the sound ends before the end of the video.

Q: Why did x264 segfault?
Q2: Why did video get choppy once audio was added?  Is it load on the PC, or
a factor of blending the two data streams, and I did not set options
correctly?
Q3: What is meant by len not divisible by samplesize?  Does it mean length
of the audio sample?  Is the samplesize reported a negative number? Does
this have anything to do with segfault?
Q4: Why is # of channel seen as 0, and not 6 (for Dolby 5.1)?

I understand there could be many things affecting the choppy video.  Not so
worried about it right now, because I made progress and have avi with
picture and sound.  I also understand that I can control - to a degree - how
much the audio slips time in relation to the video.  Will approach that
'later' after I have more understanding of all these fundamental (to me)
questions.

Sorry for the long post, and ignorance.  Any comments or suggestions are
warmly appreciated.  Reading man pages and mailing lists, not giving up !
Thank you.

ax



More information about the MEncoder-users mailing list