Search
Search titles only
By:
Search titles only
By:
Forums
New posts
Search forums
What's new
New posts
Latest activity
Feedback
View Statistics
Members
Current visitors
Buy Sell Trade
WTB
Log in
Register
Search
Search titles only
By:
Search titles only
By:
New posts
Search forums
Menu
Install the app
Install
Reply to thread
Forums
Technology
Programming
Uploading, Grabbing Thumbnail and Displaying Videos in real time using PHP.
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="Arya" data-source="post: 348981" data-attributes="member: 5854"><p>Sorry cant find my old code, here are the snippets you could use. you need few other things as well...I've listed it below.</p><p></p><p>make a form</p><p></p><p>[PHP]</p><p></p><p><form action="uploadvid.php" method="post" name="form1"><label>File</label><input name="file1" type="file" /><input name="upload" type="submit" value="Upload" /></p><p></p><p></form><body>[/PHP]</p><p></p><p>Upload the file</p><p></p><p>[PHP]</p><p></p><p>//uploadvid.php</p><p></p><p>$yourfolder = 'some/folder';</p><p></p><p>$yourfile = $yourfolder . basename($_FILES['file1']['name']);</p><p></p><p>if(move_uploaded_file($_FILES['file1']['tmp_name'], $yourfile)) {</p><p></p><p> echo "Upload Successful...";</p><p></p><p> </p><p></p><p> $extn = explode(".", $_FILES['file1']['name']);</p><p></p><p> $filename = extn[0];</p><p></p><p> //convert uploaded vid to flv</p><p></p><p> exec(/usr/local/bin/ffmpeg -i " . $yourfile . " -acodec mp3 -ar 22050 -ab 32 -f flv -s 320×240 -y " . $yourfolder . $filename . ".flv");</p><p></p><p> //200x150 screenshot</p><p></p><p> exec("/usr/local/bin/ffmpeg -y -i " . $yourfolder . $filename . ".flv" . " -f mjpeg -ss 2 -vframes 1 -s " . "200" ."x". "150" . " -an " . $yourfolder. $filename . ".jpg";);</p><p></p><p> //code to display your screenshot and flv video using some video player</p><p></p><p>} </p><p></p><p>else{</p><p></p><p> die("Upload Failed");</p><p></p><p>}</p><p></p><p>[/PHP]</p><p></p><p>You need to install ffmpeg and lame encoder. you can test basic things with ffmpeg, but there will be no audio without lame.</p><p></p><p>p.s. : ended up writing it all over again. its from the manual and am on windows right now so cant test. let me know if anything doesnt work.</p></blockquote><p></p>
[QUOTE="Arya, post: 348981, member: 5854"] Sorry cant find my old code, here are the snippets you could use. you need few other things as well...I've listed it below. make a form [PHP] <form action="uploadvid.php" method="post" name="form1"><label>File</label><input name="file1" type="file" /><input name="upload" type="submit" value="Upload" /> </form><body>[/PHP] Upload the file [PHP] //uploadvid.php $yourfolder = 'some/folder'; $yourfile = $yourfolder . basename($_FILES['file1']['name']); if(move_uploaded_file($_FILES['file1']['tmp_name'], $yourfile)) { echo "Upload Successful..."; $extn = explode(".", $_FILES['file1']['name']); $filename = extn[0]; //convert uploaded vid to flv exec(/usr/local/bin/ffmpeg -i " . $yourfile . " -acodec mp3 -ar 22050 -ab 32 -f flv -s 320×240 -y " . $yourfolder . $filename . ".flv"); //200x150 screenshot exec("/usr/local/bin/ffmpeg -y -i " . $yourfolder . $filename . ".flv" . " -f mjpeg -ss 2 -vframes 1 -s " . "200" ."x". "150" . " -an " . $yourfolder. $filename . ".jpg";); //code to display your screenshot and flv video using some video player } else{ die("Upload Failed"); } [/PHP] You need to install ffmpeg and lame encoder. you can test basic things with ffmpeg, but there will be no audio without lame. p.s. : ended up writing it all over again. its from the manual and am on windows right now so cant test. let me know if anything doesnt work. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Technology
Programming
Uploading, Grabbing Thumbnail and Displaying Videos in real time using PHP.
Top
Bottom