d22552000
-
Posts
535 -
Joined
-
Last visited
Never
Posts posted by d22552000
-
-
*********** IM AN IDIOT
In this form, for some idiotic reason, I forgot to put: "enctype="multipart/form-data"" in the form request...
(Trying with a 5mb mov file)
Now That I add that into it I get:
**A BUNCH OF UNDEFINED CONSTANTS**
I am an idiot and have looked at the code and fixed most undefined constants NOW I get...
(waiting for it to load...)
Notice: Undefined variable: Width in * on line 13 Notice: Undefined variable: Height in * on line 13 out_file.flv Notice: Undefined variable: thumbpath in * on line 63 Notice: Use of undefined constant rootpath - assumed 'rootpath' in * on line 34 sample.png Notice: Undefined variable: Path in * on line 27
I went over the code again to fix these undefined variables and now I get
**PROPER contents of the $_FILES array** C:\wamp\www\videoshare\ out_file.flv sample.png
The folders now have:
Folder: Default Files: None Folder: Flv Files: None new Folder: Thumb Files: None Folder: flvtool Files: None new Folder: ffmpeg Files: None new
So now there are no errors (OR EVEN NOTICES), but now the script doestn seem to make any file...
Current Code is:
<?php error_reporting(E_ALL); print_r($_FILES); function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) { $outfile = ""; $rPath = $rootpath."\\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = $width & "x" & $height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".$outfile; $ret = shell_exec($rPath."\\".$ffmpegcmd1); return $outfile; } function set_buffering($filename,$rootpath,$path) { $_rootPath = $rootpath."\\flvtool"; $ffmpegcmd1 = "flvtool2 -U ".$path."\\".$filename; $ret = shell_exec($_rootPath."\\".$ffmpegcmd1); } function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height) { $_rootpath = $rootpath."\\ffmpeg"; $size = $width."x".$height; $outfile = "sample.png"; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."\\".$outfile; $ret = shell_exec($_rootpath."\\".$ffmpegcmd1); return $outfile; } $rootpath = realpath(".\\");$rootpath.="\\"; $rootpath = str_replace('/','\\',$rootpath); echo $rootpath; $inputpath = $rootpath."\\Default"; $outputpath = $rootpath. "\\FLV"; $thumbpath = $rootpath. "\\Thumbs"; $source = $HTTP_POST_FILES['file1']['tmp_name']; $name = $HTTP_POST_FILES['file1']['name']; $fileSize = $HTTP_POST_FILES['file1']['size']; $filetype = $HTTP_POST_FILES['file1']['type']; $dest = ''; copy($source, $inputpath.$name); $outfile = convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050); echo "$outfile<br>"; $image_name = grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90); echo $image_name; Set_Buffering($outfile, $rootpath, $outputpath); ?>
-
you mean you didn't post/upload the file ?
I did, but it doesnt seem to think I did...
the form that uploads is:
index.php:
<form action="videos.php" method="POST"> <input type="file" name="file1" size="50" /> <input type="submit" name="submit" value="Upload!" /> </form>
videos.php:
<?php error_reporting(E_ALL); print_r($_FILES); function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) { $outfile = ""; $rPath = $rootpath."\\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = Width & "x" & Height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".$outfile; $ret = shell_exec($rPath."\\".$ffmpegcmd1); return $outfile; } function set_buffering($filename,$rootpath,$path) { $_rootPath = rootpath."\\flvtool"; $ffmpegcmd1 = "flvtool2 -U ".Path."\\".$filename; $ret = shell_exec($_rootPath."\\".$ffmpegcmd1); } function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height) { $_rootpath = rootpath."\\ffmpeg"; $size = width."x".height; $outfile = "sample.png"; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."\\".$outfile; $ret = shell_exec($_rootpath."\\".$ffmpegcmd1); return $outfile; } $rootpath = realpath(".\\");$rootpath.="\\"; $rootpath = str_replace('/','\\',$rootpath); echo $rootpath; $nputpath = $rootpath."\\Default"; $outputpath = $rootpath. "\\FLV"; $ThumbPath = $rootpath. "\\Thumbs"; $source = $HTTP_POST_FILES['file1']['tmp_name']; $name = $HTTP_POST_FILES['file1']['name']; $fileSize = $HTTP_POST_FILES['file1']['size']; $filetype = $HTTP_POST_FILES['file1']['type']; $dest = ''; copy($source, $inputpath.$name); $outfile = convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050); echo "$outfile<br>"; $image_name = grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90); echo $image_name; Set_Buffering($outfile, $rootpath, $outputpath); ?>
Related php.ini settings:
;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;; max_execution_time = 180 ; Maximum execution time of each script, in seconds max_input_time = 120 ; Maximum amount of time each script may spend parsing request data memory_limit = 128M ; Maximum amount of memory a script may consume (8MB) ;;;;;;;;;;;;;;;;; ; Data Handling ; ;;;;;;;;;;;;;;;;; ; ; Maximum size of POST data that PHP will accept. post_max_size = 128M ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). upload_tmp_dir = "C:/*/tmp" ; Maximum allowed size for uploaded files. upload_max_filesize = 128M
-
the form that submits the file to this has the following code:
<form action="videos.php" method="POST"> <input type="file" name="file1" size="50" /> <input type="submit" name="submit" value="Upload!" /> </form>
Soo IDK why file1 is undefined.
print_r($_FILES); returns:
Array ( )
so files is empty!?!?!?!?!?
I tried resending the form using a 5mb mov file and got:
Array ( )
Why wouldn't files being sent properly? I dont get it.
PHP_MAX_FILE_SIZE is over 50mb
PHP_MAX_MEM_SIZE is over 64mb
PHP_MAX_UPLOAD_SIZE is over 128mb
-
Well this explains it:
Notice: Undefined index: file1 in * on line 52 Notice: Undefined index: file1 in * on line 53 Notice: Undefined index: file1 in * on line 54 Notice: Undefined index: file1 in * on line 55 Notice: Undefined variable: inputpath in * on line 58 Notice: Undefined variable: inputpath in * on line 60 Notice: Use of undefined constant Width - assumed 'Width' in * on line 12 Notice: Use of undefined constant Height - assumed 'Height' in * on line 12 out_file.flv Notice: Undefined variable: thumbpath in * on line 62 Notice: Use of undefined constant rootpath - assumed 'rootpath' in * on line 33 Notice: Use of undefined constant width - assumed 'width' in * on line 34 Notice: Use of undefined constant height - assumed 'height' in * on line 34 Notice: Use of undefined constant filename - assumed 'filename' in * on line 38 sample.png Notice: Use of undefined constant rootpath - assumed 'rootpath' in * on line 24 Notice: Use of undefined constant Path - assumed 'Path' in * on line 26
-
ok I took your above code and used that;
my current code is:
<?php function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) { $outfile = ""; $rPath = $rootpath."\\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = Width & "x" & Height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".$outfile; $ret = shell_exec($rPath."\\".$ffmpegcmd1); return $outfile; } function set_buffering($filename,$rootpath,$path) { $_rootPath = rootpath."\\flvtool"; $ffmpegcmd1 = "flvtool2 -U ".Path."\\".$filename; $ret = shell_exec($_rootPath."\\".$ffmpegcmd1); } function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height) { $_rootpath = rootpath."\\ffmpeg"; $size = width."x".height; $outfile = "sample.png"; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."\\".$outfile; $ret = shell_exec($_rootpath."\\".$ffmpegcmd1); return $outfile; } $rootpath = realpath(".\\");$rootpath.="\\"; $rootpath = str_replace('/','\\',$rootpath); echo $rootpath; $nputpath = $rootpath."\\Default"; $outputpath = $rootpath. "\\FLV"; $ThumbPath = $rootpath. "\\Thumbs"; $source = $HTTP_POST_FILES['file1']['tmp_name']; $name = $HTTP_POST_FILES['file1']['name']; $fileSize = $HTTP_POST_FILES['file1']['size']; $filetype = $HTTP_POST_FILES['file1']['type']; $dest = ''; copy($source, $inputpath.$name); $outfile = convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050); echo "$outfile<br>"; $image_name = grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90); echo $image_name; Set_Buffering($outfile, $rootpath, $outputpath); ?>
I added a thing to show the real path instead of just a relative path, now it outputs:
C:\**PATH**\www\shares\video\ out_file.flv sample.png
Again, nothing is in any folder. No errors, hmm Im gonna set error reporting to notices and see if anything comes up...
-
kk I am now using:
<?php function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) { $outfile = ""; $rPath = $rootpath."\\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = Width & "x" & Height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".outfile; $ret = shell_exec($rPath."\\".$ffmpegcmd1); return $outfile; } function set_buffering($filename,$rootpath,$path) { $_rootPath = rootpath."\\flvtool"; $ffmpegcmd1 = "flvtool2 -U ".Path."\\".$filename; $ret = shell_exec($_rootPath."\\".$ffmpegcmd1); } function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height) { $_rootpath = rootpath."\\ffmpeg"; $size = width."x".height; $outfile = "sample.png"; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."\\".$outfile; $ret = shell_exec($_rootpath."\\".$ffmpegcmd1); return $outfile; } $rootpath =".\\"; $nputpath = $rootpath."\\Default"; $outputpath = $rootpath. "\\FLV"; $ThumbPath = $rootpath. "\\Thumbs"; $source = $HTTP_POST_FILES['file1']['tmp_name']; $name = $HTTP_POST_FILES['file1']['name']; $fileSize = $HTTP_POST_FILES['file1']['size']; $filetype = $HTTP_POST_FILES['file1']['type']; $dest = ''; copy($source, $inputpath.$name); $outfile = convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050); echo "$outfile<br>"; $image_name = grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90); echo $image_name; Set_Buffering($outfile, $rootpath, $outputpath); ?>
(I replaced all the slashes and shell_execs)
This outputs:
(waiting caues as I said above, its a 390 file im testing with)
out_file.flv sample.png
The default, flv, and thumb folders are:
EMPTY
-
hmm I noticed:
$outfile = ""; $rPath = $rootpath."\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = Width & "x" & Height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".outfile; $ret = shell_exec($ffmpegcmd1); return $outfile;
That there... hmm shouldnt shell_exec($ffmpegcmd1); be shell_exec($rPath."\\".$ffmpegcmd1);
-
since this is all in one file could you please tell me how to get it out of a class??
"class media_handler
{" remove that.. and "}"
and then remove what else to make it without a class?
ok I think its not a class no mroe:
<?php function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) { $outfile = ""; $rPath = $rootpath."\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = Width & "x" & Height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".outfile; $ret = shell_exec($ffmpegcmd1); return $outfile; } function set_buffering($filename,$rootpath,$path) { $_rootPath = rootpath."\\flvtool"; $ffmpegcmd1 = "flvtool2 -U ".Path."\\".$filename; $ret = shell_exec($ffmpegcmd1); } function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height) { $_rootpath = rootpath."\\ffmpeg"; $size = width. "x".height; $outfile = "sample.png"; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."\\".$outfile; $ret = shell_exec($ffmpegcmd1); return $outfile; } $rootpath ="./"; $nputpath = $rootpath."/Default"; $outputpath = $rootpath. "/FLV"; $ThumbPath = $rootpath. "/Thumbs"; $source = $HTTP_POST_FILES['file1']['tmp_name']; $name = $HTTP_POST_FILES['file1']['name']; $fileSize = $HTTP_POST_FILES['file1']['size']; $filetype = $HTTP_POST_FILES['file1']['type']; $dest = ''; copy($source, $inputpath.$name); $outfile = convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050); $image_name = grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90); Set_Buffering($outfile, $rootpath, $outputpath); ?>
I run it and get:
(lol..... 390mb file.... Waiting...) (I think it might time out)
oo I got:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD> <BODY></BODY></HTML>
And I look in the three folders, "DEFAULT" "FLV" and "THUMB" they have:
They Are EMPTY!
-
OMFG WOOT 400th post.
Ya sry, I bumped it cause it was halfway down the page when I posted "bump".
I used your code and:
(lol im testing it with a 390mb file cause I have no smaller movies)
Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\videoshare\videos.php on line 48
I fixed this...
$outputpath = $rootpath. "/FLV"; $ThumbPath = $rootpath. "/Thumbs";
Then I ran it again and got:
Fatal error: Call to undefined function convert_media() in C:\wamp\www\videoshare\videos.php on line 58
-
good idea
*WOOOOOOT* 399 Posts
-
*BUMPED*
-
also you should set a session so you don't get refreshing the page getting false records
if (!@session_id()) { session_start(); //CODE FOR COUNTER HERE } else { header('Location: '.$site); }
-
Parse error: syntax error, unexpected T_AS in C:\wamp\www\videoshare\videos.php on line 44
-
$loc = 'index.php';
header('Location: '.$loc);
-
This script is the only I have ever seen to properly convert files to FLV, I am doing everything else and will rewrite this code once I see what it does and how it works. I still ahve to make the entire portal and wbepages, including the hit counters and rating system. Not to mention the code I posted doesnt even do a thing with the file after making it lol.
I tried yoiur code and,...:
Parse error: syntax error, unexpected '}' in C:\wamp\www\videoshare\videos.php on line 44
It doesn't like your extra bracket... what I do now?
-
A nice file alternative is:
FOR PHP 5:
$site = $_GET["site"]; $hits = file_get_contents('.\\hits\\'.$site); if (empty($hits)) {$hits=0;} $hits += 1; file_put_contents('.\\hits\\'.$site,$hits); header('Location: ' . $site); exit();
FOR PHP 4:
$site = $_GET["site"]; $hit = fopen('.\\hits\\'.$site,'r'); $hits = fread($hit,64); fclose($hit); if (empty($hits)) {$hits=0;} $hits += 1; fopen('.\\hits\\'.$site,'w'); fwrite($hits); fclose(); header('Location: ' . $site); exit();
-
BUMP (Please help me out, im making a thing like youtube and I hate youtube cause its slow as **** and it uploads rlly slow) So I decided to make my OWN video sharing services (I already made a picture and photo sharing service, and a program sharing service) now just to make a video sharing service...
-
is it just me or does this script pull $save out of its ass...?
if(!copy($tmpPath,$save.$nameNew)){
I never saw "$save" anywhere in the document... (BEFORE THIS CODE)
-
Hmm how do I include a class:
$_mediahandler AS NEW media_handler;
that is the line it doesnt like (line 45). Here is the whole code:
<?php class media_handler { function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) { $outfile = ""; $rPath = $rootpath."\ffmpeg"; $size = $width."x".$height; $outfile =$filename; $size = Width & "x" & Height; $outfile = 'out_file.flv'; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".$filename. " -acodec mp3 -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."\\".outfile; $ret = shell_exec($ffmpegcmd1); return $outfile; } function set_buffering($filename,$rootpath,$path) { $_rootPath = rootpath."\\flvtool"; $ffmpegcmd1 = "flvtool2 -U ".Path."\\".$filename; $ret = shell_exec($ffmpegcmd1); } function grab_image($filename, $rootpath, $inputpath,$outputpath, $no_of_thumbs, $frame_number, $image_format, $width, $height) { $_rootpath = rootpath."\\ffmpeg"; $size = width. "x".height; $outfile = "sample.png"; $ffmpegcmd1 = "ffmpeg -i ".$inputpath."\\".filename." -vframes ".$no_of_thumbs." -ss 00:00:03 -an -vcodec ". $image_format." -f rawvideo -s ".$size. " ". $outputpath."\\".$outfile; $ret = shell_exec($ffmpegcmd1); return $outfile; } } $_mediahandler AS NEW media_handler; $rootpath ="./"; $nputpath = $rootpath."/Default"; $outputpath = $rootpath. "/FLV" $ThumbPath = $rootpath. "/Thumbs" $source = $HTTP_POST_FILES['file1']['tmp_name']; $name = $HTTP_POST_FILES['file1']['name']; $fileSize = $HTTP_POST_FILES['file1']['size']; $filetype = $HTTP_POST_FILES['file1']['type']; $dest = ''; copy($source, $inputpath . $name); $outfile = $_mediahandler.convert_media($name,$rootpath, $inputpath, $outputpath, 320, 240, 32, 22050); $image_name = $_mediahandler.grab_image($outfile, $rootpath, $outputpath, $thumbpath, 1, 2, "png", 110, 90) $_mediahandler.Set_Buffering($outfile, $rootpath, $outputpath) ?>
I did not make the code, and it had a few errors I had to fix (stupid things like not doing \\ and I need to use this code though, nothing on the entire intraweb was even close to this.
Please tell me why I cant use AS NEW? (PHP 5.2.4 *NEWEST*)
-
sweet, trying out fedora...
IIS DOES SUCK!!! USE APACHE WOOT
-
-
lol then give submit a value under the form....
<input type="submit" name="submit" value="yes"> then you can tell if its really that script sending it values, pretty simple really.
-
better code practise is to do:
if (!empty($_POST['submit'])) {
instead of
if (isset($_POST['submit'])) {
-
you could make your script check $REMOTE_ADDR against a list of proxies that you get from a proxylist.com
You can then manually add certain big proxies to it like proxyhost.com and hidemyass.com
Unexpected T_AS
in PHP Coding Help
Posted
also
DefaultLineTexture.mov
LineTexture.mov
now show up in the main folder...
I just made all of the paths realpath *using an expression regular replacement*
current code is:
current output is:
DefaultLineTexture.mov is in the main folder again.