2012-04-06 27 views
5

मैं PHP
के साथ अपलोड होने से पहले किसी भी वीडियो फ़ाइल की अवधि का पता लगाने की कोशिश कर रहा हूं, इसलिए यदि यह एक मिनट से भी कम है तो उदाहरण के लिए मैं इसे अपलोड करने से इंकार कर दूंगा।
यदि यह संभव नहीं है, तो वीडियो अपलोड करने के बाद मैं इसे कैसे कर सकता हूं ??PHP के साथ मिनटों में मैं वीडियो फ़ाइल अवधि का पता कैसे लगा सकता हूं?

+0

क्षमा करें कोई नहीं है .. आपको पहले फ़ाइल अपलोड करने की आवश्यकता है: डी – Baba

+0

@ बाबा और फ़ाइल अपलोड करने के बाद मैं इसे कैसे कर सकता हूं? –

+0

एचएम वास्तव में वीडियो के बारे में निश्चित नहीं है लेकिन ऑडियो के लिए यह काम करता है। GetID3 http://getid3.sourceforge.net/ आज़माएं। कुछ कक्षाएं हैं जिनका उपयोग मूल वीडियो डेटा प्राप्त करने के लिए किया जा सकता है। – StudioArena

उत्तर

14

आप ffmpeg या getID3

उदाहरण के साथ video duration प्राप्त कर सकते हैं

$getID3 = new getID3; 
$file = $getID3->analyze($filename); 
echo("Duration: ".$file['playtime_string']. 
     "/Dimensions: ".$file['video']['resolution_x']." wide by ".$file['video']['resolution_y']." tall". 
     "/Filesize: ".$file['filesize']." bytes<br />"); 

या

ob_start(); 
passthru("ffmpeg -i working_copy.flv 2>&1"); 
$duration = ob_get_contents(); 
$full = ob_get_contents(); 
ob_end_clean(); 
$search = "/duration.*?([0-9]{1,})/"; 
print_r($duration); 
$duration = preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 3); 
print_r('<pre>'); 
print_r($matches[1][0]); 
print_r($full); 

कृपया देखें

http://getid3.sourceforge.net/

http://ffmpeg.org/

How to get video duration, dimension and size in PHP?

get flv video length

धन्यवाद

: डी

+0

वह कह रहा है कि उसे अपलोड करने से पहले इसकी आवश्यकता है। धन्यवाद: डी – kommradHomer

+0

उसकी टिप्पणी देखें '@ बाबा और फ़ाइल अपलोड करने के बाद मैं इसे कैसे कर सकता हूं? - अयमान जीटन 6 मिनट पहले '@ कॉमराडहोमर – Baba

+0

वाह। मुझे – kommradHomer

0

इस बाहर की जाँच करने के लिए इस एक समाधान वर्ष 2017

के लिए एक छोटे से अधिक उन्नत है आने वाले लोगों के लिए
 first download the latest version from the first link above in the accepted answer the (green checkmark)   

    require_once('getid/getid3/getid3.php'); //path to your get id file if you do not include this in your file it will result in an error meaning the code will not work 
$file = "sade.mp4"; //what you want extract info from maybe mp3,or mp4 file anything you want to get file size in bytes or time duration 
$uuuuu = "videos/"; //path to your video file it could also be music not only video 
$getID3 = new getID3; //initialize engine 
$ThisFileInfo = $getID3->analyze($uuuuu.$file); 
getid3_lib::CopyTagsToComments($ThisFileInfo); 
echo '<pre>'.htmlentities(print_r($ThisFileInfo, true)).'</pre>'; //use this to print array to pick whatever you like that you want value like playduration, filesize 
संबंधित मुद्दे