mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Fix video uploads
This commit is contained in:
parent
6bf1c9bb29
commit
1b3052869f
3 changed files with 10 additions and 7 deletions
|
@ -14,7 +14,7 @@ abstract class Media extends Postable
|
||||||
unlink($this->pathFromHash($this->changes["hash"]));
|
unlink($this->pathFromHash($this->changes["hash"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBaseDir(): string
|
protected function getBaseDir(): string
|
||||||
{
|
{
|
||||||
$uploadSettings = OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"];
|
$uploadSettings = OPENVK_ROOT_CONF["openvk"]["preferences"]["uploads"];
|
||||||
if($uploadSettings["mode"] === "server" && $uploadSettings["server"]["kind"] === "cdn")
|
if($uploadSettings["mode"] === "server" && $uploadSettings["server"]["kind"] === "cdn")
|
||||||
|
|
|
@ -24,7 +24,8 @@ class Video extends Media
|
||||||
if(!is_dir($dirId = $this->pathFromHash($hash)))
|
if(!is_dir($dirId = $this->pathFromHash($hash)))
|
||||||
mkdir($dirId);
|
mkdir($dirId);
|
||||||
|
|
||||||
Shell::bash(__DIR__ . "/../shell/processVideo.sh", OPENVK_ROOT, $filename, $hash)->start(); #async :DDD
|
$dir = $this->getBaseDir();
|
||||||
|
Shell::bash(__DIR__ . "/../shell/processVideo.sh", OPENVK_ROOT, $filename, $dir, $hash)->start(); #async :DDD
|
||||||
} catch(ShellUnavailableException $suex) {
|
} catch(ShellUnavailableException $suex) {
|
||||||
exit(OPENVK_ROOT_CONF["openvk"]["debug"] ? "Shell is unavailable" : VIDEOS_FRIENDLY_ERROR);
|
exit(OPENVK_ROOT_CONF["openvk"]["debug"] ? "Shell is unavailable" : VIDEOS_FRIENDLY_ERROR);
|
||||||
} catch(UnknownCommandException $ucex) {
|
} catch(UnknownCommandException $ucex) {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
tmpfile="$RANDOM-$(date +%s%N)"
|
tmpfile="$RANDOM-$(date +%s%N)"
|
||||||
|
|
||||||
cp $2 "/tmp/vid_$tmpfile.bin"
|
cp $2 "/tmp/vid_$tmpfile.bin"
|
||||||
cp ../files/video/rendering.apng $1/storage/${3:0:2}/$3.gif
|
cp ../files/video/rendering.apng $3${4:0:2}/$4.gif
|
||||||
cp ../files/video/rendering.ogv $1/storage/${3:0:2}/$3.ogv
|
cp ../files/video/rendering.ogv $3/${4:0:2}/$4.ogv
|
||||||
|
|
||||||
nice ffmpeg -i "/tmp/vid_$tmpfile.bin" -ss 00:00:01.000 -vframes 1 $1/storage/${3:0:2}/$3.gif
|
nice ffmpeg -i "/tmp/vid_$tmpfile.bin" -ss 00:00:01.000 -vframes 1 $3${4:0:2}/$4.gif
|
||||||
nice -n 20 ffmpeg -i "/tmp/vid_$tmpfile.bin" -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 -vf scale=640x360,setsar=1:1 -y "/tmp/ffmOi$tmpfile.ogv"
|
nice -n 20 ffmpeg -i "/tmp/vid_$tmpfile.bin" -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 -vf scale=640x360,setsar=1:1 -y "/tmp/ffmOi$tmpfile.ogv"
|
||||||
|
|
||||||
cp "/tmp/ffmOi$tmpfile.ogv" $1/storage/${3:0:2}/$3.ogv
|
rm -rf $3${4:0:2}/$4.ogv
|
||||||
|
mv "/tmp/ffmOi$tmpfile.ogv" $3${4:0:2}/$4.ogv
|
||||||
|
|
||||||
rm -f "/tmp/ffmOi$tmpfile.ogv"
|
rm -f "/tmp/ffmOi$tmpfile.ogv"
|
||||||
rm -f "/tmp/vid_$tmpfile.bin"
|
rm -f "/tmp/vid_$tmpfile.bin"
|
||||||
|
|
Loading…
Reference in a new issue