mencoder integration

nothingmuch

Joined: 2003-08-30
Posts: 1
Posted: Sat, 2003-08-30 20:32

I don't get along well with php, but I would like mencoder integration if possible...

I do, however, provide, enclosed, the commands for mencoder, and their associate configuration variables in a shell like manner.

Mencoder allows choosing keyframes, and performing various operations on movie data.

To extract a frame, specified by $HOURS, $MINUTES, $SECONDS, and $FRAMES, where $M is the movie file (mplayer can grok nearly anything - avis, movs, mpegs, asf...), and $OPTS is discussed later, into a jpg you do:

mplayer -vo jpeg -frames 1+$FRAMES -ss $HOURS:$MINUTES:$SECONDS $OPTS $M

this will create $FRAMES files, which will be squentially named. The desired one may be accessed using the filename printf("%08.d.jpg",$FRAMES).

various options may be passed using the -jpeg option. I reckon

-jpeg quality=100,smooth=0,optimise=0

should create adequate images to pass on to netpbm or ImageMagick. The user should have the option to force mplayer to receive a generally made movie made with mencoder in case mplayer cannot read it right.

next, several commands are available for processing:

mencoder $FILTER -oac $ACODEC $ACODECOPTS -ovc $VCODEC $VCODECOPTS $M

where $ACODEC should have 'copy', $ACODECOPTS should be empty, $VCODEC should be 'lavc', $VCODECOPTS should be 'vcodec=mpeg4:vhq:v4mv:mbd=2' as a default. These will create a reasonably small, reasonably good looking video file, when the resolution and the size are not too large. Movie previews can be generated with -frames for a certain limit of frames, and scaling applied. the lavc option "vbitrate" can be tuned down, etc. All these values should, ofcourse, be user settable.

$FILTER contains the processing options, and hould have a user settable post processing part, probably 'hqdn3d,pp', which is put after the command driven filter.

These can be things like "crop=$w:$h:$x:$y,rotate=$d,mirror,flip" and so forth. The above string will apply them in order.

$d is for 90 degree increments. $x and $y the offsets for the crop, which is by default computed so that the crop is centered.

A default filter should also be present. My digital camera, for example, creates humungus mov files, which i have mencoder using a small shell script. I'd like to be able to have gallery shrink the movies automatically. FYI, mencoder converts them well, but mplayer doesn't view the originals as it should, so the default thing may be a good choice if the user reports bad results.

I reckon you could look up more specific info within man mplayer.

Thank you.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2005-07-11 13:53

If you have mplayer try mattyb's Mplayer mod for movie thumbnails