k-yle / rtsp-relay

📽 View an RTSP stream in your web browser using an express.js server
https://npm.im/rtsp-relay
MIT License
314 stars 58 forks source link

works perfectly until turning off ipcam audio #143

Open coolsun opened 2 years ago

coolsun commented 2 years ago

Hi, folks,

I have the example tuning up well and the streaming is perfect to us with multiple streaming clients and they all auto reconnect smoothly.

I have one show stopper, though. When the ipcam turns off the audio input, the streaming stops without any error.

When I manually convert the file, it plays perfectly in vlc player.

Here is the FFmpeg command in my node docker server. root@620d6fbd3b6b:/usr/src/app# /usr/src/app/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -rtsp_transport tcp -i rtsp://admin:a-12345678@172.16.1.81:554/unicast/c3/s1/live -f mpegts -codec:v mpeg1video -r 30 -max_muxing_queue_size 9999 -

Here is the FFmpeg command and output in my node docker server with IPCAM AUDIO OFF => streaming shows nothing. root@620d6fbd3b6b:/usr/src/app# /usr/src/app/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -rtsp_transport tcp -i rtsp://admin:a-12345678@172.16.1.81:554/unicast/c3/s1/live -f mpegts -codec:v mpeg1video -codec:a mp2 -r 30 -max_muxing_queu e_size 9999 out.ipcam_audio_off.mp4 ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg libavutil 56. 24.101 / 56. 24.101 libavcodec 58. 42.100 / 58. 42.100 libavformat 58. 24.100 / 58. 24.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 46.101 / 7. 46.101 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Guessed Channel Layout for Input Stream #0.1 : mono Input #0, rtsp, from 'rtsp://admin:a-12345678@172.16.1.81:554/unicast/c3/s1/live': Metadata: title : ONVIF RTSP Server Duration: N/A, start: 0.280000, bitrate: N/A Stream #0:0: Video: h264 (Main), yuv420p(progressive), 720x576, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native)) Stream #0:1 -> #0:1 (pcm_mulaw (native) -> mp2 (native)) Press [q] to stop, [?] for help Finishing stream 0:1 without any data written to it.14:32:22.77 bitrate= -0.0kbits/s dup=0 drop=5 speed=N/A Output #0, mpegts, to 'out.ipcam_audio_off.mp4': Metadata: title : ONVIF RTSP Server encoder : Lavf58.24.100 Stream #0:0: Video: mpeg1video, yuv420p(progressive), 720x576, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc Metadata: encoder : Lavc58.42.100 mpeg1video Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: mp2, 16000 Hz, mono, s16, 160 kb/s Metadata: encoder : Lavc58.42.100 mp2 frame= 409 fps= 34 q=24.8 Lsize= 939kB time=00:00:16.23 bitrate= 474.1kbits/s dup=0 drop=5 speed=1.36x video:810kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 16.004042% Exiting normally, received signal 2. root@620d6fbd3b6b:/usr/src/app#

image

Here is the FFmpeg command and output in my node docker server with IPCAM AUDIO ON => streaming is working fine root@620d6fbd3b6b:/usr/src/app# /usr/src/app/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -rtsp_transport tcp -i rtsp://admin:a-12345678@172.16.1.81:554/unicast/c3/s1/live -f mpegts -codec:v mpeg1video -codec:a mp2 -r 30 -max_muxing_queue_size 9999 out.ipcam_audio_on.mp4 ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516 configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg libavutil 56. 24.101 / 56. 24.101 libavcodec 58. 42.100 / 58. 42.100 libavformat 58. 24.100 / 58. 24.100 libavdevice 58. 6.101 / 58. 6.101 libavfilter 7. 46.101 / 7. 46.101 libswscale 5. 4.100 / 5. 4.100 libswresample 3. 4.100 / 3. 4.100 libpostproc 55. 4.100 / 55. 4.100 Guessed Channel Layout for Input Stream #0.1 : mono Input #0, rtsp, from 'rtsp://admin:a-12345678@172.16.1.81:554/unicast/c3/s1/live': Metadata: title : ONVIF RTSP Server Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: h264 (Main), yuv420p(progressive), 720x576, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native)) Stream #0:1 -> #0:1 (pcm_mulaw (native) -> mp2 (native)) Press [q] to stop, [?] for help Output #0, mpegts, to 'out.ipcam_audio_on.mp4': Metadata: title : ONVIF RTSP Server encoder : Lavf58.24.100 Stream #0:0: Video: mpeg1video, yuv420p, 720x576, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc Metadata: encoder : Lavc58.42.100 mpeg1video Side data: cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 Stream #0:1: Audio: mp2, 16000 Hz, mono, s16, 160 kb/s Metadata: encoder : Lavc58.42.100 mp2 frame= 489 fps= 26 q=31.0 Lsize= 1458kB time=00:00:19.91 bitrate= 599.7kbits/s speed=1.06x video:883kB audio:390kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 14.569662% Exiting normally, received signal 2.

image

I have tried audio:false on server and player. None of them works. I have tried to add audio option in FFmpeg. None of them as follows works.

        proxy({
          url: `${urlParam}`,
          transport: 'tcp',
          //additionalFlags: ['-codec:a', 'mp2', '-ac', '0', '-max_muxing_queue_size', '9999'],
          // additionalFlags: ['-max_muxing_queue_size', '9999', '-map', '"0:a?"', '-map', '"v:0"'],
          additionalFlags: ['-max_muxing_queue_size', '9999'],
          //additionalFlags: ['-codec:a', 'mp2', '-ac', '0', '-max_muxing_queue_size', '9999'],
          // additionalFlags: ['-map', '"0:a?"', '-max_muxing_queue_size', '9999'],

// additionalFlags: ['-codec:a', 'mp2', '-max_muxing_queue_size', '9999'], verbose: true, audio: false, })(ws);

Thank you very much for any suggestion or feedback!!!

JB

k-yle commented 2 years ago

Hi, you said "When the ipcam turns off the audio input, the streaming stops without any error." Is this only an issue when you use rtsp-relay, or is it also an issue when you use VLC and turn the audio off?

coolsun commented 2 years ago

Hi, you said "When the ipcam turns off the audio input, the streaming stops without any error." Is this only an issue when you use rtsp-relay, or is it also an issue when you use VLC and turn the audio off?

Hi, thanks for the quick reply. It is only an issue with rasp-relay. The rtsp streams play fine in VLC with audio on or off. The output mp4 with ipcam audio off also plays fine in VLC. The JSmpeg player(from example) shows nothing when I try to play it with rtsp-relay. I have tried several optional params at proxy or player such as "audio: false" but to no avail. It plays fine as soon as I turn on the audio.

coolsun commented 2 years ago

Hi, you said "When the ipcam turns off the audio input, the streaming stops without any error." Is this only an issue when you use rtsp-relay, or is it also an issue when you use VLC and turn the audio off?

Audio on: image

Audio off: image

coolsun commented 2 years ago

Hi, k-yle,

Do you have an ETA for the bug fix? We have a demo schedule on March 20, 2022 so it will be awesome if this can be resolved by then.

k-yle commented 2 years ago

This is not something I can fix without access to a camera that exhibits this issue.

Hence why it is labelled as

coolsun commented 2 years ago

Is it possible that it is a problem with JSMpeg player? Do you know if there is any parameters with JSmpeg player that is worth to be tried?
I will see if I can find an IPCam with the same model under my control for you to test. Thank you very much again!