Commit 9c08e4ec authored by carboncrafters's avatar carboncrafters

filesystem changes

parent 82b29781
......@@ -121,18 +121,18 @@ $conn->close();
}
mkdir($path) or die("lol wtf");
$lpath = "/onetb/web/cdn.emalm.com/convert/$name/$namext";
$lpath = "/sas-0-900gb/web/cdn.emalm.com/convert/$name/$namext";
}else {echo "the file was bigger than ".$size." kB!\n";}}
switch (!empty($_GET["to"])) {
case 'webm':
$to = 'webm';
$command = "ffmpeg -i $lpath -c:v libvpx-vp9 $crf -vf \"".$scale."setsar=1:1\" -tile-columns 3 -error-resilient 1 -static-thresh 0 -cpu-used 1 -threads 16 -row-mt 1 -c:a libvorbis -metadata comment=\"Converted with the Emalm video converting service on: $currtm \" /onetb/web/cdn.emalm.com/convert/$name/$filn.webm 2> /onetb/web/cdn.emalm.com/convert/out_webm.txt &";
$command = "ffmpeg -i $lpath -c:v libvpx-vp9 $crf -vf \"".$scale."setsar=1:1\" -tile-columns 3 -error-resilient 1 -static-thresh 0 -cpu-used 1 -threads 16 -row-mt 1 -c:a libvorbis -metadata comment=\"Converted with the Emalm video converting service on: $currtm \" /sas-0-900gb/web/cdn.emalm.com/convert/$name/$filn.webm 2> /sas-0-900gb/web/cdn.emalm.com/convert/out_webm.txt &";
break;
case 'mp4': $to = 'mp4';
default:
$command = "ffmpeg -i $lpath -c:v libvpx-vp9 $crf -vf \"".$scale."setsar=1:1\" -tile-columns 3 -error-resilient 1 -static-thresh 0 -cpu-used 1 -threads 16 -row-mt 1 -c:a libvorbis -metadata comment=\"Converted with the Emalm video converting service on: $currtm \" /onetb/web/cdn.emalm.com/convert/$name/$filn.webm 2> /onetb/web/cdn.emalm.com/convert/out_webm.txt &";
$command = "ffmpeg -i $lpath -c:v libvpx-vp9 $crf -vf \"".$scale."setsar=1:1\" -tile-columns 3 -error-resilient 1 -static-thresh 0 -cpu-used 1 -threads 16 -row-mt 1 -c:a libvorbis -metadata comment=\"Converted with the Emalm video converting service on: $currtm \" /sas-0-900gb/web/cdn.emalm.com/convert/$name/$filn.webm 2> /sas-0-900gb/web/cdn.emalm.com/convert/out_webm.txt &";
$to = 'webm';
break;
}
......@@ -144,7 +144,7 @@ $conn->close();
$jsonout = implode("\n",$jsonout);
$filedata = json_decode($jsonout,true);
$file = fopen("/onetb/web/cdn.emalm.com/json/convert/data/$name.json","w+");
$file = fopen("/sas-0-900gb/web/cdn.emalm.com/json/convert/data/$name.json","w+");
$tmp = explode("/",$filedata["format"]["filename"]);
$filedata["format"]["filename"] = end($tmp);
......@@ -164,7 +164,7 @@ $conn->close();
if ($conn->query($sql) === TRUE) {
echo "in da database";
pclose(popen($command,"r"));
pclose(popen("ffmpeg -i $lpath -ss 00:00:1.435 -vframes 1 /onetb/web/cdn.emalm.com/convert/$name/defconv.jpg","r"));
pclose(popen("ffmpeg -i $lpath -ss 00:00:1.435 -vframes 1 /sas-0-900gb/web/cdn.emalm.com/convert/$name/defconv.jpg","r"));
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
......
......@@ -29,8 +29,8 @@ while(($row = $result->fetch_assoc()) ) {
$filn = $row["id"];
$file = "/onetb/web/cdn.emalm.com/video/$filn/$fileName";
$base = "/onetb/web/cdn.emalm.com/video/$filn";
$file = "/sas-0-900gb/web/cdn.emalm.com/video/$filn/$fileName";
$base = "/sas-0-900gb/web/cdn.emalm.com/video/$filn";
exec("ffprobe -v quiet -print_format json -show_format -show_streams $file &", $jsonout);
$jsonout = implode("\n",$jsonout);
......
......@@ -114,24 +114,24 @@ if ($moveResult != true) {
goto end;
}else{
//convert the image
$cdn = "/onetb/web/cdn.emalm.com/image/";
$cdn = "/sas-0-900gb/web/cdn.emalm.com/image/";
if ("svg" == $fileExt) {
$bsw = $filn.".".$fileExt;
copy($_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$fileName , $_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$filn.".".$fileExt );
}else if( ("gif" == $fileExt)||("GIF" == $fileExt)){
copy($_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$fileName , $_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$filn.".".$fileExt );
pclose(popen("optipng ".$cdn.$filn."/".$filn.".".$fileExt,"r"));
pclose(popen("optipng ".$cdn.$filn."/".$filn.".".$fileExt." &","r"));
//-resize 70% -coalesce -fuzz 6% +dither -layers Optimize
pclose(popen("convert ".$cdn.$filn."/".$fileName." -resize 90% -coalesce -fuzz 6% +dither -layers Optimize ".$cdn.$filn."/".$filn.".".$fileExt,"r"));
pclose(popen("ffmpeg -i $cdn$filn/$fileName -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p -vf \"pad=ceil(iw/2)*2:ceil(ih/2)*2\" $cdn$filn/$filn.mp4","r"));
pclose(popen("ffmpeg -i $cdn$filn/$fileName -c vp9 -b:v 0 -crf 41 $cdn$filn/$filn.webm","r"));
pclose(popen("convert ".$cdn.$filn."/".$fileName." -resize 90% -coalesce -fuzz 6% +dither -layers Optimize ".$cdn.$filn."/".$filn."$fileExt &","r"));
pclose(popen("ffmpeg -i $cdn$filn/$fileName -b:v 0 -crf 25 -f mp4 -vcodec libx264 -pix_fmt yuv420p -vf \"pad=ceil(iw/2)*2:ceil(ih/2)*2\" $cdn$filn/$filn.mp4 &","r"));
pclose(popen("ffmpeg -i $cdn$filn/$fileName -c vp9 -b:v 0 -crf 41 $cdn$filn/$filn.webm &","r"));
$bsw = $filn.".".$fileExt;
}else{
//this has to be changed later
//
exec("cwebp -q 80 ".$cdn.$filn."/".$fileName." -o ".$cdn.$filn."/".$filn.".webp");
exec("cwebp -q 80 ".$cdn.$filn."/".$fileName." -o ".$cdn.$filn."/".$filn.".webp &");
if (("jpg" == $fileExt)||("jpeg" == $fileExt)||("JPG" == $fileExt)||("JPEG" == $fileExt)) {
copy($_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$fileName , $_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$filn.".".$fileExt );
exec("jpegoptim ".$cdn.$filn."/".$filn.".".$fileExt);
......@@ -139,16 +139,16 @@ if ($moveResult != true) {
} else if (("TIF" == $fileExt)||("tif" == $fileExt)||("TIFF" == $fileExt)||("tiff" == $fileExt)||("PNM" == $fileExt)||("pnm" == $fileExt)||("bmp" == $fileExt)||("BMP" == $fileExt)||("PNG" == $fileExt)||("png" == $fileExt)) {
copy($_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$fileName , $_SERVER['DOCUMENT_ROOT']."cdn/image/".$filn."/".$filn.".".$fileExt );
exec("optipng ".$cdn.$filn."/".$filn.".".$fileExt);
exec("optipng ".$cdn.$filn."/".$filn.".".$fileExt." &");
//convert to jpg as well
exec("convert ".$cdn.$filn."/".$fileName." ".$cdn.$filn."/".$filn.".jpg && jpegoptim ".$cdn.$filn."/".$filn.".jpg");
exec("convert ".$cdn.$filn."/".$fileName." ".$cdn.$filn."/".$filn.".jpg && jpegoptim ".$cdn.$filn."/".$filn.".jpg &");
if (("bmp" == $fileExt)||("bmp" == $fileExt)) {
exec("cwebp -q 80 ".$cdn.$filn."/".$filn.".jpg -o ".$cdn.$filn."/".$filn.".webp");
exec("cwebp -q 80 ".$cdn.$filn."/".$filn.".jpg -o ".$cdn.$filn."/".$filn.".webp &");
}
$bsw = $filn.".jpg";
} else {
exec("convert ".$cdn.$filn."/".$fileName." ".$cdn.$filn."/".$filn.".jpg && jpegoptim ".$cdn.$filn."/".$filn.".jpg");
exec("convert ".$cdn.$filn."/".$fileName." ".$cdn.$filn."/".$filn.".jpg && jpegoptim ".$cdn.$filn."/".$filn.".jpg &");
$bsw = $filn.".jpg";
}
......
......@@ -106,17 +106,14 @@ $mime = mime_content_type($fileTmpLoc);
mkdir($_SERVER["DOCUMENT_ROOT"]."cdn/video/".$filn) or die('bruh');
sleep(5);
$cdn = "/onetb/web/cdn.emalm.com/video";
$cdn = "/sas-0-900gb/web/cdn.emalm.com/video";
if (move_uploaded_file($fileTmpLoc, $_SERVER["DOCUMENT_ROOT"]."cdn/video/$filn/$fileName")){
//$orig ="/v/$filn/$fileName";
$file = "/onetb/web/cdn.emalm.com/video/$filn/$fileName";
$base = "/onetb/web/cdn.emalm.com/video/$filn";
$file = $cdn."/$filn/$fileName";
$base = $cdn."/$filn";
exec("ffprobe -v quiet -print_format json -show_format -show_streams $file", $jsonout);
$jsonout = implode("\n",$jsonout);
//echo $jsonout;
$filedata = json_decode($jsonout,true);
//$file = fopen("/onetb/web/cdn.emalm.com/json/convert/data/$name.json","w+");
//print_r($filedata);
$a=0;
$currtm = date('c');
while ($a < $filedata["format"]["nb_streams"] ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment