[MEncoder-users] block artifacts with lavc-flv

Alec Robertson alecr at MIT.EDU
Tue Apr 11 05:30:50 CEST 2006


Hi,

I'm encoding a yuv4mpeg stream generated by cinelerra from an ntsc dv
source. The image is cropped from 720x480 to 720x320 and deinterlaced
using mjpegtools. I encode to mkv/x264/aac and the quality is decent. 
When I try to encode to flv/mp3 using lavc then I notice some block 
artifacts. I use the latest cvs/svn versions of mplayer/cinelerra/
mjpegtools/ffmpeg (from April 10, 2006).

My script to do the rendering and encoding is below. I know the x264 
and lavc command lines are not equivalent but the lavc encoding seems
disproportionately poor by comparison. For examples (block artifacts 
evident around 12secs in ut.flv):
    http://web.mit.edu/alecr/www/mov/ut.mkv [36Mb]
    http://web.mit.edu/alecr/www/mov/ut.flv [13Mb]
    http://web.mit.edu/alecr/www/mov/ut.html [streaming]

>From looking through the mailing list archives, and the man pages, it
seems that x264 includes a deblocking filter while lavc doesn't? Mplayer
with "-vf pp=hb/lb" works well, but seems to have no effect in mencoder
(perhaps because it occurs before the encode?).

Any suggestions?

Alec

#############################################################
### encoding script
#############################################################
#!/bin/bash
# render video and audio in cinelerra
#     video = yuv4mpeg stream
#     pipe =  y4mscaler -v 0 -I active=720x320+0+80 -I ilace=BOTTOM_FIRST 
#                       -O size=720x320 -O sar=src -O chromass=420mpeg2 
#                       | yuvdeinterlace > $base.yuv
#     audio = microsoft wav
# encode to H.264 video and faac audio in matroska container
# sizes = 720x320 4:3 or 720x360 display for "widescreen"
cinelerra -r  # batch render from cinelerra
for i in *.yuv; do    
    base=`basename "$i" .yuv`     # base filename

    # encode the mkv-h264/aac 
    p0="-really-quiet -vf scale,hqdn3d,harddup -ovc x264 
        -x264encopts bframes=3:bitrate=2000:"
    p1="pass=1:turbo=2:"
    p2a="pass=2:turbo=0:"
    p2b="subq=7:4x4mv:8x8dct:me=3:frameref=5:b_pyramid:weight_b:"
    mencoder $i $p0$p1 -o /dev/null  # first pass (18fps) 
    mencoder $i $p0$p2a$p2b -o $base.avi  # second pass (5fps)
    faac $base.wav -o $base.aac  # convert audio to aac
    mv0="-A --display-dimensions 0:720x360 --engage allow_avc_in_vfw_mode "
    ma0="-D --aac-is-sbr 0 "
    mkvmerge -o $base.mkv $mv0 $base.avi $ma0 $base.aac # merge
    #mkvextract tracks $base.mkv 1:$base.avi 2:$base.aac # extract

    # encode the flv-mp3 
    f0="-noskip -mc 0 -of lavf -lavfopts 
         i_certify_that_my_video_stream_does_not_use_b_frames
        -vf scale=720:360,hqdn3d,harddup -ovc lavc -lavcopts 
         vcodec=flv:vbitrate=1000:mbd=2:v4mv:trell -audiofile 
         $base.wav -oac mp3lame -lameopts abr=64 -srate 22050"
    mencoder $i $f0 -o $base.flv # encode to flash (20fps)
    flvtool2 -U $base.flv;  # write duration metatag

    chmod a+r *.{mkv,flv}; #rm -f $base.{aac,avi,log,wav,yuv,swf,flv};  
done

#############################################################




More information about the MEncoder-users mailing list