944,098 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3212
  • PHP RSS
Jan 5th, 2007
0

Get video file total time of playing using php

Expand Post »
hai friends
I have uploaded the video file to server .we need to get the total time of playing file duration and store the values to database. how can i get the total time for uploaded video file?

Please any one send me any idea.

Thanks
__________________
Thanks
Vssp
Last edited by vssp; Jan 5th, 2007 at 5:31 am. Reason: issue not clear
Similar Threads
Reputation Points: 5
Solved Threads: 5
Junior Poster
vssp is offline Offline
197 posts
since Jul 2006
Jan 6th, 2007
0

Re: Get video file total time of playing using php

Any one replay my issue
Reputation Points: 5
Solved Threads: 5
Junior Poster
vssp is offline Offline
197 posts
since Jul 2006
Jan 6th, 2007
0

Re: Get video file total time of playing using php

You can't do that with php alone without any external software, for example ffmpeg.
Reputation Points: 13
Solved Threads: 2
Junior Poster
php_daemon is offline Offline
138 posts
since Aug 2006
Dec 4th, 2010
0
Re: Get video file total time of playing using php
Hello VSSP.
I have solution to your problem.
Get ffmpeg
Now Extract it to your folder.
The Following Code will show you how you can get duration of Video file.
That one worked for me.
PHP Syntax (Toggle Plain Text)
  1. $file= "127808825101 Track 1.wma";
  2. ob_start();
  3.  
  4. passthru("ffmpeg.exe -i \"{$file}\" 2>&1"); //path to your ffmpeg.exe
  5. $duration = ob_get_contents();
  6. ob_end_clean();
  7.  
  8. //the full output:
  9. //echo $duration."<br/>";
  10.  
  11. $search='/Duration: (.*?)[.]/';
  12. $duration=preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE);
  13. $duration = $matches[1][0];
  14.  
  15. //i suppose that our video hasn't duration of a day+ :
  16. list($hours, $mins, $secs) = split('[:]', $duration);
  17.  
  18. echo "Hours: ".$hours." Minutes: ".$mins." Seconds: ".$secs;
Reputation Points: 11
Solved Threads: 4
Light Poster
chintan@dani is offline Offline
39 posts
since Jul 2010
Dec 4th, 2010
0

Get Time duration of video file

Click to Expand / Collapse  Quote originally posted by vssp ...
hai friends
I have uploaded the video file to server .we need to get the total time of playing file duration and store the values to database. how can i get the total time for uploaded video file?

Please any one send me any idea.

Thanks
__________________
Thanks
Vssp

View your answer to your post.
Reputation Points: 11
Solved Threads: 4
Light Poster
chintan@dani is offline Offline
39 posts
since Jul 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: A littel Problem
Next Thread in PHP Forum Timeline: php reset password issue





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC