record video with ffmpeg
This commit is contained in:
parent
e6967ab8cb
commit
0539ec8377
10
start.php
10
start.php
|
@ -12,13 +12,12 @@ while(TRUE)
|
|||
{
|
||||
if(($lastOnlineTime + 60) < time())
|
||||
{
|
||||
$fileName = "output-".md5(time().rand(11111,99999)).".mp4";
|
||||
$fileName = "output-".md5(time().rand(11111,99999)).".gif";
|
||||
$videoFileName = md5(time().rand(11111,99999)).".mp4";
|
||||
|
||||
echo "Checking stream and creating image...\n";
|
||||
//system("ffmpeg -i ".$StreamURL." -vframes 1 -q:v 2 -vf scale=535:346 ".$fileName);
|
||||
//system('ffmpeg -r 90 -t 4 -i '.$StreamURL.' -vf "fps=10,scale=350:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 '.$fileName);
|
||||
//system('ffmpeg -r 90 -t 4 -i '.$StreamURL.' -vf "fps=8,scale=420:-1" -loop 0 -pix_fmt yuv420p '.$fileName);
|
||||
system('ffmpeg -r 90 -t 6 -i '.$StreamURL.' -vf "fps=8,scale=420:-1" '.$fileName);
|
||||
system('ffmpeg -r 90 -t 4 -i '.$StreamURL.' -vf "fps=10,scale=350:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 '.$fileName);
|
||||
|
||||
if(is_file($fileName))
|
||||
{
|
||||
|
@ -55,7 +54,8 @@ while(TRUE)
|
|||
$result = file_get_contents($DiscordWebhook, false, stream_context_create($startOptions));
|
||||
echo "done.\n";
|
||||
|
||||
system("rtmpdump -r ".$StreamURL." -m 15 -o /dev/null");
|
||||
system("ffmpeg -rw_timeout 10000 -i ".$StreamURL." tmp/rtmp/".$videoFileName);
|
||||
//system("rtmpdump -r ".$StreamURL." -m 15 -o /dev/null");
|
||||
|
||||
echo "Sending end info to discord...";
|
||||
$result = file_get_contents($DiscordWebhook, false, stream_context_create($endOptions));
|
||||
|
|
Loading…
Reference in New Issue