{"action":"created","issue":{"url":"https://api.github.com/repos/KhaosT/homebridge-camera-ffmpeg/issues/248","repository_url":"https://api.github.com/repos/KhaosT/homebridge-camera-ffmpeg","labels_url":"https://api.github.com/repos/KhaosT/homebridge-camera-ffmpeg/issues/248/labels{/name}","comments_url":"https://api.github.com/repos/KhaosT/homebridge-camera-ffmpeg/issues/248/comments","events_url":"https://api.github.com/repos/KhaosT/homebridge-camera-ffmpeg/issues/248/events","html_url":"https://github.com/KhaosT/homebridge-camera-ffmpeg/issues/248","id":393690219,"node_id":"MDU6SXNzdWUzOTM2OTAyMTk=","number":248,"title":"Video Stream not working: iSlices >= MAX_SLICES  Stop!","user":{"login":"Vortec4800","id":396122,"node_id":"MDQ6VXNlcjM5NjEyMg==","avatar_url":"https://avatars3.githubusercontent.com/u/396122?v=4","gravatar_id":"","url":"https://api.github.com/users/Vortec4800","html_url":"https://github.com/Vortec4800","followers_url":"https://api.github.com/users/Vortec4800/followers","following_url":"https://api.github.com/users/Vortec4800/following{/other_user}","gists_url":"https://api.github.com/users/Vortec4800/gists{/gist_id}","starred_url":"https://api.github.com/users/Vortec4800/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vortec4800/subscriptions","organizations_url":"https://api.github.com/users/Vortec4800/orgs","repos_url":"https://api.github.com/users/Vortec4800/repos","events_url":"https://api.github.com/users/Vortec4800/events{/privacy}","received_events_url":"https://api.github.com/users/Vortec4800/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-12-22T17:32:09Z","updated_at":"2018-12-23T00:54:21Z","closed_at":null,"author_association":"NONE","body":"I'm having an issue streaming to any devices. I'm able to open the camera stream in VLC, and it appears that the video stream is being created properly. Here is the ffmpeg output, which looks (to me) normal:\r\n\r\n```\r\n[12/22/2018, 11:25:28 AM] [Camera-ffmpeg] Start streaming video from Garage Cam with 1280x720@200kBit\r\nffmpeg -rtsp_transport tcp -re -i rtsp://admin:xxx@192.168.1.21:554/Streaming/Channels/103/ -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 30 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 200k -bufsize 200k -payload_type 99 -ssrc 731600 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params m8vVsRiOg55ZYSt04Z+2wDj8i6q14JOFYaSQdtl3 srtp://192.168.1.45:50754?rtcpport=50754&localrtcpport=50754&pkt_size=188\r\nffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers\r\n  built with Apple LLVM version 9.1.0 (clang-902.0.39.2)\r\n  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma\r\n\r\n  libavutil      56. 14.100 / 56. 14.100\r\n  libavcodec     58. 18.100 / 58. 18.100\r\n  libavformat    58. 12.100 / 58. 12.100\r\n  libavdevice    58.  3.100 / 58.  3.100\r\n  libavfilter     7. 16.100 /  7. 16.100\r\n  libavresample   4.  0.  0 /  4.  0.  0\r\n  libswscale      5.  1.100 /  5.  1.100\r\n  libswresample   3.  1.100 /  3.  1.100\r\n  libpostproc    55.  1.100 / 55.  1.100\r\n\r\nInput #0, rtsp, from 'rtsp://admin:xxx@192.168.1.21:554/Streaming/Channels/103/':\r\n  Metadata:\r\n    title           : Media Presentation\r\n\r\n  Duration: N/A, start: 0.383333, bitrate: N/A\r\n    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 15 fps, 20 tbr, 90k tbn, 30 tbc\r\n\r\nStream mapping:\r\n\r\n  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))\r\nPress [q] to stop, [?] for help\r\n\r\nframe=    0 fps=0.0 q=0.0 size=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A    \r\n[swscaler @ 0x7ffb1e210c00] deprecated pixel format used, make sure you did set range correctly\r\n\r\n[libx264 @ 0x7ffb1b80c200] VBV maxrate unspecified, assuming CBR\r\n[libx264 @ 0x7ffb1b80c200] \r\nusing SAR=1/1\r\n\r\n[libx264 @ 0x7ffb1b80c200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX\r\n\r\n[libx264 @ 0x7ffb1b80c200] profile High, level 3.1\r\n\r\nOutput #0, rtp, to 'srtp://192.168.1.45:50754?rtcpport=50754&localrtcpport=50754&pkt_size=188':\r\n  Metadata:\r\n    title           : Media Presentation\r\n    encoder         : Lavf58.12.100\r\n    Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 30 fps, 90k tbn, 30 tbc\r\n    Metadata:\r\n      encoder         : Lavc58.18.100 libx264\r\n    Side data:\r\n      \r\ncpb: bitrate max/min/avg: 0/0/200000 buffer size: 200000 vbv_delay: -1\r\n\r\nframe=    2 fps=2.0 q=62.0 size=       6kB time=00:00:00.03 bitrate=1443.1kbits/s dup=0 drop=5 speed=0.0329x    \r\nframe=   15 fps=9.9 q=44.0 size=      16kB time=00:00:00.46 bitrate= 283.4kbits/s dup=6 drop=5 speed=0.307x    \r\nframe=   32 fps= 16 q=43.0 size=      27kB time=00:00:01.03 bitrate= 214.5kbits/s dup=15 drop=5 speed=0.509x    \r\nframe=   47 fps= 18 q=44.0 size=      46kB time=00:00:01.53 bitrate= 246.7kbits/s dup=22 drop=5 speed=0.602x    \r\nframe=   62 fps= 20 q=43.0 size=      52kB time=00:00:02.03 bitrate= 211.3kbits/s dup=30 drop=5 speed=0.665x    \r\nframe=   77 fps= 22 q=41.0 size=      64kB time=00:00:02.53 bitrate= 208.0kbits/s dup=37 drop=5 speed=0.709x    \r\nframe=   91 fps= 22 q=42.0 size=      76kB time=00:00:03.00 bitrate= 207.9kbits/s dup=44 drop=5 speed=0.736x   \r\n```\r\n\r\nI grabbed HomeKit logs from the Console app and found some things that look suspicious. A bunch of these appear while the stream tries to load:\r\n\r\n```\r\ndefault\t11:25:37.624443 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.627099 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.722414 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.725916 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.772133 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.812770 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.816847 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.817019 -0600\tavconferenced\t [WARNING] AssembleFrame_H264:1184 *** BAD FRAME -- 8: iSlices >= MAX_SLICES  Stop!\r\ndefault\t11:25:37.896356 -0600\tavconferenced\tVCMediaStream [INFO] -[VCMediaStream rtcpSendHeartbeat]:955 RTCP HeartBeat intervalElapsed:1 remainingInterval:0.00000\r\ndefault\t11:25:37.896356 -0600\tavconferenced\t_myPeriodicTask: Started RT periodic task\r\ndefault\t11:25:37.896456 -0600\tavconferenced\t [INFO] -[VCVideoStreamRateAdaptation runVideoStreamRateAdaptation]:80 packetsExpectedForInterval:90 packetsLostForInterval:0\r\ndefault\t11:25:37.896522 -0600\tavconferenced\t [NOTICE] -[VCVideoStreamReceiver gatherRealtimeStats:]:1013 VideoStreamStats - Rx - framerate:0.000000, bitrate:0kbps\r\nerror\t11:25:37.896616 -0600\tavconferenced\t [ERROR] -[VCVideoStreamRateAdaptation runVideoStreamRateAdaptation]:89 <private>:89 - Failed to receive TMMBN!\r\n```\r\n\r\nIt seems like the frames being generated have too many slices. Unfortunately I don't know what a slice is or how to adjust it. I tried doing some obvious things like lowing the bitrate and packet size but that didn't help. This is a 720p stream at 30fps which seems pretty standard.\r\n\r\nAnyone have some expertise on this?"},"comment":{"url":"https://api.github.com/repos/KhaosT/homebridge-camera-ffmpeg/issues/comments/449606897","html_url":"https://github.com/KhaosT/homebridge-camera-ffmpeg/issues/248#issuecomment-449606897","issue_url":"https://api.github.com/repos/KhaosT/homebridge-camera-ffmpeg/issues/248","id":449606897,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0OTYwNjg5Nw==","user":{"login":"KhaosT","id":1725664,"node_id":"MDQ6VXNlcjE3MjU2NjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1725664?v=4","gravatar_id":"","url":"https://api.github.com/users/KhaosT","html_url":"https://github.com/KhaosT","followers_url":"https://api.github.com/users/KhaosT/followers","following_url":"https://api.github.com/users/KhaosT/following{/other_user}","gists_url":"https://api.github.com/users/KhaosT/gists{/gist_id}","starred_url":"https://api.github.com/users/KhaosT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KhaosT/subscriptions","organizations_url":"https://api.github.com/users/KhaosT/orgs","repos_url":"https://api.github.com/users/KhaosT/repos","events_url":"https://api.github.com/users/KhaosT/events{/privacy}","received_events_url":"https://api.github.com/users/KhaosT/received_events","type":"User","site_admin":false},"created_at":"2018-12-23T00:54:21Z","updated_at":"2018-12-23T00:54:21Z","author_association":"OWNER","body":"Actually you don't need to modify code, try add `\"additionalCommandline\": \"-x264-params \\\"intra-refresh=1:bframes=0\\\"\"` to your `videoConfig` section in config.json and switch back to `libx264` and see if that solves your issue.\r\n\r\nFinal config will look like this\r\n```\r\n{\r\n\t\"platform\": \"Camera-ffmpeg\",\r\n\t\"cameras\": [{\r\n\t\t\"name\": \"Camera Name\",\r\n\t\t\"videoConfig\": {\r\n\t\t\t\"source\": \"-re -i rtsp://myfancy_rtsp_stream\",\r\n\t\t\t\"stillImageSource\": \"-i http://faster_still_image_grab_url/this_is_optional.jpg\",\r\n\t\t\t\"maxStreams\": 2,\r\n\t\t\t\"maxWidth\": 1280,\r\n\t\t\t\"maxHeight\": 720,\r\n\t\t\t\"maxFPS\": 30,\r\n\t\t\t\"additionalCommandline\": \"-x264-params \\\"intra-refresh=1:bframes=0\\\"\"\r\n\t\t}\r\n\t}]\r\n}\r\n```"}}
{"actor":{"display_login":"KhaosT"}}