php - How to get the duration of the video uploaded? -


I am using ffmpeg to convert videos into desired formats and generate thumbnails ..

I want to find the total duration of the video to appear in the main page with thumbnails.

Whether I have uploaded it at the time and database to store the duration for ffmpeg I can use P>

Is DB required to save the duration or is there any other method?

Take a look at this:

Below are some answers to that page The snippet of code that works for a certain user. I have to admit that I have not tested it, so it is entirely up to you:

  $ videofile = "/ var / video / user_videos / partofvideo.avi"; Ob_start (); Pistol ("/ usr / bin / ffmpeg -i \" {$ videofile} \ "2 & gt; and 1"); $ Period = ob_get_contents (); Ob_end_clean (); $ Search = '/ duration: (. *?), /'; $ Period = preg_match ($ search, $ period, $ match, PREG_OFFSET_CAPTURE, 3); // Test Echo match $ echo [1] [0];  

Hope it helps


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -