arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.35k stars 3.51k forks source link

exec ffmpeg not working #1549

Open roozbeh1985 opened 4 years ago

roozbeh1985 commented 4 years ago

hi dear friend my nginx.conf for hls is `application src { live on; exec ffmpeg -i rtmp://localhost/src/$name -c:a libfdk_aac -b:a 32k -c:v libx264 -b:v 128K -f flv rtmp://localhost/hls/$name_low -c:a libfdk_aac -b:a 64k -c:v libx264 -b:v 256k -f flv rtmp://localhost/hls/$name_mid -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 512K -f flv rtmp://localhost/hls/$name_hi; } application hls { live on;

        hls on;
        hls_path /var/www/hls;
        hls_nested on;
        hls_variant _low BANDWIDTH=160000;
        hls_variant _mid BANDWIDTH=320000;
        hls_variant _hi  BANDWIDTH=640000;
    }`

when i'm streaming .i cant see anything in /var/www/hls could you do me a favor tell me what sould ido?

ddev687 commented 4 years ago

@roozbeh1985 try this, ffmpeg deprecated libfdk_aac, you can use aac Use 127.0.0.1 IP instated of localhost.

exec ffmpeg -i rtmp://127.0.0.1:1935/src/$name
-c:a aac -b:a 32k -c:v libx264 -b:v 128K -f flv rtmp://127.0.0.1:1935/hls/$name_low
-c:a aac -b:a 64k -c:v libx264 -b:v 256k -f flv rtmp://127.0.0.1:1935/hls/$name_mid
-c:a aac -b:a 128k -c:v libx264 -b:v 512K -f flv rtmp://127.0.0.1:1935/hls/$name_hi;

or

exec ffmpeg -i rtmp://127.0.0.1:1935/src/$name
-max_muxing_queue_size 1024 -c:a aac -b:a 32k -c:v libx264 -b:v 128K -f flv rtmp://127.0.0.1:1935/hls/$name_low
-max_muxing_queue_size 1024 -c:a aac -b:a 64k -c:v libx264 -b:v 256k -f flv rtmp://127.0.0.1:1935/hls/$name_mid
-max_muxing_queue_size 1024 -c:a aac -b:a 128k -c:v libx264 -b:v 512K -f flv rtmp://127.0.0.1:1935/hls/$name_hi;
xiafeiyue commented 3 years ago

@ddev687 Nginx using exec/exec_push command to execute ffmpeg is invalid。 Below is my nginx configuration: application myapp { live on; record off; drop_idle_publisher 5s; exec ffmpeg -re -i /home/tmp/08年湖人与凯尔特人.mp4 -acodec copy -c:v libx264 -preset veryfast -profile:v baseline -vsync cfr -s 480x360 -b:v 400k -bufsize 400k -threads 0 -r 30 -f flv rtmp://ip:1936/myapp/test1 }