Operation not permitted error
fancypantsifier opened this issue · 1 comments
Describe The Bug:
I built my own ffmpeg-for-homebridge by cloning this repo and running the build-ffmpeg script myself. I'm on an older Mac mini running an old OS. I had to update a few linker paths and install a few libs with MacPorts to get it to work (specifically libiconv and liblzma), but eventually got it to build and link seemingly successfully.
I'm using this custom-built ffmpeg with the Simplisafe3 plugin for HomeBridge, as the custom ffmpeg path. I am not supplying any other custom arguments.
When I open a camera stream, I get "Operation not permitted" and "Error writing trailer" errors, as shown below. Please note that I have already been discussing with the Simplisafe3 plugin developers, and they seem to think this is an ffmpeg issue.
[1/12/2022, 12:27:18 PM] [Simplisafe Alarm] Start streaming video for camera 'Front Door'
[1/12/2022, 12:27:18 PM] [Simplisafe Alarm] /usr/local/bin/ffmpeg -re -headers Authorization: Bearer <REDACTED>/flv?x=1280&audioEncoding=AAC -map 0:0 -vcodec libx264 -tune zerolatency -preset superfast -pix_fmt yuv420p -r 20 -f rawvideo -vf scale=1280:-2 -b:v 284k -bufsize 568k -maxrate 284k -payload_type 99 -ssrc 5209053 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params QdPw9T7GaKdfqo/HiOqCC1/cWP6vNFgnuQzO/biq srtp://192.168.1.44:53597?rtcpport=53597&localrtcpport=53597&pkt_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 11426258 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params sW1zV49wp2SayN7f5Ilc0UrTCI6TTcN72GyOQSj+ srtp://192.168.1.44:57188?rtcpport=57188&localrtcpport=57188&pkt_size=188
[1/12/2022, 12:27:18 PM] [Simplisafe Alarm] FFMPEG received first frame
[1/12/2022, 12:27:18 PM] [Simplisafe Alarm] ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --enable-videotoolbox --pkgconfigdir=/Users/<REDACTED>/dev/ffmpeg-for-homebridge-master/workspace/lib/pkgconfig --prefix=/Users/<REDACTED>/dev/ffmpeg-for-homebridge-master/workspace --pkg-config-flags=--static --extra-cflags=-I/Users/<REDACTED>/dev/ffmpeg-for-homebridge-master/workspace/include --extra-ldflags='-L/Users/<REDACTED>/dev/ffmpeg-for-homebridge-master/workspace/lib -L/opt/local/lib' --extra-libs='-lpthread -lm -lz -liconv' --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
[1/12/2022, 12:27:18 PM] [Simplisafe Alarm] 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
[1/12/2022, 12:27:18 PM] [Simplisafe Alarm] [https @ 0x7fd9fbc17380] No trailing CRLF found in HTTP header. Adding it.
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] Input #0, flv, from 'https://<REDACTED>/v1/<REDACTED>/flv?x=1280&audioEncoding=AAC':
Metadata:
encoder : Lavf56.40.101
Duration:
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] 00:00:00.00, start: 0.000000, bitrate: N/A
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
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #1:0
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] Output #1, rtp, to 'srtp://192.168.1.44:57188?rtcpport=57188&localrtcpport=57188&pkt_size=188':
Metadata:
encoder : Lavf58.45.100
Stream #1:0: Audio: aac (libfdk_aac) (ELD), 16000 Hz, mono, s16, 24 kb/s
Metadata:
encoder : Lavc58.91.100 libfdk_aac
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] [swscaler @ 0x7fd9fc14b600] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x7fd9fc85f000] using SAR=1/1
[libx264 @ 0x7fd9fc85f000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] [libx264 @ 0x7fd9fc85f000] profile High, level 3.1, 4:2:0, 8-bit
Output #0, rtp, to 'srtp://192.168.1.44:53597?rtcpport=53597&localrtcpport=53597&pkt_size=1378':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 284 kb/s, 20 fps, 90k tbn, 20 tbc
Metadata:
encoder : Lavc58.91.100 libx264
Side data:
cpb: bitrate max/min/avg: 284000/0/284000 buffer size: 568000 vbv_delay: N/A
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] av_interleaved_write_frame(): Operation not permitted
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] Error writing trailer of srtp://192.168.1.44:53597?rtcpport=53597&localrtcpport=53597&pkt_size=1378: Operation not permitted
frame= 1 fps=0.0 q=40.0 Lsize= 2kB time=00:00:00.17 bitrate= 80.0kbits/s speed=0.805x
video:2kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] [libx264 @ 0x7fd9fc85f000] frame I:1 Avg QP:33.03 size: 1712
[libx264 @ 0x7fd9fc85f000] mb I I16..4: 99.0% 0.4% 0.6%
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] [libx264 @ 0x7fd9fc85f000] 8x8 transform intra:0.4%
[libx264 @ 0x7fd9fc85f000] coded y,uvDC,uvAC intra: 0.7% 0.6% 0.0%
[libx264 @ 0x7fd9fc85f000] i16 v,h,dc,p: 88% 7% 5% 0%
[libx264 @ 0x7fd9fc85f000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 12% 57% 5% 0% 5% 2% 0% 5%
[libx264 @ 0x7fd9fc85f000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 12% 22% 4% 4% 4% 9% 2% 8%
[libx264 @ 0x7fd9fc85f000] i8c dc,h,v,p: 96% 1% 3% 0%
[libx264 @ 0x7fd9fc85f000] kb/s:273.92
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] Conversion failed!
[1/12/2022, 12:27:22 PM] [Simplisafe Alarm] Error: FFmpeg exited with code 1
To Reproduce:
- Install Simplisafe3 plugin, enable Camera support, set the custom ffmpeg path to the ffmpeg binary built using this repo.
- In the Home App (e.g. on iOS or on a Mac), click on a Simplisafe camera to open its live feed.
- Observe the messages above in the log.
Expected behavior:
I expect to see a live view in the Home App, and no errors in the log.
ffmpeg output:
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-avresample --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-librsvg --enable-libtheora --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libsoxr --enable-libspeex --enable-libass --enable-libbluray --enable-libzvbi --enable-lzma --enable-gnutls --enable-fontconfig --enable-libfreetype --enable-libfribidi --enable-zlib --disable-libjack --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --disable-indev=jack --enable-opencl --disable-outdev=xv --enable-audiotoolbox --enable-videotoolbox --enable-sdl2 --disable-securetransport --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --enable-libzimg --enable-libdav1d --arch=x86_64 --enable-x86asm --enable-libx265 --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Environment:
- Operating System: macOS 10.11.6 (El Capitan), running on an old Mac Mini
- MacPorts 2.7.1
- Node.js v16.13.2
- npm v8.3.0
Figured it out: My (headless) Mac Mini had a dialog box waiting for me to approve network connections for ffmpeg. I'd been doing all the installation via SSH so never saw it. 🤦 Once I clicked Allow, the stream from one camera started working.