[MPlayer-dev-eng] Screenshot Filter

Oded Shimon ods15 at ods15.dyndns.org
Tue Aug 30 19:20:25 CEST 2005


On Sun, Aug 28, 2005 at 12:21:19AM +0100, ObsessiveMathsFreak wrote:
> >I have totally lost the track of what you actually want to achieve, but
> >would a screenshot filter having no cpu requirements when idle,
> >accepting all the colorspaces that vf_scale accepts and rescaling to a
> >correct aspect ratio please you?
> 
> Yes, that was rather beautiful, thank you. Plus this one doesn't need to 
> be wrapped around scale filters. Kudos to you!
> 
> 
> I did a small amount of experimenting with dynamically inserting the 
> screenshot filter. It turns out it can be done if you call 
> mpcodecs_config_vo after the filter is inserted, like so:
> 
> vf_instance_t *vfilterlist = (vf_instance_t*)sh_video->vfilter;
> vf_instance_t *new_filter = vf_add_before_vo(&vfilterlist , 
> "screenshot", NULL);

interesting thing i just realized about 'vf_add_before_vo', it does no 
error checking, it can allow vfilter to be NULL... but it's always used 
intenrally so it's less important;

> sh_video->vfilter = vfilterlist;

BTW, why didn't you just shorten this code to

vf_add_before_vo(&sh_video->vfilter, "screenshot", NULL);

...

> //reconfigure codecs
> mpcodecs_config_vo (sh_video, sh_video->disp_w,sh_video->disp_h, 0);
> 
> 
> But there are problems.(Apart from the calamitous uglyness of this hack!)
> 
> If you insert the new filter as the first in the filter chain, then 
> something will go awry and ugly black squares will pop up(on xvid files 
> at least).(not sure what the technical term for this is, "codec 
> hiccup"?). If however, you insert the filter anywhere else, such as 
> before vo using vf_add_before_vo, then no problems seem to occur and yo 
> can start snapping screenshots with seemingly no ill effects.

I couldn't reproduce this, I tried the filters 'crop' and 'harddup'... can 
you send a screenshot?

> Naturally, if there are no other filters apart from vo in the filter 
> chain, you'll get nasty black squares no matter what you do, because the 
> filter is always added as the first.
> 
> This actually occurs regardless of the new filter you insert. It can be 
> "screenshot," "scale", "cropdetect" , whatever. If it's set as the first 
> filter in the chain, you get errors. The errors go away as soon as you 
> go further on (keyframe?), so mplayer is still usable after insertion.

Sounds odd, first I thought it was due to the re config... but now you says 
it goes away? sounds like a single hard dropping of a frame, which seems 
REALLY odd because it's completely unrelated...

> These errors seem to happen for almost every vo filter, even for -vo 
> null !! They come up on the screenshots as well. Strangely,they don't 
> seem to appear for -vo png ? So it "seems".

vo_png causes a vf_scale to appear in the filter chain, look at mplayer's 
output!

Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]

> I could spend eternity trying to sort this OR I could just add alias 
> mplayer="mplayer -vf screenshot" to my .bashrc. I think for now I'll go 
> with the second option.

you can also use ~/.mplayer/config ... with vf_screenshot it's harmless, 
but i'd suggest not using it for other stuff...

> Thanks for the patch. It works like a dream. And apologies if I was too 
> great an irritation.

I'm gonna try to get this vf into cvs...

- ods15




More information about the MPlayer-dev-eng mailing list