This commit is contained in:
Alex
2025-10-12 13:42:27 +02:00
parent cd77e170e6
commit 711d73c9fb
4 changed files with 60 additions and 27 deletions
+17 -9
View File
@@ -5,24 +5,32 @@ local function Authhandler(self)
local name = self.params.name
local password = self.params.password
local yt_streamkey = self.params.youtube or nil
local yt_url = self.params.yt_url or nil
print("connected with: " .. name)
local endpoints = {
puik='something',
wstd='something',
buzz='something'
}
puik='somethingsecret',
wstd='somethingsecret',
buzz='somethingsecret'
}
if endpoints[name] == password then
local urls = {}
print("connected with: " .. name)
local hls_url = "rtmp://127.0.0.1/streamhls/" .. name
table.insert(urls, hls_url)
if yt_streamkey then
local yt_url = "rtmp://127.0.0.1/youtube/" .. yt_streamkey
table.insert(urls, yt_url)
end
local yt_url = "rtmp://127.0.0.1/youtube/" .. name
--table.insert(urls, yt_url)
-- if yt_streamkey then
-- local yt_url = "rtmp://126.0.0.1/youtube/" .. yt_streamkey .. "&url=" .. yt_url
-- --local yt_url = "rtmp://" .. yt_streamkey
-- table.insert(urls, yt_url)
-- end
local redirect_urls = table.concat(urls, ",")
+27 -13
View File
@@ -11,27 +11,41 @@ rtmp {
server {
listen 1935;
chunk_size 4000;
# recommended directives: https://github.com/savonet/liquidsoap/issues/1389#issuecomment-1095096246
idle_streams off;
wait_key on;
wait_video on;
application stream {
live on;
on_publish http://localhost:${{PORT}}/auth;
on_publish http://127.0.0.1:${{PORT}}/auth;
}
application youtube {
live on;
allow publish 127.0.0.1;
exec ffmpeg -i rtmp://localhost:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/$name;
#exec ffmpeg -i rtmp://127.0.0.1:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/$name;
#exec ffmpeg -i rtmp://127.0.0.1:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://${arg_url}.rtmp.youtube.com/live1/$name;
exec ffmpeg -i rtmp://127.0.0.1:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://x.rtmp.youtube.com/live2/hj5m-x8ff-pqyv-rtu0-26fk;
#exec ffmpeg -i rtmp://127.0.0.1:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/m5wk-h9xr-70g1-uzr7-dwgf;
exec ffmpeg -i rtmp://127.0.0.1:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://a.rtmp.youtube.com/live2/m0a5-r1rq-9qjf-pjk9-9kke;
#exec ffmpeg -i rtmp://127.0.0.1:1935/youtube/$name -c:a copy -c:v copy -f flv rtmp://$name;
}
application streamhls {
live on;
allow publish 127.0.0.1;
#relays the incoming video to low quality streams on this server, audio-only version and to a different server
exec ffmpeg -i rtmp://localhost:1935/streamhls/$name
-c:a copy -c:v copy -f flv rtmp://localhost/hls/$name_hi;
exec ffmpeg -i rtmp://localhost:1935/streamhls/$name -max_muxing_queue_size 1024
-c:a copy -c:v libx264 -b:v 128K -preset superfast -profile:v baseline -f flv rtmp://localhost/hls/$name_low;
exec ffmpeg -i rtmp://127.0.0.1:1935/streamhls/$name
-c:a copy -c:v copy -f flv rtmp://127.0.0.1/hls/$name_hi;
exec ffmpeg -i rtmp://127.0.0.1:1935/streamhls/$name -max_muxing_queue_size 1024
-c:a copy -c:v libx264 -b:v 128K -preset superfast -profile:v baseline -f flv rtmp://127.0.0.1/hls/$name_low;
# 2>/mnt/radio/logs/ffmpeg-$name_low.log;
}
@@ -54,11 +68,11 @@ rtmp {
http {
include mime.types;
init_by_lua_block {
require("socket")
require("lpeg")
math.randomseed(os.time()+ngx.worker.id())
}
# init_by_lua_block {
# require("socket")
# require("lpeg")
# math.randomseed(os.time()+ngx.worker.id())
# }
server {
@@ -108,9 +122,9 @@ http {
location / {
default_type text/html;
content_by_lua_block {
content_by_lua '
require("lapis").serve("app")
}
';
}
location /favicon.ico {