[MPlayer-users] Transcoding 18 fps mpeg4 to VCD-compliant mpeg

Heimdall Midgard heimdalle at gmail.com
Tue Nov 8 00:37:50 CET 2005


2005/11/7, Rich Felker <dalias at aerifal.cx>:

> On Mon, Nov 07, 2005 at 11:05:20AM +0800, Heimdall Midgard
> wrote:
>
> > Is is it even possible to convert an 18 fps mpeg4 video to a
> > ~23.97 or ~29.97 fps VCD-compliant mpeg stream *without*
> > losing audio-video sync?. As my system can't cope with
> > recording at a full 29.97 fps, I'm forced to record at 18
> > fps.
>
> Lower the resolution. Don't drop frames.

[...]

I'll ignore your TV encoding tips for the meantime. I have a
bunch of "wrongly" encoded avis to fix ;-).

> Try this:
>
> mencoder -tv driver=v4l2:device=/dev/video0:normid=1\
> :chanlist=us-cable:width=352:height=480\
> :amode=1:forcechan=2:audiorate=32000:alsa:adevice=hw.0 \
> -ovc lavc -oac pcm -lavcopts vcodec=mjpeg:vqscale=2 \
> -vf crop=336:448:8:16,fil

I'll just note here that I prefer to encode using mpeg4 since
I have to edit out the commercials with avidemux2, which
appears to have better support for mpeg4 than for mjpeg.

> Then reencode with:
>
> mencoder -oac lavc -ovc lavc \
> -lavcopts acodec=mp2:abitrate=224:vcodec=mpeg1video\
> :vbitrate=1150:vrc_buf_size=327:vrc_minrate=1150:\
> vrc_maxrate=1150 \
> -of mpeg -mpegopts format=xvcd \
> -vf fil=i,pullup,softskip,scale=352:240,denoise3d,harddup \
> -ofps 24000/1001 -o vcd.mpeg tvcapture.avi
>
> Notice:
> - correct rate control options for vcd
> - vcd mpegopts format
> - doing video filtering here rather than at capture time
> - no -noskip!

Wow, you must really know your transcoding ABCs! I adjusted
your options to deal with the 18fps 48KHz mpeg4 recordings I
already have.

mencoder -oac lavc -ovc lavc \
-lavcopts acodec=mp2:abitrate=224:vcodec=mpeg1video\
:vbitrate=1150:vrc_buf_size=327:vrc_minrate=1150:\
vrc_maxrate=1150 \
-of mpeg -mpegopts format=xvcd \
-vf pullup,softskip,scale=352:240,harddup \
-af resample=44100 \
-ofps 24000/1001 -o vcd.mpeg tvcapture.avi

I removed the options "-vf fil=i" since I didn't record with
"-vf fil" in the first place and "-vf denoise3d" since I did
that during the recording. Since vcdimager complains
about the 48KHz audio, I added the option "-af
resample=44100" to be on the safe side.

> > The mpeg is recognized by VCDImager but when played back
> > there's a huge audio-video desync of several
> > seconds. What am I missing here?
>
> Probably was caused by the -noskip option.

Did I misread the man page? In the section for "MPEG muxer
(-mpegopts)" I see the following:

"The MPEG muxer can generate 5 types of streams, each of
which has reasonable default pa‐rameters that the user can
override.  Generally, when generating MPEG files, it is
advisable to disable MEncoder's frame-skip code (see
-noskip, -mc as well as the harddup and softskip video
filters)."

I suspect it's the added "vrc_" rate control options that
did the trick.

--
Albert Einstein: Phantasie ist wichtiger als Wissen, denn Wissen ist begrenzt.




More information about the MPlayer-users mailing list