View Full Version : need advice on libavcodec
ferocious
25th January 2004, 14:27
Hi, i'm trying to encode an old B/W movie with "rainy" images using libavcodec and i want to know if my lavc options are .... not dumb ..
i can't get it smaller (i could if i use xvid)
here are my options :
mencoder -passlogfile samurai.stats -vc ffmpeg12 -sws 9 -vop expand=672:448,scale=672:378:0:1,hqdn3d,crop=706:476:9:3,pp=lb -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vqmin=2:vqmax=2:keyint=150:vbitrate=16000:vb_qfactor=1.0:vb_qoffset=0.0:vqcomp=1.0:preme=2:vmax_b_frames=1:vqdiff=2:qpel:vpass=1 -oac copy /mnt/1/Temp/001.mpg -o /dev/null
mencoder -passlogfile samurai.stats -vc ffmpeg12 -sws 9 -vop expand=672:448,scale=672:378:0:1,hqdn3d,crop=706:476:9:3,pp=lb -ovc lavc -lavcopts vcodec=mpeg4:mbd=1:vqmin=2:vqmax=31:keyint=150:vbitrate=1300:vb_qfactor=1.0:vb_qoffset=1.0:vqcomp=0.7:preme=2:vmax_b_frames=1:vqdiff=2:qpel:vpass=2 -oac copy /mnt/1/Temp/001.mpg -o 7samurai.avi
some options bothers me .. i dunno which one should be used during 1st pass and during 2nd pass ..
which deinterlacing is the best ? the one in mencoder's internal postprocessing or anything else ?
oh, one more thing .. if i use qpel, can i use v4mv ? does it support B-frames ?
mikeX
25th January 2004, 17:50
kourosava, niceee...!
don't know much about libavcodec, but from a few encodings i made with ffmpeg sometime ago (without messing with the settings) i came to the conclusion that xvid is better..., why don't you give it a try?
what is v4mv??
generally you could increase copressibility with more bframes (xvid has max bframes 2 as default) and higher bframe quant offset (1.0 with 1.5 ratio) (that's what vb_qoffset is right?)
why do u use such a small keyframe interval??
whether qpel makes a worthy enough difference is arguable, so better not use it if insure...
what is your target size?? (2cds judging from the bitrate)
xvid also has an 'interlaced' option for encoding truly interlaced content (you could then deinterlace on the fly during playback)
ferocious
26th January 2004, 06:00
well, actually i'm trying to make it fit on 2 cds w/o reducing the quality too much .. currently .. it only could fit 3 cds ..
and about interlacing, .. i hate that ..
i've tried 2 b-frame max and it's good .. as long as the qfactor and the qoffset isn't too far.
about v4mv, it's kinda like the 4mv option in xvid (i think .. haven't X-check it again).
there's another mind tickling option .. the mv0 (it encodes at motion vector {MV=0,0} and chooses the best mode -- that's what it said on the manpage) .. what's a motion vector ?
well, tha main thing is .. could libavcodec get's smaller size compared to xvid for the same quality ?
pfui .. i think i better find some readings about image processing.
thanks for the advice mikeX
mikeX
26th January 2004, 15:28
motion vectors are the result of motion estimation (which is the process of creating p or b frames -delta frames- if i'm correct)
i don't think there is 4mv in xvid, from what you say maybe it's the equevelantof 'vhq (1-4)'
if that's it then iirc there is no problem using it with b-frames but it only applies (makes any diffence that is) to p-frames (can't recall about q-pel, but anyway i use both q-pel,b-frames & vhq1 in most of my encodings)
i doubt that you can get smaller filesize with libavcodec at the same quality as xvid, esecially if you use adaptive quantization with xvid (applies more compression to really dark or bright areas the where the eye can't notice much detail- i've heard it really helps reducing the file size at a given bitrate)
the best thing you can really do though is test both and see what's best
--: edit :--
don't relly too much on what i'm saying in the first paragraph, it's probably wrong, i'm gonna check some things and post back
mikeX
28th January 2004, 01:41
ok my assumptions about 4mv and vhq where totally wrong...sorry...
Here are a few links you mind find interesting (they are all xvid related but they provide some good general technical info about the internals and externals of mpeg-4 -and not only- encoding)
GMC:: (has some info about motion vectors)
http://forum.doom9.org/showthread.php?threadid=69532
Quarterpel:: (haven't really read this one)
http://forum.doom9.org/showthread.php?threadid=57219&highlight=quant%2A+AND+matri%2A
Understanding a Quantization Matrix:: (has more info about motion vectors and generally the way information is encoded in an mpeg-4 stream)
http://forum.doom9.org/showthread.php?threadid=54147&highlight=quant%2A+AND+matri%2A
Finally you might find more about libavcodec in the "New A/V formats - Codecs" section of this forum::
http://forum.doom9.org/forumdisplay.php?forumid=54
unixfs
29th January 2004, 18:47
I made many tests with libavcodec, and I always found xvid to
give better results.
Anyway, If you still use libavcodec I suggest you not to rescale: just crop and use -lavcopts ...:aspect=x/y or :autoaspect
you will get much better images.
hqdn3d works very well, but it's unnecessary if the movie is clean.
I recently discovered that -vf pullup (instead of -vf pp=lb) works better than all the other
deinterlacers, so you may give it a try
Regarding vqmin=2:vqmax=2:keyint=150:vbitrate=16000:vb_qfactor=1.0:vb_qoffset=0.0:vqcomp=1.0:preme=2:
you had better not touch vb_qfactor, vb_qoffset, vqcomp: leave them as default. In my opinion Bframes hurt more than they do any good, so
I would use vmax_b_frames=0.
vqmin=2:vqmax=2:vbitrate=16000 means vqscale=2 (the bitrate can't be controlled when you set q=2).
Final thought: since you are willing to use that much space, if the source is MPEG2 and clean there's no better recompressor
than M2Vrequant: you can apply a divisor of
4.5 and still get a very good quality, and it's super fast.
I'm talking about the last version, generally posted by Makira in Rejig's thread.
ferocious
30th January 2004, 18:48
wow .. thank you very much for the links and hints .. i could tune it better .. but still can't get it smaller than xvid .. i think i'll switch to xvid ... soon ;)
well, lavc is good .. but for now all i need is space ..
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.