arut / nginx-rtmp-module

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

Restreaming RTSP to RTMP with -rtsp_transport tcp - autoconnecting #1099

Open domo997 opened 7 years ago

domo997 commented 7 years ago

Hi, it's possible to restreaming RTSP to RTMP with autoreconnecting. My Ip cam work good only when I use -rtsp_transport tcp: exec_static /bin/ffmpeg -re -i -rtsp_transport tcp "rtsp://user:pass@ipcam:554/Streaming/Channels/1" -vcodec copy -an -f flv "rtmp://localhost/hls/cam"; but the streaming is not reconnecting. When I use command without -rtsp_transport: exec_static /bin/ffmpeg -re -i "rtsp://user:pass@ipcam:554/Streaming/Channels/1" -vcodec copy -an -f flv "rtmp://localhost/hls/cam"; streaming is reconnecting when cam is lost signal (internet), but the picutre is not ok - ffmpeg is losting packets. I think it's problem with UDP.

nxtreaming commented 7 years ago

I think you should use the following cmd:

exec_static /bin/ffmpeg -re -rtsp_transport tcp -i "rtsp://user:pass@ipcam:554/Streaming/Channels/1" -vcodec copy -an -f flv "rtmp://localhost/hls/cam";

place '-i' directly before "rtsp://xxxxxx"

domo997 commented 7 years ago

I do it. But stream is not reconecting when lost signal from cam. The streaming is not reconnecting with -rtsp_transport tcp. Without -rtsp_transport tcp is reconnecting but the stream is not ok. I have this issue: [rtsp @ 0x28757a0] RTP: missed 2 packets [rtsp @ 0x28757a0] max delay reached. need to consume packetbitrate=1329.5kbits/s speed= 1x [rtsp @ 0x28757a0] RTP: missed 231 packets [rtsp @ 0x28757a0] max delay reached. need to consume packetbitrate=1250.7kbits/s speed=1.04x [rtsp @ 0x28757a0] RTP: missed 1 packets [rtsp @ 0x28757a0] max delay reached. need to consume packetbitrate=1242.1kbits/s speed= 1x [rtsp @ 0x28757a0] RTP: missed 234 packets [rtsp @ 0x28757a0] max delay reached. need to consume packet [rtsp @ 0x28757a0] RTP: missed 5 packets [rtsp @ 0x28757a0] max delay reached. need to consume packet [rtsp @ 0x28757a0] RTP: missed 13 packets [rtsp @ 0x28757a0] max delay reached. need to consume packet [rtsp @ 0x28757a0] RTP: missed 9 packets [rtsp @ 0x28757a0] max delay reached. need to consume packetbitrate=1199.9kbits/s speed=1.03x [rtsp @ 0x28757a0] RTP: missed 2 packets [rtsp @ 0x28757a0] max delay reached. need to consume packetbitrate=1224.1kbits/s speed= 1x [rtsp @ 0x28757a0] RTP: missed 223 packets [rtsp @ 0x28757a0] max delay reached. need to consume packet [rtsp @ 0x28757a0] RTP: missed 13 packets [rtsp @ 0x28757a0] max delay reached. need to consume packet [rtsp @ 0x28757a0] RTP: missed 14 packets [rtsp @ 0x28757a0] max delay reached. need to consume packet With tcp stream is ok.

jidckii commented 6 years ago

@domo997 https://superuser.com/questions/1282794/ffmpeg-passthrough-of-mpeg-transport-stream-causes-errorsglitches-in-stream

AVBIT commented 6 years ago

jidckii, thanks, very much helped