Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi Hardware Acceleration not working #188

Closed
Ironboltx opened this issue Feb 21, 2021 · 4 comments
Closed

Raspberry Pi Hardware Acceleration not working #188

Ironboltx opened this issue Feb 21, 2021 · 4 comments
Labels
bug Something isn't working unconfirmed Issue has not been verified

Comments

@Ironboltx
Copy link

Ironboltx commented Feb 21, 2021

Describe The Bug:

Logs say 'conversion failed' when I try to stream my SimpliSafe camera from homekit with hardware acceleration on.

To Reproduce:

Turn on hardware acceleration for RPi, restart, and then stream from the camera .

Expected behavior:

The camera to start streaming with hardware acceleration on

Environment:

  • Plugin version: 1.6.17
  • Node.js Version: 12.20.0
  • NPM Version: 6.14.8
  • Homebridge Version: 1.3.0
  • Operating System: Homebridge Raspberry Pi Image on Raspberry pi 4

Homebridge Config:

{
            "name": "Security System",
            "auth": {
                "username": "removed",
                "password": "removed"
            },
            "cameras": true,
            "debug": true,
            "sensorRefresh": 5,
            "persistAccessories": false,
            "resetSimpliSafeId": false,
            "cameraOptions": {
                "enableHwaccelRpi": true
            },
            "platform": "homebridge-simplisafe3.SimpliSafe 3"
        },

Screenshots:

Logs:

[2/20/2021, 19:01:18] [Security System] Start streaming video for camera 'removed'
[2/20/2021, 19:01:18] [Security System] /usr/local/lib/node_modules/homebridge-simplisafe3/node_modules/ffmpeg-for-homebridge/ffmpeg -re -headers Authorization: Bearer removed= -vcodec h264_mmal -i https://removed/flv?x=1280&audioEncoding=AAC -map 0:0 -vcodec h264_omx -pix_fmt yuv420p -r 20 -f rawvideo -vf scale=1280:-2 -b:v 284k -bufsize 568k -maxrate 284k -payload_type 99 -ssrc 9811427 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params removed srtp://removedpkt_size=1378 -map 0:1 -acodec libfdk_aac -flags +global_header -profile:a aac_eld -ac 1 -ar 16k -b:a 24k -bufsize 48k -payload_type 110 -ssrc 3519933 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params MMF1gTWEc+4ezzFePDXXXiTR7oG4+fiKKg7F96GM srtp://removedpkt_size=188
[2/20/2021, 19:01:18] [Security System] FFMPEG received first frame
[2/20/2021, 19:01:18] [Security System] ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 6.3.0 (Raspbian 6.3.0-18+rpi1+deb9u1) 20170516
  configuration: --pkgconfigdir=/build/workspace/lib/pkgconfig --prefix=/build/workspace --pkg-config-flags=--static --extra-cflags=-I/build/workspace/include --extra-ldflags=-L/build/workspace/lib --extra-libs='-lpthread -lm' --enable-static --disable-debug --disable-shared --disable-ffplay --disable-doc --enable-openssl --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-runtime-cpudetect --enable-libfdk-aac --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-libspeex --enable-demuxer=rtsp --enable-omx-rpi --enable-mmal --enable-indev=alsa --enable-outdev=alsa

[2/20/2021, 19:01:18] [Security System]   libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100

[2/20/2021, 19:01:18] [Security System] [https @ 0x411e2e0] No trailing CRLF found in HTTP header. Adding it.

[2/20/2021, 19:01:21] [Security System] Input #0, flv, from 'https://removed/flv?x=1280&audioEncoding=AAC':
  Metadata:
    encoder         : Lavf56.40.101
  Duration: 00:00:00.00, start: 0.000000, bitrate: N/A

[2/20/2021, 19:01:21] [Security System]     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 20 fps, 20 tbr, 1k tbn, 40 tbc
    Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp, 96 kb/s

[2/20/2021, 19:01:21] [Security System] Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_mmal) -> h264 (h264_omx))
  Stream #0:1 -> #1:0 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help

[2/20/2021, 19:01:21] [Security System] Output #1, rtp, to 'srtp://removed&pkt_size=188':
  Metadata:
    encoder         : Lavf58.45.100

[2/20/2021, 19:01:21] [Security System]     Stream #1:0: Audio: aac (libfdk_aac) (ELD), 16000 Hz, mono, s16, 24 kb/s
    Metadata:
      encoder         : Lavc58.91.100 libfdk_aac

[2/20/2021, 19:01:22] [Security System] [h264_mmal @ 0x41dacc0] Changing output format.

[2/20/2021, 19:01:22] [Security System] [h264_omx @ 0x4137180] Using OMX.broadcom.video_encode

[2/20/2021, 19:01:22] [Security System] [h264_omx @ 0x4137180] OMX error 80001000
[h264_omx @ 0x4137180] err 80001018 (-2147479528) on line 561

[2/20/2021, 19:01:22] [Security System] Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

[2/20/2021, 19:01:22] [Security System] [libfdk_aac @ 0x41ce5b0] 1 frames left in the queue on closing

[2/20/2021, 19:01:22] [Security System] Conversion failed!

[2/20/2021, 19:01:22] [Security System] Error: FFmpeg exited with code 1

@Ironboltx Ironboltx added bug Something isn't working unconfirmed Issue has not been verified labels Feb 21, 2021
@shamoon
Copy link
Collaborator

shamoon commented Feb 21, 2021

Hey there @Ironboltx . Was this working previously for you or never? And what happens if you disable hw acceleration?

Unfortunately, I don’t have a RPi4 to test. When this was implemented it was working on RPi3b which I can dig out and check again but it might be tough if it works on 3b and I can’t test on a 4.

@Ironboltx
Copy link
Author

Ironboltx commented Feb 21, 2021

It used to work before but stopped working a few months ago. Should I use it? I was just wondering if I should use it for higher video quality and to have the video stream start faster.

EDIT: If I don't use hardware acceleration the camera works just fine.

@shamoon
Copy link
Collaborator

shamoon commented Feb 22, 2021

Hmm, yea since I dont have an RPi4 I just cant test this or really do much debugging. I recall you had to change GPU settings to fix your previous issue #126 and looking around this error might be related? https://www.reddit.com/r/raspberry_pi/comments/5677qw/hardware_accelerated_x264_encoding_with_ffmpeg/da5ufjh/?utm_source=reddit&utm_medium=web2x&context=3 & Sunoo/homebridge-camera-ffmpeg#38

But nothing in this plugin has changed in the intervening months so Im not sure there is in fact an issue here...

@Ironboltx
Copy link
Author

Weird... looks like the gpu_mem was set back to 64 in the config? I set it to 512 and now it is now working. Thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed Issue has not been verified
Projects
None yet
Development

No branches or pull requests

2 participants