Open lightninglu10 opened 8 years ago
First disable multiple workers for rtmp. Run two nginx instances if you wonna serve http traffic using multiple cores.
Then (if it's possible) upload or give url of your playlists so we can see fragments. But first disable multiple workers, because rtmp module doesn't support it.
Oh, I didn't know that. Thanks for the help!
here are some playlists:
8a0acdf3c5b74c5ebd3c7cce8fc30820_hi.txt 8a0acdf3c5b74c5ebd3c7cce8fc30820_low.txt 8a0acdf3c5b74c5ebd3c7cce8fc30820_mid.txt 8a0acdf3c5b74c5ebd3c7cce8fc30820.txt
Do you also have an example of this? So are you saying if I want each transcoding to run on a separate core, then I need to start 3 different nginx configurations, one per core?
Okay guys, this issue is FIXED. Had nothing to do with # of workers, but I'm still not sure if multiple workers is supported or not.
The issue was that we didn't have a -g flag to signal when we should be grabbing keyframes. From the documentation, what made sense to me that your -g in the exec command HAS to be <= your hls_fragment.
`-preset veryfast -threads auto -tune zerolatency -loglevel info -c:v libx264 -b:v 500k -c:a copy -b:a 96k -r 10 -s 512x288 -g 2-f flv rtmp://localhost/hls/$name_low
-preset veryfast -threads auto -tune zerolatency -loglevel info -c:v libx264 -b:v 900k -c:a copy -b:a 128k -r 15 -s 848x480 -g 2 -f flv rtmp://localhost/hls/$name_mid
-preset veryfast -threads auto -tune zerolatency -loglevel info -c:v libx264 -b:v 1920k -c:a copy -b:a copy -r 30 -s 1280x720 -g 2 -f flv rtmp://localhost/hls/$name_hi `
with hls_fragment = 2 fixes it!
Multiple workers can seem working, but after a while something will crash and logs won't say much.
So if I want 4 different video bitrates, should I have 4 nginx configs, each one running one worker?
You can stream multiple channels with multiple bitrates on one nginx instance running one worker. Depending on your server, it's network and protocol you use it will handle up to 2500 live viewers easily. If you need more you can use pull (RTMP) or proxy_pass (HLS) and run another instance(s) to handle more. For HLS you can use one http instance with multiple workers, but rtmp requires one worker which will use only one CPU core.
Hi @lightninglu10 ! I'm sorry, what are the URL you use to access to your .m3u8 files? I'm using your code, but I'm not able to open these hls videos, thank you in advance!
@lightninglu10 Thanks for commenting your solution, you helped me a lot !
Hey guys, I'm running an adaptive transcoding setup here with HLS. It's weird because my _low, _mid, and _hi.m3u8 files all have a different #EXT-X-TARGETDURATION. For _hi, it's 8s, _mid is 17, and _low is 25. It seems like the HLS_fragment has no effect on this. Anyone have a clue about what's going on?
My config is below:
`worker_processes 4; # 2* # of CPUs
error_log logs/error.log debug;
events { worker_connections 1024; }
user ubuntu;
rtmp { server { listen 1935; allow play all;
}
http { root /data/streams/hls;
}`