[Ffmpeg-cvslog] CVS: ffmpeg/libavcodec motion_est.c,1.115,1.116

Corey Hickey bugfood-ml
Fri Dec 30 21:15:29 CET 2005

Corey Hickey wrote:
> Michael Niedermayer wrote:
>>btw, if you want you could try to replace 
>>all 'c->scene_change_score+= s->qscale' in motion_est.c
>>with 'c->scene_change_score+= s->qscale*N'
>>where N is a interger between 1..16 (16 should be the old, 1 the new)
>>according to my tests 1 was best overall on my files but the differences
>>at the low values where small (all IIRC as i cant check that ATM), so 
>>maybe we should increase it ...
>>you could also try different values for scene_change_threshold ...
>>allthough 6h encoding for each case maybe a serious problem, my files
>>where all short <=2min 
> Well, I have a script running now that will test the various values in
> this order:
> 4 8 12 16  2 6 10 14  1 3 5 7 9 11 13 15
> If and when I see a trend I can kill the script and narrow it down.

I modified libavcodec and mplayer to make the N you mention be
configurable and ran my tests. The speed impact is undetectable in my
current setup. Here are the PSNRs so far:

sc_factor=1 PSNR: Y:42.04, Cb:45.15, Cr:45.84, All:42.91
sc_factor=2 PSNR: Y:42.04, Cb:45.15, Cr:45.82, All:42.91
sc_factor=3 in progress...
sc_factor=4 PSNR: Y:42.06, Cb:45.15, Cr:45.84, All:42.93
sc_factor=5 not done
sc_factor=6 PSNR: Y:42.08, Cb:45.16, Cr:45.85, All:42.95
sc_factor=7 not done
sc_factor=8 PSNR: Y:42.08, Cb:45.16, Cr:45.84, All:42.95
sc_factor=9 not done
sc_factor=10 PSNR: Y:42.09, Cb:45.16, Cr:45.85, All:42.96
sc_factor=11 not done
sc_factor=12 PSNR: Y:42.09, Cb:45.16, Cr:45.84, All:42.96
sc_factor=13 not done
sc_factor=14 PSNR: Y:42.09, Cb:45.16, Cr:45.84, All:42.96
sc_factor=15 not done
sc_factor=16 PSNR: Y:42.09, Cb:45.16, Cr:45.84, All:42.96


1 (the current default), 2, and 4 look pretty much the same.

At 14 and 16 I see some high-motion scenes that benefit from receiving
an I-frame, but other places that have high motion but not enough to
trigger an I-frame look worse.

At 10, 12, and 8 (to a lesser extent), I can't find the scenes that get
another I-frame, and other high-motion scenes still look worse.

6 looks nice. I can't find anywhere that looks worse, and the
high-motion scenes with extra I-frames still look much better.

I don't know how universally applicable these tests are, but if 16 was
default before and 1 is default now, adjusting to somewhere toward the
middle is probably a safe change. I've attached patches for ffmpeg and
mplayer, if anyone else wants to test this. If the patches should be
applied, I'll make a patch for the mplayer man page. Otherwise, 6 could
just be hardcoded.

I haven't tried sc_threshold yet. My understanding is that using
sc_factor differs from sc_threshold in that sc_factor makes frames with
high quantizers have a greater impact in triggering an I-frame. Is that

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sc_factor.ffmpeg.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20051230/2531f218/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sc_factor.mplayer.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20051230/2531f218/attachment.asc>

More information about the ffmpeg-cvslog mailing list