[MPlayer-dev-eng] [PATCH]:targa output with snapshot and index files

Arpi arpi at thot.banki.hu
Sat Aug 23 12:50:00 CEST 2003


> yes, normally my coomand line is something like 
> 	mplayer .. -nosound -noframedrop -speed 100 ...
> but you got 1 output frame every 25 input frame (if you tile 5 x 5). 
> I don't like to have a lot of small files (say a quarter size) but i prefer an 
> table with, say, 25 frames.

it's easily doable using a filter to collect 25 frames and create a 5x5 tile
as output.

> > > I will take a look at the OSD code (all the thing in the module was done
> > > to avoid external dipendence or to check the size of the text at runtime,
> > > changing the delta between the images).
> >
> > why do you need text rendering at all?
> to put the frame number (and this can be avoided, on the filename you got the 
> start frame) and, that's a little bit useful, the difference in decibels that 
> is used to decide if you want to drop the frame or not.
> In this way you start the conversion, tale a look at the first 'global' page 
> and you see if the parameter are ok (you see all the frame, even if they are 
> little, and you can see if you miss some scene change or if you end up with a 
> lot of very similar image).
> In the beginning I make a log file with a set of line filled with number of 
> frame / difference but was a little bit confusing to understand if it was 
> correct or not (if you see 23.20 db on frame 1234 you don't understand if it 
> was a scene change or not, seeing the images with the value is really 
> easier).
> I can put only the numbers and the -/+/, character (I start in this way but i 
> found a font in one of my source and it was easier to put all the character 
> then only the one i need, i tought to use an array of 256 pointer to che char 
> generator so in the end you will need 4 byte for a character you don't use 
> and 12 (4 of the pointer and 8 for the cg definition) for the ones you use so 
> i say: why became crazy, I put the first 128 char, if i need to print 
> something i got all i need). 
> >
> > > BTW in the tga_uty.c code there is a ultra-bad yuv2brg code, i take a
> > > look at the rgb2rgb converter but it seem to generate an error if i want
> > > to use yuv2rgb(...).
> >
> > argh!
> > why do you put conversion to a vo filter? it's done automatically outside
> > (in vf layer), just tell it what format you prefer (in query_format).
> I start using a copy of the vo_pgm file because i use only the Y channel to 
> see the  difference, writing the PGM file on change.
> Then I need a little program to convert form PFM to targa (of another format) 
> so I put the code directly in the filter.
> I tought it was good to avoid a lot of conversion (because normally the DVD or 
> the AVI files are already in YUV format) so I can use directy the data read 
> from the file with only one conversion (the ouput one).
> I can (is very easy) get the data in my vo_xxx in BGR format (the one needed 
> for the tga output) and, if necessary, convert the image in a subsampled by 
> 8x8 image of grey.
> The correct way to do this would be to put a filter in the chain, working in 
> YUV mode, that tell to the next filter (the conversion one) if the frame is 
> to drop or not.
> If is to drop do nothing, else make the conversion.

And there is already such filter, made by Rich a few months ago.
So you dont even have to implement it.

> Another reason is that I need the full frame (say 720 * 576) in BGR format not 
> always (if i enable only the snap output) but only on scene change.

if the above filter drops unneeded frames, then you will only convert wanted

codec -> vf_decimate -> vf_scale -> vf_tile -> vo_tga

so decimate will drop similar frames, scale will convert yuv2rgb and
downscale to 1/4 size (if you want that), vf_tile would collect and tile
images to a single image (could use DR to speed up things, so scale could
render into teh big tile image directly) and then you output result in tga
(or png via vo_png etc).

> in the swap_page() i make a trivial check:
> 	if ((framenum % framestep) == 0)
> 		write file
> 	else
> 		do nothing
> but in this way you have the yuv->rgb conversion 24 times more that you need 
> so this time i try to avoid to do the conversion when is not needed.

yes, because you did it at wrong place.
anyway there is such option, afair -sstep or so, to skip N frames between
every outputed frames.

you seem to reimplement half of mplayer infrastructure instead of

> I take also a look at the decimate filter (normally when i need something in 
> mplayer I take a look at the doc and i found that someone already implement 
> what i need, this time i don't look very good) and is surely better that 
> mine, even if i must understand well how to use the parameter.


> I must look also if is possible to reject a frame (to implement the tile 
> output or the snap as a filter you must say to the output module to don't 
> write (ouput) all the frame but only the ones with a particular flag.

return 0 will do that (tell output and next filters that you dont want to
output now).

> Say for example that you want to make a quick 'mpeg4 avi index' that outputs 
> only the keyframe of the mpeg stream (to see where you can cut the avi in a 
> correct place)

for this it's better to use g2, and write a new UI for this job, using
the demuxer and filter layers. this way you dont have to decode
non-keyframes. imho this could be put together in <1000 lines of new code.

> I good only some problem when i see Aliens and the film was on the track 33! 

A'rpi / Astral & ESP-team

Developer of MPlayer G2, the Movie Framework for all - http://www.MPlayerHQ.hu

More information about the MPlayer-dev-eng mailing list