Jump to content
php.lv forumi

par exec funkciju


Recommended Posts

Ir scripts, kas ljauj uploadot video failus, kad tas tiek uploadots to saak converteet ar ffmpeg. Convertaaciju izpilda ar exec funkciju, bet es sapratu, ka man vajag, lai scripts ietu taalaak (tuliit paskaidroshi)

Dotajaa mirklii man ir taa, upload form, es uploadoju(protams gaidu kameer tas notiek), tad saakas convertaacija(arii gaidu kameer tas notiek), bet vai nevareetu izdariit taa, lai tiek nosuutita komanda ka vajag converteet video, bet scripts pats iet taalaak?

 

p.s varbuut mazliet murgaini izteicu savu domu, bet nu citaadaak man neienaaca praataa ^^

 

Pagaidaam mans php izskataas shaads:

 

} elseif($_GET['action']=="save") {
echo '<table width="100%"><tr><td>';
$name=$_POST['name'];
$desc=nl2br($_POST['description']);
$file=$_FILES['file'];
$path="./movies/";
move_uploaded_file($file['tmp_name'], $path.$file['name']);
chmod($path.$file['name'], 0755);
$ffmpeg = "/usr/bin/nice -n 19 /usr/bin/ffmpeg";
$numbers = time() + "_" + rand(1000,9999);
$video_flv_convert = "./movies/".$numbers.".flv";
$video_image_convert = "./movies/".$numbers.".jpg";
$video_flv = ($numbers.".flv");
$video_image = ($numbers.".jpg");

$command = $ffmpeg." -i ".$path.$file['name']." -s 480x300 -f flv -r 30 -b 4000k -ar 44100 -ab 64 ".$video_flv_convert; 
$output= exec($command);
print "$output";

$command = $ffmpeg." -i ".$path.$file['name']." -s 480x300 -vcodec mjpeg -ss 3 -an -f rawvideo -vframes 1 ".$video_image_convert;
$output= exec($command);
print "$output";

unlink($path.$file['name']);
echo '</td></tr></table>';
mysql_query("INSERT INTO ".PREFIX."movies (movheadline, movdescription, movfile, movimage, movowner, comments) VALUES ('".$name."', '".$desc."', '".$video_flv."', '".$video_image."', '".$userID."', '1')");
echo('Video uploaded!');

Link to post
Share on other sites

manupraat to vajag atrisinaat ar ajax ...

failus uplaudot ar ajax1 un kad ir viens uplaudots ajax1 pasaka ajax2 ka ir fails uplaudots un ajax2 uzsaak konvertaaciju,

otrs variants ir upaudot parasti un serverii seezh cron kas ik sekundi cheko direktoriju un ja tur ir kaads video tad to paarkonvertee ...

varbuut ka ir kaadi savaadaaki veidi kaa noskaidrot vai mapee uzrodas jauns fails ...

Link to post
Share on other sites
×
×
  • Create New...