[MPlayer-users] Re: mplayer screen snapshots

Samuel Kvasnica samuel.kvasnica at tuwien.ac.at
Mon Nov 3 18:52:41 CET 2003


Ok, so I hacked it and got the feature. Took me almost a day since the 
mplayer.c  is such a disgusting piece of code with deep pointer forest 
and globals, great example how not to write C programs. In a fact, the 
implementation cries for C++, it would cost at most 10%overhead but the 
code would be much more readable. But enough swearing.

I have now mapped 's' key for snapshot and 'snapshot' cli command for 
'-slave' mode. I just created a secondary video output snapshot_out 
which is using vo_jpeg, vo_png etc. and coresponding sh_snapshot and 
call decode_video() second time using sh_snapshot. swscaler is initd 
automatically. Works great for me. I still have to add an cli option to 
select the snapshot format e.g. -grab jpeg and maybe option for output 
file name which would allow for stdout output - important for -slave 
operation.

Should I submit a patch ? In my case this feature is extremely 
important. Imagine you are watching live raw video e.g. CCD on 
microscope and want just to shot a picture when you find something 
interesting - not to save the whole video and look for pictures 
afterwards. The reason I decided to misuse mplayer is that it understands
plenty of raw video format, filters etc.

Now I'm fighting with the -wid option, I would like to display mplayer 
output in my own app but there are strange problems if the window is not 
child of root window.

Sam

Sycotic Smith wrote:

>Well, to put it plainly, I have no clue where to start on this, either. I was hoping someone on the list would pick it up and run with it, but no luck yet.  I did find that ksnapshot works great if you're using the X11 or SDL outputs, but doesn't if the vo uses any form of overlay.  I forget how I got it to snap the frame without pausing, but it does work kinda how I was wanting it to, though in your case if the ccd camera stream is live, doubtful you'll know the exact frame you'll need.  Here is a suggestion, tho: instead of just watching the stream, use mencoder to copy it to disk, then watch it with mplayer and pause to take screenshots with ksnapshot. Or use vo png and tell it what frames you want. I suggest reading through the docs and manpage to find how to use "-ss" and "-frames" for this. Problem with png/jpeg/gif/etc vo's though, they always give you frame 0 no matter what, which is usually black or white depending on your vid.
>
>Also, I suggest sending the same question you sent me to the mailing list, and subscribe until you get an answer maybe, but it is high-traffic of late.
>
>Happy capping!
>/SycOtiC Smith
>  
>





More information about the MPlayer-users mailing list