Zvětšení kompresního poměru

master
David Zálešák 4 years ago
parent 5aac1c0f41
commit e096b6facc

@ -22,7 +22,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
} else { } else {
do { do {
$generatedFileName = generateRandomString(); $generatedFileName = generateRandomString();
} while (file_exists("videos/" . $generatedFileName . "." . $extension)); } while (file_exists("./videos/" . $generatedFileName . "." . $extension));
move_uploaded_file( move_uploaded_file(
$_FILES["videoFile"]["tmp_name"], $_FILES["videoFile"]["tmp_name"],
@ -32,7 +32,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
$xml = $_POST["xmlFile"]; $xml = $_POST["xmlFile"];
$xml = str_replace("<video>", '<video src="' . $generatedFileName . '.' . $extension . '">', $xml); $xml = str_replace("<video>", '<video src="' . $generatedFileName . '.' . $extension . '">', $xml);
writeToFile("videos/" . $generatedFileName . ".xml", $xml); writeToFile("./videos/" . $generatedFileName . ".xml", $xml);
redirect("?v=" . $generatedFileName); redirect("?v=" . $generatedFileName);
} }
} else { } else {

@ -6,8 +6,8 @@ if [[ ! -f "ffmpeg2pass-0.log" ]]; then
nameWithoutExtension=$(echo $videoToConvert | sed 's/\..*//') nameWithoutExtension=$(echo $videoToConvert | sed 's/\..*//')
ffmpeg -i $videoToConvert -c:v libvpx-vp9 -b:v 0 -crf 10 -pass 1 -an -f null /dev/null && \ ffmpeg -i $videoToConvert -c:v libvpx-vp9 -b:v 0 -crf 35 -pass 1 -an -f null /dev/null && \
ffmpeg -i $videoToConvert -c:v libvpx-vp9 -b:v 0 -crf 10 -pass 2 -c:a libopus transcoding-$nameWithoutExtension.webm ffmpeg -i $videoToConvert -c:v libvpx-vp9 -b:v 0 -crf 35 -pass 2 -c:a libopus transcoding-$nameWithoutExtension.webm
mv transcoding-$nameWithoutExtension.webm c$nameWithoutExtension.webm mv transcoding-$nameWithoutExtension.webm c$nameWithoutExtension.webm