Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 8080 default_server;
- listen [::]:8080 default_server;
- root /home/YOURNAMEHERE/www/html;
- index index.html index.htm index.nginx-debian.html;
- server_name _;
- location / {
- # First attempt to serve request as file, then
- # as directory, then fall back to displaying a 404.
- try_files $uri $uri/ =404;
- }
- location ~ /transcode {
- content_by_lua_block {
- local source_url = "http://IP_OF_HDHOMERUN:5004/auto/" .. ngx.var.arg_channel
- local port = tostring((ngx.crc32_short(ngx.var.arg_channel) % 1024) + 8192)
- local cmd = "/usr/bin/nohup /usr/bin/ffmpeg -loglevel fatal -analyzeduration 3000000 -fflags +igndts -ignore_unknown -strict experimental -threads 0 -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i " .. source_url .. " -f mpegts -c:v:0 mpeg2_vaapi -c:a:0 copy -y -listen 1 http://" .. ngx.var.server_addr .. ":" .. port .. " < /dev/null &"
- os.execute(cmd)
- ngx.sleep(5)
- ngx.header["X-cmd"] = cmd
- ngx.redirect("http://" .. ngx.var.server_addr .. ":" .. port)
- }
- }
- location ~ /auto {
- rewrite ^/auto/(.*)$ /transcode?channel=$1 last;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment