AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.25k stars 346 forks source link

Trying to POST a RESTful command to reolink doorbell and getting Conversion failed! #1296

Open enoquelights opened 1 month ago

enoquelights commented 1 month ago

I tried using WebRTC as well, and got the same error. I am using frigate with go2rtc. I just cant seem to send sounds to it.

rest_command:
  welcome_g:
    url: "http://localhost:1984/api/streams?dst=reolink_doorbell_sub&src=ffmpeg:/media/welcome-home-g.mp3#audio=pcm#input=file"
   # userame: user
   # password: pass
    verify_ssl: false
    method: post
go2rtc:
    log:
       format: text
       exec: trace
  streams:
     reolink_doorbell:
      - ffmpeg:https://192.168.40.2/flv?               
         port=1935&app=bcs&stream=channel0_main.bcs&user=admin&password=pass#video=copy#audio=copy#audio=opus
      - rtsp://admin:pass@192.168.40.2:554/h264Preview_01_sub#audio=pcm#audio=volume
     reolink_doorbell_sub:
     - ffmpeg:https://192.168.40.2/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=pass
     - rtsp://admin:pass@192.168.40.2:554/h264Preview_01_sub#audio=pcm#audio=volume

2024-08-06 13:50:21.216365462 -re -i /media/welcome-home-g.mp3 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}" 2024-08-06 13:50:21.226133039 Input #0, mp3, from '/media/welcome-home-g.mp3': 2024-08-06 13:50:21.226137390 Metadata: 2024-08-06 13:50:21.226139202 encoder : Lavf57.76.100 2024-08-06 13:50:21.226156648 Duration: 00:00:02.38, start: 0.025057, bitrate: 129 kb/s 2024-08-06 13:50:21.226169922 Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s 2024-08-06 13:50:21.226171411 Metadata: 2024-08-06 13:50:21.226180513 encoder : Lavc57.10 2024-08-06 13:50:21.268280476 frame=251255 fps= 20 q=-1.0 size=N/A time=03:29:32.44 bitrate=N/A speed= 1x
14:50:21.268 DBG [exec] run launch=51.687816ms 2024-08-06 13:50:21.268286279 14:50:21.268 DBG [exec] run url="exec:ffmpeg -hide_banner -re -i https://192.168.40.2/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=pass -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}" 2024-08-06 13:50:21.268288623 Output #0, rtsp, to 'rtsp://127.0.0.1:8554/1b7437cc01b7c544b98ae39e8fd6d174': 2024-08-06 13:50:21.268290466 Metadata: 2024-08-06 13:50:21.268311902 encoder : Lavf59.27.100 2024-08-06 13:50:21.268313897 Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s 2024-08-06 13:50:21.268315441 Metadata: 2024-08-06 13:50:21.268317075 encoder : Lavc57.10 2024-08-06 13:50:21.268318593 Stream mapping: 2024-08-06 13:50:21.268320245 Stream #0:0 -> #0:0 (copy) 2024-08-06 13:50:21.268321882 Press [q] to stop, [?] for help 2024-08-06 13:50:23.552690538 size=N/A time=00:00:00.00 bitrate=N/A speed=N/A
frame=377101 fps= 30 q=-1.0 size=N/A time=03:29:32.10 bitrate=N/A speed= 1x
frame=251462 fps= 20 q=-1.0 size=N/A time=03:29:27.97 bitrate=N/A speed= 1x
size=N/A time=00:00:00.60 bitrate=N/A speed=1.18x
frame=251266 fps= 20 q=-1.0 size=N/A time=03:29:32.95 bitrate=N/A speed= 1x
frame=251141 fps= 20 q=-1.0 size=N/A time=03:29:15.94 bitrate=N/A speed= 1x
frame=377118 fps= 30 q=-1.0 size=N/A time=03:29:32.67 bitrate=N/A speed= 1x
frame=251472 fps= 20 q=-1.0 size=N/A time=03:29:28.49 bitrate=N/A speed= 1x
frame=251276 fps= 20 q=-1.0 size=N/A time=03:29:33.47 bitrate=N/A speed= 1x
size=N/A time=00:00:01.09 bitrate=N/A speed=1.08x
frame=251161 fps= 20 q=-1.0 size=N/A time=03:29:16.96 bitrate=N/A speed= 1x
frame=377134 fps= 30 q=-1.0 size=N/A time=03:29:33.18 bitrate=N/A speed= 1x
frame=251482 fps= 20 q=-1.0 size=N/A time=03:29:29.00 bitrate=N/A speed= 1x
frame=251286 fps= 20 q=-1.0 size=N/A time=03:29:33.98 bitrate=N/A speed= 1x
size=N/A time=00:00:01.59 bitrate=N/A speed=1.05x
frame=251175 fps= 20 q=-1.0 size=N/A time=03:29:17.66 bitrate=N/A speed= 1x
frame=377149 fps= 30 q=-1.0 size=N/A time=03:29:33.70 bitrate=N/A speed= 1x
frame=251492 fps= 20 q=-1.0 size=N/A time=03:29:29.51 bitrate=N/A speed= 1x
size=N/A time=00:00:02.11 bitrate=N/A speed=1.04x
frame=251297 fps= 20 q=-1.0 size=N/A time=03:29:34.49 bitrate=N/A speed= 1x
frame=251185 fps= 20 q=-1.0 size=N/A time=03:29:18.18 bitrate=N/A speed= 1x
size=N/A time=00:00:02.35 bitrate=N/A speed=1.03x
2024-08-06 13:50:23.552694712 video:0kB audio:37kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 2024-08-06 13:50:23.553542079 14:50:23.553 TRC [exec] close url="exec:ffmpeg -hide_banner -re -i /media/welcome-home-g.mp3 -c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}" 2024-08-06 13:50:24.574816124 frame=251502 fps= 20 q=-1.0 size=N/A time=03:29:29.96 bitrate=N/A speed= 1x
frame=377165 fps= 30 q=-1.0 size=N/A time=03:29:34.21 bitrate=N/A speed= 1x
frame=251306 fps= 20 q=-1.0 size=N/A time=03:29:35.00 bitrate=N/A speed= 1x
frame=251195 fps= 20 q=-1.0 size=N/A time=03:29:18.69 bitrate=N/A speed= 1x
frame=251511 fps= 20 q=-1.0 size=N/A time=03:29:30.47 bitrate=N/A speed= 1x
frame=377182 fps= 30 q=-1.0 size=N/A time=03:29:34.72 bitrate=N/A speed= 1x
frame=251316 fps= 20 q=-1.0 size=N/A time=03:29:35.51 bitrate=N/A speed= 1x
Input #0, flv, from 'https://192.168.40.2/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=pass: 2024-08-06 13:50:24.574824063 Metadata: 2024-08-06 13:50:24.574827334 displayWidth : 896 2024-08-06 13:50:24.574830471 displayHeight : 672 2024-08-06 13:50:24.574833743 Duration: 00:00:00.00, start: 0.000000, bitrate: N/A 2024-08-06 13:50:24.574852594 Stream #0:0: Video: h264 (High), yuv420p(progressive), 896x672, 19 fps, 20 tbr, 1k tbn 2024-08-06 13:50:24.574855920 Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp 2024-08-06 13:50:24.619697460 frame=251202 fps= 20 q=-1.0 size=N/A time=03:29:19.01 bitrate=N/A speed= 1x
14:50:24.619 DBG [exec] run launch=3.351414238s 2024-08-06 13:50:24.619893007 Output #0, rtsp, to 'rtsp://127.0.0.1:8554/85825998a5aa6eb33a1a59043d1410b0': 2024-08-06 13:50:24.619921195 Metadata: 2024-08-06 13:50:24.619924615 displayWidth : 896 2024-08-06 13:50:24.619939961 displayHeight : 672 2024-08-06 13:50:24.619958983 encoder : Lavf59.27.100 2024-08-06 13:50:24.620016791 Stream #0:0: Video: h264 (High), yuv420p(progressive), 896x672, q=2-31, 19 fps, 20 tbr, 90k tbn 2024-08-06 13:50:24.620099183 Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp 2024-08-06 13:50:24.620102414 Stream mapping: 2024-08-06 13:50:24.620105272 Stream #0:0 -> #0:0 (copy) 2024-08-06 13:50:24.620108168 Stream #0:1 -> #0:1 (copy) 2024-08-06 13:50:24.620111028 Press [q] to stop, [?] for help 2024-08-06 13:50:24.630648600 frame= 1 fps=0.0 q=-1.0 size=N/A time=00:00:00.00 bitrate=N/A speed=N/A
av_interleaved_write_frame(): Broken pipe 2024-08-06 13:50:24.630825247 Error writing trailer of rtsp://127.0.0.1:8554/85825998a5aa6eb33a1a59043d1410b0: Broken pipe 2024-08-06 13:50:24.630832393 frame= 2 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.13 bitrate=N/A speed=12.6x
2024-08-06 13:50:24.630885468 video:150kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown 2024-08-06 13:50:24.631881152 Conversion failed! 2024-08-06 13:50:24.634497441 14:50:24.634 TRC [exec] close url="exec:ffmpeg -hide_banner -re -i https://192.168.40.2/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=admin&password=pass-c copy -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}"

AlexxIT commented 1 month ago

Common error - your URL parameters are not encoded. #audio=pcm#input=file part does not fit in the src parameter.

enoquelights commented 1 month ago

Common error - your URL parameters are not encoded. #audio=pcm#input=file part does not fit in the src parameter.

Should it just be:?

rest_command:
  welcome_graeme:
    url: "http://localhost:1984/api/streams?dst=reolink_doorbell_sub&src=ffmpeg:/media/welcome-home-g.mp3"
   # userame: user
   # password: pass
    verify_ssl: false
    method: post

or %23audio=pcma%23input=file at the end? Just slow right now, been trying for the last 2 days and brain hurts.

enoquelights commented 1 month ago

I get this for the second option:

content: | can't find consumer status: 500

Here is my go2rtc info for reolink_doorbell_sub:

{
  "producers": [
    {
      "type": "RTSP passive producer",
      "url": "rtsp://127.0.0.1:8554/48dce7299c7f590db008122955019bd7",
      "remote_addr": "127.0.0.1:51954",
      "user_agent": "ffmpeg/go2rtc",
      "sdp": "v=0\r\no=- 0 0 IN IP4 127.0.0.1\r\ns=No Name\r\nc=IN IP4 127.0.0.1\r\nt=0 0\r\na=tool:libavformat LIBAVFORMAT_VERSION\r\nm=video 0 RTP/AVP 96\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAM6wVFKDgFWQ=,aO48sA==; profile-level-id=640033\r\na=control:streamid=0\r\nm=audio 0 RTP/AVP 97\r\na=rtpmap:97 MPEG4-GENERIC/16000/1\r\na=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1408\r\na=control:streamid=1\r\n",
      "medias": [
        "video, recvonly, H.264 High 5.1",
        "audio, recvonly, MPEG4-GENERIC/16000"
      ],
      "receivers": [
        "96 H264, bytes=1793243, senders=1",
        "97 MPEG4-GENERIC/16000, bytes=103000, senders=1"
      ],
      "recv": 1913583
    },
    {
      "url": "rtsp://admin:pass@192.168.40.2:554/h264Preview_01_sub#audio=pcm#audio=volume"
    }
  ],
  "consumers": [
    {
      "type": "RTSP passive consumer",
      "url": "rtsp://127.0.0.1:8554/reolink_doorbell_sub",
      "remote_addr": "127.0.0.1:50168",
      "user_agent": "FFmpeg Frigate/0.13.2-6476f8a",
      "sdp": "v=0\r\no=- 1 1 IN IP4 0.0.0.0\r\ns=go2rtc/1.8.4\r\nc=IN IP4 0.0.0.0\r\nt=0 0\r\nm=video 0 RTP/AVP 96\r\na=rtpmap:96 H264/90000\r\na=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QAM6wVFKDgFWQ=,aO48sA==; profile-level-id=640033\r\na=control:trackID=0\r\nm=audio 0 RTP/AVP 97\r\na=rtpmap:97 MPEG4-GENERIC/16000\r\na=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1408\r\na=control:trackID=1\r\n",
      "medias": [
        "video, sendonly, H264, H265",
        "audio, sendonly, MPEG4-GENERIC"
      ],
      "senders": [
        "96 H264, bytes=1793243, receivers=1",
        "97 MPEG4-GENERIC/16000, bytes=103000, receivers=1"
      ],
      "send": 1919139
    }
  ]
}
AlexxIT commented 1 month ago

You can try to setup separate stream only for TTS and only with one Reolink RTSP link.

Also you need to log the moment of problem.

You should use %23audio=pcma%23input=file in your link.

enoquelights commented 1 month ago

Thank you for the reply. I put in the encoded parts and same error. To create those 2 streams, sorry for asking a but much, but based on what I have sent what would that look like?

The only place I am using the camera is in frigate with this:

reolink_doorbell:    
    ffmpeg:      
      inputs:
      - path: rtsp://127.0.0.1:8554/reolink_doorbell
        input_args: preset-rtsp-restream
        roles:
        - record
      - path: rtsp://127.0.0.1:8554/reolink_doorbell_sub
        input_args: preset-rtsp-restream
        roles:
        - detect
      output_args:
        record: preset-record-generic-audio-aac    
    record:
      enabled: true
      retain:
        days: 0
        mode: motion
      events:
        retain:
          default: 14
          mode: active_objects
        pre_capture: 5
        post_capture: 8
        objects:
          # - car
        - person
        - cat
        - dog    
    mqtt:
      timestamp: false
      bounding_box: false
      crop: true
      quality: 100
      height: 500

Would any of this be causing the consumer issue?

Thanks again.