nginxÔõÑùÉèÖÃrtmp
ÔÚ nginx ÖÐÉèÖà rtmp µÄ°ì·¨ÓУº×°Öà rtmp Ä£¿é±à¼ nginx ÉèÖÃÎļþ£¬Ìí¼Ó rtmp ÉèÖý¨ÉèÓÃÓÚÍÆËͺÍÀÈ¡Á÷µÄ rtmp Á÷Ô´ÖØÆô nginxʹÓà vlc ²¥·ÅÆ÷ÑéÖ¤ÉèÖÃ
ÔõÑùÔÚ Nginx ÖÐÉèÖÃ RTMP
ΪÁËÔÚ Nginx ÖÐÉèÖà RTMP£¬Çëƾ֤ÒÔÏ°취²Ù×÷£º
1. ×°Öà RTMP Ä£¿é
apt-get install nginx-module-rtmp
µÇ¼ºó¸´ÖÆ
2. ÉèÖÃ Nginx
ÔÚ Nginx ÉèÖÃÎļþ /etc/nginx/nginx.conf ÖУ¬Ìí¼ÓÒÔÏÂÄÚÈÝ£º
rtmp { server { listen 1935; chunk_size 4096; application live { push "push.stream"; pull "live.stream"; live on; } } }
µÇ¼ºó¸´ÖÆ
3. ½¨Éè RTMP Á÷Ô´
½¨ÉèÁ½¸öÁ÷Ô´£¬Ò»¸öÓÃÓÚÍÆËÍÁ÷£¬Ò»¸öÓÃÓÚÀÈ¡Á÷£º
# ÍÆËÍÁ÷Ô´ ffmpeg -re -i input.mp4 -vcodec libx264 -acodec aac -f flv rtmp://localhost:1935/live/push.stream # ÀÈ¡Á÷Ô´ ffmpeg -i rtmp://localhost:1935/live/live.stream output.mp4
µÇ¼ºó¸´ÖÆ
4. ÖØÆô Nginx
systemctl restart nginx
µÇ¼ºó¸´ÖÆ
5. ÑéÖ¤ÉèÖÃ
Äú¿ÉÒÔʹÓà VLC ýÌå²¥·ÅÆ÷ÅþÁ¬µ½ RTMP Á÷Ô´ÒÔÑéÖ¤ÉèÖãº
ÍÆËÍÁ÷£ºrtmp://localhost:1935/live/push.stream
ÀÈ¡Á÷£ºrtmp://localhost:1935/live/live.stream
ÒÔÉϾÍÊÇnginxÔõÑùÉèÖÃrtmpµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡
ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£