record stream
This commit is contained in:
parent
d8357811b2
commit
57774f78da
|
@ -2,7 +2,7 @@ FROM debian:latest
|
|||
|
||||
WORKDIR /root/
|
||||
|
||||
RUN apt-get update && apt-get install -y ffmpeg curl php-cli php-xml
|
||||
RUN apt-get update && apt-get install -y ffmpeg curl php-cli php-xml rtmpdump
|
||||
COPY start.sh /root/start.sh
|
||||
COPY config.php /root/config.php
|
||||
COPY start.php /root/start.php
|
||||
|
|
46
message.json
46
message.json
|
@ -1,22 +1,28 @@
|
|||
{
|
||||
"embeds": [
|
||||
{
|
||||
"title": "RTMP Stream Online!",
|
||||
"description": "Ein RTMP Stream ist jetzt online! Wenn du ihn dir anschauen willst, kannst du dies mit dem VLC Media Player tun.\nÖffne dazu den VLC Media Player, klicke oben links auf Medien und wähle Netzwerkstream. Dort trägst du dann folgene Adresse ein:\n\n%%adresse%%\n\n",
|
||||
"color": 2139936,
|
||||
"author": {
|
||||
"name": "RTMP Noticer",
|
||||
"url": "https://clatza.dev/Christopher/Discord-RTMP-Notice.git",
|
||||
"icon_url": "https://files.clatza.dev/Icons/git.png"
|
||||
},
|
||||
"image": {
|
||||
"url": "%%vorschau%%"
|
||||
},
|
||||
"thumbnail": {
|
||||
"url": "https://files.clatza.dev/Icons/vlc.png"
|
||||
}
|
||||
"embeds": [
|
||||
{
|
||||
"title": "RTMP Stream Online!",
|
||||
"description": "Ein RTMP Stream ist jetzt online! Wenn du ihn dir anschauen willst, kannst du dies mit dem VLC Media Player tun.\nÖffne dazu den VLC Media Player, klicke oben links auf Medien und wähle Netzwerkstream. Dort trägst du dann folgene Adresse ein:\n\n%%adresse%%\n",
|
||||
"color": 2139936,
|
||||
"author": {
|
||||
"name": "RTMP Noticer",
|
||||
"url": "https://clatza.dev/Christopher/Discord-RTMP-Notice.git",
|
||||
"icon_url": "https://files.clatza.dev/Icons/git.png"
|
||||
},
|
||||
"image": {
|
||||
"url": "%%vorschau%%"
|
||||
}
|
||||
],
|
||||
"username": "RTMP Noticer",
|
||||
"avatar_url": "https://files.clatza.dev/Icons/vlc.png"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "Stream wird aufgezeichnet.",
|
||||
"description": "Für diesen Stream steht eine Aufzeichnung bereit.\nDu kannst dir den Stream in den nächsten 48 Stunden erneut anschauen.\nÖffne dazu den VLC Media Player, klicke auf Medien -> Netzwerkstream und gebe dort folgene URL ein.\n\n%%downloadURL%%\n",
|
||||
"author": {
|
||||
"name": "RTMP Noticer",
|
||||
"url": "https://clatza.dev/Christopher/Discord-RTMP-Notice.git",
|
||||
"icon_url": "https://files.clatza.dev/Icons/git.png"
|
||||
}
|
||||
}
|
||||
],
|
||||
"username": "RTMP Noticer",
|
||||
"avatar_url": "https://files.clatza.dev/Icons/vlc.png"
|
||||
}
|
10
start.php
10
start.php
|
@ -10,9 +10,10 @@ $lastOnlineTime = 0;
|
|||
|
||||
while(TRUE)
|
||||
{
|
||||
if(($lastOnlineTime + 3600) < time())
|
||||
if(($lastOnlineTime + 60) < time())
|
||||
{
|
||||
$fileName = "output-".time().".jpg";
|
||||
$videoFileName = "record-".time().".dump";
|
||||
|
||||
echo "Checking stream and creating image...\n";
|
||||
system("ffmpeg -i ".$StreamURL." -vframes 1 -q:v 2 -vf scale=535:346 ".$fileName);
|
||||
|
@ -28,6 +29,7 @@ while(TRUE)
|
|||
|
||||
$jsonMessage = str_replace("%%adresse%%", $StreamURL, $jsonMessage);
|
||||
$jsonMessage = str_replace("%%vorschau%%", "https://files.clatza.dev/tmp/rtmp/".$fileName, $jsonMessage);
|
||||
$jsonMessage = str_replace("%%downloadURL%%", "https://files.clatza.dev/tmp/rtmp/".$videoFileName, $jsonMessage);
|
||||
|
||||
$options = [
|
||||
'http' => [
|
||||
|
@ -41,11 +43,15 @@ while(TRUE)
|
|||
echo "Sending info to discord...";
|
||||
$result = file_get_contents($DiscordWebhook, false, stream_context_create($options));
|
||||
echo "done.\n";
|
||||
|
||||
echo "Start Recording...";
|
||||
system("rtmpdump -r ".$StreamURL." -m 30 -o tmp/rtmp/".$videoFileName);
|
||||
echo "done.";
|
||||
}else{
|
||||
echo "ERROR: Image not generated!\n";
|
||||
}
|
||||
}else{
|
||||
echo "Wait for next check ... ( ".(($lastOnlineTime + 3600) - time()).")\n";
|
||||
echo "Wait for next check ... ( ".(($lastOnlineTime + 60) - time()).")\n";
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue