how can i use the ffmpeg in yii?

i have wamp installed and i want ffmpeg to make the thumbnails of the videos i upload to the site.

how will i use it in yii?

which class i have to extend?

ps: i want to make thumbnail after the file is uploaded, not when the file is viewed.

any idea? or something

Depends on how and where you want that processing to happen…

Is it something you’re going to re-use in various places, or is it something that you’re just going to have run through a single point of entry/display?

At the most basic level, you could simply add a method to your upload form model that calls ffmpeg and runs the process ( make it a process behavior that you attach to the model perhaps ).

Are you processing on the fly or are you queueing the items up to batch? That will also make a difference in how you handle it.

thanks dana for the reply, i have encountered the problem by using a compiled version of ffmpeg(got from a friend) and added it to my site directory. i have used the controller to execute the ffmpeg commands and generated the thumbnails.

currently i have created this so far

 private function mediaHandler($file,$width,$height){


        $sitePath = str_replace('/','\\',$_SERVER['DOCUMENT_ROOT']);

        $basePath = $sitePath."mySite\\";

        $ffmpegPath = $basePath."ffmpeg\\ffmpeg\\";

        $videoPath = $basePath."media\\videos\\";

        $thumbsPath = $videoPath."thumbs\\";

        $frameRate = 29;

        $bitRate = 22050;

        $size = $width.'x'.$height;

        $outfilename = substr($file,0,strlen($file)-4);

        $outfilename = $outfilename.'.flv';

        $thumbname = $outfilename.'.jpg';

        //convert the video to flv

        $ffmpegcmd1 = $ffmpegPath."ffmpeg.exe -y -i \"".$videoPath.$file."\" -s ".$size." -ar ".$bitRate." -r ".$frameRate. " \"".$videoPath.$outfilename."\"";

        $ret = shell_exec($ffmpegcmd1);


        // get the image of file

        $ffmpegcmd2 = $ffmpegPath."ffmpeg.exe -y -ss 00:00:05 -vframes 1 -i \"".$videoPath.$file."\" -s ".$size." -f image2  \"".$thumbsPath.$thumbname."\"";

        $ret = shell_exec($ffmpegcmd2);


this works fine but now what i want is to use a progress bar to show the upload progress to user

Plus: i have a common controller to upload pics and videos, is there an extension to handle both with validation?