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

danny guru at digitalfantasy.it
Sat Aug 23 10:41:35 CEST 2003


Alle 23:29, venerdì 22 agosto 2003, Arpi ha scritto:
> Hi,
>
> > This is my first attept on writing something more complicated that
> > printf("Hello world\n"); in linux and I make also a mistake (at the end,
> > when i fill my hard disk of targa images and check the correct write of
> > the file (whithout check the program!!)
> >
> > The patch correct the problem.(I invert count and size of the fwrite(...)
> > call.)
> >
> > Doing the tiling as a filter has the advantage that you can output in the
> > format you like (jpeg, png) but it changes fps: is possible to do this
> > without problems?
>
> If you don't play sound (usually you don't when converting to files) then
> it's ok.
>
> Also you could left out the scaling, use -vf scale=x:y (with quarter size
> if want that) instead.

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.

>
> > 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.

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.

In the other frame i need (if i enable the index output) only a quarter size 
of the image (that i get making a subsample of 4x4 pixel of the Y plane and 
of 2x2 of the u/v plane).

If you enable only the snap output you got, say, one image file every 50 or 
100 input frame (and this is the reason why i do this module: to have some 
significative frame).

If I want to make only the tga output like, say for example, the jpeg module 
is correct and surely efficent make the conversion in the vf layer, every 
frame that come out from the input stream in YUV must be converted and 
written.

In the case of this module you don't need alway the conversion and sometimes 
you need the scaling.

I normally use this with or only the index enable (and so i never need the 
full bgr frame, only the small one (8x8) Y to check the difference and the 
small (4x4) bgr miniature) or only the snap enable (and i need the small 8x8 
Y always and, sometimes, the full bgr image).

The conversion yuv -> bgr done before the video output is surely easy to use 
but may be often non necessary.

It all start, as i say in the little doc file, to have some wallpaper and the 
first try was to output only 1 frame every 25 in the jpeg module.

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.

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.

In this phase shall be useful see all the frame and the condition that make 
the filter accept or reject the frame (that's one of the reason i make all 
this filter).

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.

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)

BTW the program is very very good, before i was a fan of Xine but now i use 
always mplayer.

Is very good to digit 'mplayer dvd://1' and see the film you want, without all 
the mess you got at the begin, 5 minutes to see a 22 minutes telefilm!

I good only some problem when i see Aliens and the film was on the track 33! 
I try all the track, one by one, i was a really newbee, don't know the 
existence of the for in the bash shell, ...)

	Daniele Forghieri 

>
>
> A'rpi / Astral & ESP-team
>
> --
> Developer of MPlayer G2, the Movie Framework for all -
> http://www.MPlayerHQ.hu
>
> _______________________________________________
> MPlayer-dev-eng mailing list
> MPlayer-dev-eng at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-dev-eng




More information about the MPlayer-dev-eng mailing list