homebridge-plugins / homebridge-camera-ffmpeg

Homebridge Plugin Providing FFmpeg-based Camera Support
https://homebridge-plugins.github.io/homebridge-camera-ffmpeg/
Apache License 2.0
1.09k stars 227 forks source link

[Camera-ffmpeg] ERROR: FFmpeg exited with code 1 #229

Closed brianerdelyi closed 4 years ago

brianerdelyi commented 5 years ago

Good day,

I am getting the following error when I try connecting to my camera:

[11/18/2018, 2:03:02 AM] [Camera-ffmpeg] Start streaming video from G3 Flex with 640x360@132kBit
ffmpeg -rtsp_transport http -re -i rtsp://192.168.2.26:7447/pqSBSzLFBznJlUHn -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 15 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 9626709 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params +3yHFaAcGDnM5Ag20/s4nhflIEYCRKuAklADmxJQ srtp://192.168.2.18:59592?rtcpport=59592&localrtcpport=59592&pkt_size=1316 -map 0:1 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 13907886 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params PgTnPeobfp4etc6Q6fdiFleMedYiOpqAeq1xzeew srtp://192.168.2.18:57405?rtcpport=57405&localrtcpport=57405&pkt_size=1316
ffmpeg version N-92461-gd3621b2321 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
  configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
  libavutil      56. 23.101 / 56. 23.101
  libavcodec     58. 39.100 / 58. 39.100
  libavformat    58. 22.100 / 58. 22.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 44.100 /  7. 44.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100

[rtsp @ 0x32a9760] decoding for stream 1 failed

Input #0, rtsp, from 'rtsp://192.168.2.26:7447/pqSBSzLFBznJlUHn':
  Metadata:
    title           : FCECDA1F525A_2
  Duration: N/A
, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: aac (LC), 48000 Hz, mono, fltp

    Stream #0:1: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 640x360 [SAR 1:1 DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc

Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.2.18:59592?rtcpport=59592&localrtcpport=59592&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (srtp://192.168.2.18:59592?rtcpport=59592&localrtcpport=59592&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Codec AVOption b (set bitrate (in bits/s)) specified for output file #1 (srtp://192.168.2.18:57405?rtcpport=57405&localrtcpport=57405&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Codec AVOption profile () specified for output file #1 (srtp://192.168.2.18:57405?rtcpport=57405&localrtcpport=57405&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> pcm_mulaw (native))
  Stream #0:1 -> #1:0
 (h264 (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Finishing stream 0:0 without any data written to it.

Output #0, rtp, to 'srtp://192.168.2.18:59592?rtcpport=59592&localrtcpport=59592&pkt_size=1316':
  Metadata:
    title           : FCECDA1F525A_2
    encoder         : Lavf58.22.100

    Stream #0:0: Audio: pcm_mulaw, 48000 Hz, mono, s16, 384 kb/s
    Metadata:
      encoder         : Lavc58.39.100 pcm_mulaw
Finishing stream 1:0 without any data written to it.

[swscaler @ 0x3424e50] deprecated pixel format used, make sure you did set range correctly

[mpeg4 @ 0x32e1a40] Either both buffer size and max rate or neither must be specified

Error initializing output stream 1:0 -- Error while opening encoder for output stream #1:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Exiting normally, received signal 15.

[11/18/2018, 2:03:07 AM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1
Partizan7676 commented 5 years ago

try to change transport option to tcp. -rtsp_transport http -re -i rtsp://192.168.2.26:7447/pqSBSzLFBznJlUHn

brianerdelyi commented 5 years ago

Changing the parameter does not appear to help. Here is the output:

[11/22/2018, 4:31:48 PM] Homebridge is running on port 51826.
[11/22/2018, 4:31:48 PM] UniFi G3 Flex is running on port 46031.
[11/22/2018, 4:31:58 PM] [Camera-ffmpeg] Snapshot from UniFi G3 Flex at 480x270
ffmpeg -rtsp_transport tcp -re -i rtsp://192.168.2.26:7447/pqSBSzLFBznJlUHn -t 1 -s 480x270 -f image2 -
[11/22/2018, 4:32:05 PM] [Camera-ffmpeg] Start streaming video from UniFi G3 Flex with 640x360@132kBit
ffmpeg -rtsp_transport tcp -re -i rtsp://192.168.2.26:7447/pqSBSzLFBznJlUHn -map 0:0 -vcodec h264_omx -pix_fmt yuv420p -r 2 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -payload_type 99 -ssrc 7744683 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params VRo7GVVTykfOyU8tmnwfjwI0RJCB3kpi1lVgfFkO srtp://192.168.2.18:60011?rtcpport=60011&localrtcpport=60011&pkt_size=1316 -map 0:1 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 705667 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ktFEaPiQaZb7+NrvI4ArLdV0xyM22fXRw/Fhu2a+ srtp://192.168.2.18:50637?rtcpport=50637&localrtcpport=50637&pkt_size=1316
ffmpeg version N-92462-g529debc987 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
  configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
  libavutil      56. 23.101 / 56. 23.101
  libavcodec     58. 39.100 / 58. 39.100
  libavformat    58. 22.100 / 58. 22.100
  libavdevice    58.  6.100 / 58.  6.100
  libavfilter     7. 44.100 /  7. 44.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100

Input #0, rtsp, from 'rtsp://192.168.2.26:7447/pqSBSzLFBznJlUHn':
  Metadata:
    title           : FCECDA1F525A_2
  Duration: N/A, start: 0.348000
, bitrate: N/A
    Stream #0:0: Audio: aac (LC), 48000 Hz, mono, fltp
    Stream #0:1: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 640x360 [SAR 1:1 DAR 16:9], 15 fps, 15 tbr, 90k tbn, 30 tbc

Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.2.18:60011?rtcpport=60011&localrtcpport=60011&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (srtp://192.168.2.18:60011?rtcpport=60011&localrtcpport=60011&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Codec AVOption b (set bitrate (in bits/s)) specified for output file #1 (srtp://192.168.2.18:50637?rtcpport=50637&localrtcpport=50637&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Codec AVOption profile () specified for output file #1 (srtp://192.168.2.18:50637?rtcpport=50637&localrtcpport=50637&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

Stream mapping:
  Stream #0:0 -> #0:0 (aac (native) -> pcm_mulaw (native))

  Stream #0:1 -> #1:0 (h264 (native) -> mpeg4 (native))
Press [q] to stop, [?] for help

Output #0, rtp, to 'srtp://192.168.2.18:60011?rtcpport=60011&localrtcpport=60011&pkt_size=1316':
  Metadata:
    title           : FCECDA1F525A_2
    encoder         : Lavf58.22.100

    Stream #0:0: Audio: pcm_mulaw, 48000 Hz, mono, s16, 384 kb/s
    Metadata:
      encoder         : Lavc58.39.100 pcm_mulaw

[swscaler @ 0x28aed20] deprecated pixel format used, make sure you did set range correctly

[mpeg4 @ 0x27b3e70] Either both buffer size and max rate or neither must be specified
Error initializing output stream 1:0 -- Error while opening encoder for output stream #1:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Conversion failed!

[11/22/2018, 4:32:08 PM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1
iRayanKhan commented 5 years ago

213

Phoenix-DH commented 5 years ago

I got also the same problem with the arlo version. After a period of time I get the error. But in homekit I got no video starting, only this screenshot, no play button nothing.

I am using exactly this config:

{
  "platform": "Camera-ffmpeg",
  "cameras": [
    {
      "name": "Camera Name",
      "videoConfig": {
        "source": "arlo",
        "maxStreams": 2,
        "maxWidth": 1280,
        "maxHeight": 720,
        "maxFPS": 30,
        "maxBitrate": 300,
        "vcodec": "copy",
        "audio": false,
        "debug": true,
        "arloUserName": "email@provider.com",
        "arloPassword": "<your arlo password>",
        "arloCameraIndex": "0"
      }
    }
  ]
}

I did exactly the following:

sudo service homebridge stop
sudo apt install python-pip
sudo pip install arlo
sudo apt-get install ffmpeg
npm install -g --unsafe-perm https://github.com/devarshi/homebridge-camera-ffmpeg
npm install -g --unsafe-perm https://github.com/devarshi/homebridge-arlo
sudo service homebridge start

In the logs I can that after the retrieving of th URL the log says "Stopped streaming"

I got an Pi2.

brianerdelyi commented 5 years ago

Can you paste the log and the output when you run the same ffmpeg command from command line?

Phoenix-DH commented 5 years ago

I get the following by the command delivered in my shell:

pi@phoenixpi:~ $ ffmpeg -rtsp_transport tcp -re -i rtsps://XXX?egressToken=XXX&userAgent=iOS&cameraId=XXX -map 0:1 -vcodec copy -f rawvideo -tune zerolatency -payload_type 99 -ssrc 16022373 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params XXX srtp://192.168.XXX.XXX:65117?rtcpport=65117&localrtcpport=65117&pkt_size=1316
[2] 26725
[3] 26726
[4] 26727
[5] 26728
[3]   Fertig                  userAgent=iOS
pi@phoenixpi:~ $ -bash: -map: Kommando nicht gefunden.
ffmpeg version 3.2.10-1~deb9u1+rpt2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1+rpt2' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100

Then no response, waiting cursor ... have to cancel with CTRL+C

brianerdelyi commented 5 years ago

You have left it and after 5 minutes there is no additional message?

I'm not familiar with the plugin you are referring to. Why is vcodec=copy?

What is the message from the Homebridge console/logs?

What happens if you open the stream with VLC? If you view media information with VLC, what are the streams details?

llemtt commented 5 years ago

@Phoenix-DH

you have to quote the & with \ in your command! otherwise you only generates a lot of meaningless background processes...

Phoenix-DH commented 5 years ago

If I now try to open the stream in Homekit, there is directly the message: [Camera-ffmpeg] ERROR: FFmpeg exited with code 1

On the phone there is the message that the cam is not responding.

During this, cmd still not responding .... Also not after 7 minutes .....

VLC I do not know how to open the stream

brianerdelyi commented 5 years ago

If VLC cannot open the stream then I do not know what the problem is.

Phoenix-DH commented 5 years ago

I did not say that VLC cannot open, I only do not know how ... I someone can told me how, I will try...

I read the comment from llemtt, I tried ... the message is diectly: rtsps://XXX?egressToken=XXX&userAgent=iOS&cameraId=XXX: Operation not permitted

iRayanKhan commented 5 years ago

I can open the VLC stream on my end for my camera's. I may need to get the exact camera size for it.

Phoenix-DH commented 5 years ago

Hi, I tried via VLC now... The message will be the following:

Your input can't be opened
VLC is unable to open the MRL 'srtp://192.168.XXX.XXX:12345?rtcpport=12345&localrtcpport=12345&pkt_size=1316'. Check the log for details.

Result will be the same with all 3 cams.

And in cmd this for all 3: rtsps://XXX?egressToken=XXX&userAgent=iOS&cameraId=XXX: Operation not permitted

Partizan7676 commented 5 years ago

@Phoenix-DH can you check config? i see few mistakes here - srtp, rtsps i expect rtsp

Phoenix-DH commented 5 years ago

@Partizan7676: At which point?

Like I said, I am using the ARLO version .... There is only minimal config ....

If I change the external value then I got this: rtsp://vzwow125-z1-prod.vz.netgear.com:443/vzmodulelive/XXX_XXX?egressToken=XXX: Invalid data found when processing input

If I cahnge the local one VLC can also not open the stream. VLC is unable to open the MRL 'rtsp://192.168.XXX.XXX:12345?rtcpport=12345&localrtcpport=12345&pkt_size=1316'. Check the log for details.

It is hard to test manualy, because I think the ports are changing quickly ...

llemtt commented 5 years ago

@Phoenix-DH

maybe you are making a little confusion between "rtsp" and "srtp":

output from plugin to iOS is "srtp" which is the secure version of "rtp"

input from camera (usually) is "rtsp" that may use "rtp" protocol as an underlying transport

Anyway this:

rtsp://vzwow125-z1-prod.vz.netgear.com:443/vzmodulelive/XXX_XXX?egressToken=XXX: Invalid data found when processing input

means that input from your cam doesn't work!

Try first with simplified command:

ffmpeg -v verbose -i rtsp://vzwow125-z1-prod.vz.netgear.com:443/vzmodulelive/XXX_XXX?egressToken=XXX

p.s. anyway is not possible to directly open the (srtp) output from the plugin with VLC as you tried!

Phoenix-DH commented 5 years ago

@llemtt and guys: Thanks for having this support. Now I am understanding this whole output/input on homebridge. First part is the delivery from ARLO and the second part is delivery the stream to my end device. To be honest, I am not really familiar with this streaming things .... on my way to learn.

I will try the command ... ffmpeg -v verbose -i rtsp://vzwow23-z1-prod.vz.netgear.com:443/vzmodulelive/XXX?egressToken=XXX The result of this command is:

ffmpeg version 3.2.10-1~deb9u1+rpt2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
  configuration: --prefix=/usr --extra-version='1~deb9u1+rpt2' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx-rpi --enable-mmal --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --arch=armhf --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100

rtsp://vzwow125-z1-prod.vz.netgear.com:443/vzmodulelive/XXX_XXX?egressToken=XXX: Invalid data found when processing input

Maybe problem with ARLO python lib? Here I got version 1.1.18

Snapshots are working, only live video not.


Did additional tests ... due to the fact that everytime this tokens are different ... really hard.

Partizan7676 commented 5 years ago

now i get same issue. i can get snapshots but no live video. can someone explain how to clone repo with git clone of exact version - 3.2.12 how compile my own ffmpeg i know.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.