SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    May 2013
    Posts
    203
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    also how get full file path uri - length in seconds a video media file is like mp4

    using something like below how i get length in seconds a video media file is like mp4, ogg or webm?
    also how get full file path uri?

    Code:
    $directoryIterator = new RecursiveDirectoryIterator($path);
    
    $recursiveIterator = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::SELF_FIRST);
    	try {
    		foreach ($recursiveIterator as $file) {
    echo $file->getBasename();
    if ($file->isFile()) {
    echo " (" .$file->getSize(). " bytes)<br />";

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,184
    Mentioned
    17 Post(s)
    Tagged
    4 Thread(s)
    You would either need to use avconv or a service provider that is able to encode video. It is not a very pleasant and/or easy thing to setup yourself. It will be impossible to setup yourself if you're not able to compile/install new software on the end server. You will than also need permission to execute shell commands from PHP in order to run files through avconv. The world of video encoding is dark abyss unless you're very familiar with the standard technology stacks involved. If your asking this type of question it leads me to believe you would be better of with a service provider. Though I'm not sure if that would be worth it for just detecting the duration of a video.
    The only code I hate more than my own is everyone else's.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •