[MEncoder-users] Audio Sync issues

Rolf Ernst rernst99 at gmail.com
Sun Sep 18 17:21:46 CEST 2011


----Original Message-----
From: mencoder-users-bounces at mplayerhq.hu
[mailto:mencoder-users-bounces at mplayerhq.hu] On Behalf Of Jeff Cranmer
Sent: Sunday, September 18, 2011 8:53 AM
To: MEncoder usage discussions
Subject: Re: [MEncoder-users] Audio Sync issues


> 
> Can you give me a bit more info on how to do this.  My expertise at 
> this stuff is fairly limited.
> 
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users

I made some progress yesterday.

By splitting the operation into two commands, I was able to keep the audio
in sync with the video.  

## Interlace and down-sample to 24000/1001 frame rate.
mencoder infile.mpg -o tempvid.avi  -ovc x264 -x264encopts
threads=0:bframes=5:b-adapt=2:partitions=all:cabac:nopsnr:nossim:mixed_refs:
frameref=6:weight_b:b_pyramid=normal:me=umh:merange=16:subme=6:analyse=all:8
x8dct=1:trellis=2:psy-rd=1,1:no-fast-pskip=1:crf=23 -oac faac -vf
tinterlace=4,filmdint=io=30:24/fast=0,scale=720:480 -noskip -fps 60000/1001
-ofps 24000/1001

## Convert to DIVX with pcm audio encoding.
mencoder tempvid.avi -o outfile.avi -ffourcc XVID -vf harddup -ovc lavc
-lavcopts
vcodec=mpeg4:threads=1:vbitrate=4000:cmp=2:subcmp=2:trell=yes:v4mv=yes:mbd=2
:aspect=16/9 -noskip -mc 0 -oac pcm -channels 2

It now plays on the little Sylvania unit, but the video is a little jumpy,
even when I lower the video bitrate to 3000.  I'm also trying to encode the
audio in ac3 instead of pcm, to see if that improves the jumpiness.  The
command below is my latest attempt at this, but I'm getting empty audio.

## Convert to DIVX with ac3 audio encoding mencoder tempvid.avi -o
outfile.avi -ffourcc XVID -vf harddup -ovc lavc -oac lavc -af
lavcac3enc=0:48 -channels 2 -lavcopts
vcodec=mpeg4:acodec=ac3_fixed:threads=8:vbitrate=4000:cmp=2:subcmp=2:trell=y
es:v4mv=yes:mbd=2:aspect=16/9 -noskip -mc 0

The output below suggests that I need to define the channel layout.  Can
anyone tell me what I'm missing?

MEncoder dev-SVN-r33321-4.5-openSUSE Linux 11.3 (x86_64)-Packman (C)
2000-2011 MPlayer Team
success: format: 0  data: 0x0 - 0xe8ace8c AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO:  [h264]  720x480  24bpp  23.976 fps  912.5 kbps (111.4 kbyte/s) [V]
filefmt:3  fourcc:0x34363268  size:720x480  fps:23.976
ftime:=0.0417
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 15997->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4
Audio))
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1 Opening video
filter: [harddup]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family Selected
video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Forcing output FourCC to 44495658 [XVID].
[ac3_fixed @ 0xb8a480]No channel layout specified. The encoder will guess
the layout, but it might be incorrect.
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Pos:   0.0s      2f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
videocodec: libavcodec (720x480 fourcc=44495658 [XVID]) [VE_LAVC] High
quality encoding selected (non-realtime)!
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.096s.
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.096s.

Thanks

Jeff

Re: Jumpy: The downsampling to 23.976 only works if what you are watching is
actually film. If not, you should simply half the frame rate to get to 29.97
and you should be ok. Though I don't know much what is actually originally
recorded at that.

As for the channel layout - with two channels - how can you go wrong? You
should be more or less pretty much immediately hear whether you made a
mistake.

/re



More information about the MEncoder-users mailing list