Duration of video

I use CUploadedFile to upload images and video. But if i want get the duration of uploaded file and the file is video, so how i can get the duration of video? Or any better widget that provided by yii can upload the video and images.

treat video and image as normal file ,this two file is usually in big size so change your php.ini settings to allow upload big size file (default is 2M) . there are many extensions for uploading search it with upload keywords

multiUpload and traditional file field activeFileField

to get the video duration you should use ffmpeg tool (with the php ffmpeg extension installed ), google it . get duration ffmpeg

ok.thx so much.

Another question about ffmpeg. Do ffmpeg can perform the file format conversion ? Because while i finding the way on conversion, 1 of the result is about ffmpeg

sure ! with ffmpeg you can convert almost any video file format to another . usually to .flv.

and you can scratch image from video too , just read the doc of ffmpeg doc (php.net also has api doc),

ok. Thanks a lot.

Sorry but, which player do you use for show videos?

yiqing, originally yii have install the ffmpeg ?

Sensorario, i have not yet done the player thr, now i want to convert all the video file into a same format, then only use a player to play it.

hi sensorario ::) :

in the internet we usually use the flash format , the jwplayer is a good choice , and there are some other js controlled flash player you can use too refer here open source online player

and if you want play most common video formats just thinking about this great jquery plugin jquery media plugin which can play the most seen video formats(aif,aiff,aac,au,bmp,gsm,mov,mid,midi,mpg,mpeg,mp4,m4a,psd,qt,qtif,qif,qti,snd,tif,tiff,wav,3g2,3pg; flv, mp3, swf; asx, asf, avi, wma, wmv; ra, ram, rm, rpm, rv, smi, smil; html, pdf…) ::)

Is thr any instruction to guide us install or extract the ffmpeg into yii ?

oh no ! :rolleyes:

you must install it your self , and then install the php extension . if you want use the cli to access it that is also ok : system ,exec. popen … can help you to access ffmpeg cli .

but you must have the privilege to run the system call from php. and can install the ffmpeg application to your machine .

this do not matter to yii , just use original php tech ,the ffmpeg have a php extension (.dll for windows and .so in *nix) , if you install the ffmpeg application (this is must be done first)then you can access it using the php extension api or use exec/system/popen to access it from cli ;