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

Rich Felker dalias at aerifal.cx
Mon Nov 7 08:08:37 CET 2005


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.

> Since the shows are mostly low-motion anime, I find the
> resultant AVI files to be satisfactory.

If you must drop frames, use 12000/1001 fps (1/2 the actual
framerate). This should minimize choppiness, but results will be bad
without proper inverse telecine. Really there's no way you're going to
get satisfactory results without capturing at the full resolution
(both fields) and framerate, and then doing proper ivtc.

> mencoder -tv \
> driver=v4l2:device=/dev/video0:normid=1\
> :chanlist=us-cable:width=352:height=240:fps=18\
> :amode=1:forcechan=2:audiorate=48000:alsa:adevice=hw.0 \
> -ovc lavc -oac lavc -lavcopts acodec=ac3:abitrate=96\
> :vcodec=mpeg4:keyint=0:vqscale=1 \
> -vf detc=dr=1,crop=336:224:8:8,pp=lb,denoise3d=8:6:12\
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is why you're failing to capture at full framerate!!
Also detc on single-field (240 line) content is total nonsense, just
wasting cpu time.

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

Notice:
- no audio compression to waste time & ruin quality (96k ac3=shit)
- 32khz sampling (vhs/tv shit won't have more content anyway)
- no denoising to waste time
- no detc/deinterlace (both incorrect)
- full height and framerate
- mjpeg video (fastest)
- vf_fil separates the fields so that they dont bleed together when
being compressed by the mjpeg codec

(If it's still too low, drop the horizontal resolution until it works.
Certical resolution cannot be changed, neither can framerate.)

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!

mencoder -ovc lavc -oac pcm -lavcopts vcodec=mjpeg:vqscale=2 \
-vf crop=336:448:8:16,fil

> 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.

Rich




More information about the MPlayer-users mailing list