diff --git a/bin/ffmpeg b/bin/ffmpeg
old mode 100644
new mode 100755
diff --git a/models/pictsharemodel.php b/models/pictsharemodel.php
index 7aaf67f..c88d643 100644
--- a/models/pictsharemodel.php
+++ b/models/pictsharemodel.php
@@ -853,7 +853,7 @@ class PictshareModel extends Model
switch($type)
{
case 'mp4':
- $addition = '-c:v libx264';
+ $addition = '-c:v libx264 -profile:v baseline -level 3.0 -pix_fmt yuv420p';
break;
}
diff --git a/template_mp4.php b/template_mp4.php
index dbcdfc8..1e2f1ee 100644
--- a/template_mp4.php
+++ b/template_mp4.php
@@ -40,8 +40,12 @@
diff --git a/tools/re-encode_mp4.php b/tools/re-encode_mp4.php
new file mode 100644
index 0000000..7e70828
--- /dev/null
+++ b/tools/re-encode_mp4.php
@@ -0,0 +1,109 @@
+isTypeAllowed($type);
+ if($type=='mp4')
+ $localfiles[] = $filename;
+}
+
+if(count($localfiles)==0) exit('No MP4 files found'."\n");
+
+echo " done. Got ".count($localfiles)." files\n";
+
+echo "[i] Starting to convert\n";
+foreach($localfiles as $hash)
+{
+ $img = $dir.$hash.DS.$hash;
+ $tmp = ROOT.DS.'tmp'.DS.$hash;
+ if(file_exists($tmp) && $allowskipping==true)
+ echo "Skipping $hash\n";
+ else
+ {
+ $cmd = "../bin/ffmpeg -y -i $img -loglevel panic -vcodec libx264 -an -profile:v baseline -level 3.0 -pix_fmt yuv420p -vf \"scale=trunc(iw/2)*2:trunc(ih/2)*2\" $tmp && cp $tmp $img";
+ echo " [i] Converting $hash";
+ system($cmd);
+ echo "\tdone\n";
+ }
+
+ if(in_array('ogg',$argv))
+ {
+ $tmp = ROOT.DS.'tmp'.DS.$hash.'.ogg';
+ $ogg = $dir.$hash.DS.'ogg_1.'.$hash;
+ if(file_exists($ogg) && $allowskipping==true)
+ echo "Skipping OGG of $hash\n";
+ else
+ {
+ echo " [OGG] User wants OGG. Will do.. ";
+ $cmd = "../bin/ffmpeg -y -i $img -loglevel panic -vcodec libtheora -an $tmp && cp $tmp $ogg";
+ system($cmd);
+ echo "done\n";
+ }
+ }
+
+ if(in_array('webm',$argv))
+ {
+ $tmp = ROOT.DS.'tmp'.DS.$hash.'.webm';
+ $webm = $dir.$hash.DS.'webm_1.'.$hash;
+ if(file_exists($webm) && $allowskipping==true)
+ echo "Skipping WEBM of $hash\n";
+ else
+ {
+ echo " [WEBM] User wants WEBM. Will do.. ";
+ $cmd = "../bin/ffmpeg -y -i $img -loglevel panic -c:v libvpx -crf 10 -b:v 1M $tmp && cp $tmp $webm";
+ system($cmd);
+ echo "done\n";
+ }
+ }
+
+
+}
+
+
+function renderSize($bytes, $precision = 2) {
+ $units = array('B', 'KB', 'MB', 'GB', 'TB');
+
+ $bytes = max($bytes, 0);
+ $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
+ $pow = min($pow, count($units) - 1);
+
+ // Uncomment one of the following alternatives
+ $bytes /= pow(1024, $pow);
+ // $bytes /= (1 << (10 * $pow));
+
+ return round($bytes, $precision) . ' ' . $units[$pow];
+}
\ No newline at end of file
diff --git a/upload/.gitignore b/upload/.gitignore
old mode 100644
new mode 100755
diff --git a/upload/.htaccess b/upload/.htaccess
old mode 100644
new mode 100755
diff --git a/upload/deletecodes/.gitignore b/upload/deletecodes/.gitignore
old mode 100644
new mode 100755