homebridge-dafang icon indicating copy to clipboard operation
homebridge-dafang copied to clipboard

Video stream stops after few seconds on Homekit

Open SSkull995 opened this issue 6 years ago • 12 comments

Hi guys! I have a problem related to the streaming of the imagine on my Homekit app. I have a Xiaomi Dafang and the Dafang plugin, I managed to get rid of the "ffmpeg exited with code 1" error by setting audio:false. If I go on my camera ip, I can see the streamed image, a bit slow but it is shown. However, as soon as I start the streaming on Homekit, this is the output:

[2019-1-27 09:35:55] [Dafang] Start streaming video from My Dafang with 640x360@132kBit ffmpeg -rtsp_transport tcp -i rtsp://192.168.21.106:8554/unicast -map 0:0 -vcodec h264 -pix_fmt yuv420p -r 15 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -maxrate 132k -payload_type 99 -ssrc 2826387 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params jfXEwe+u9Rc411YP11WUSypHEMEa/ZZxPhCJ4k8o srtp://192.168.21.132:60434?rtcpport=60434&localrtcpport=60434&pkt_size=1316 [2019-1-27 09:35:59] [Dafang] Stopped streaming

I then have a snapshot from the Dafang, kinda useless. Do you know how to get rid of the stopped streaming issue? I just cannot see the live image, it stops as soon as I tap on the camera on Homekit, really annoying! I also installed the ffmpeg plugin, just to try to avoid the issue, but it is the same! I tried to change the quality parameters, but I always get "stopped streaming" after maximum 10 seconds. Once more thank you in advance for the help!

SSkull995 avatar Jan 27 '19 15:01 SSkull995

Try using this config instead:

      "videoConfig": {
        "source": "-rtsp_transport tcp -i rtsp://10.0.1.44:8554/unicast",
        "stillImageSource": "-rtsp_transport http -i rtsp://10.0.1.44:8554/unicast -vframes 1 -r 1",
        "maxStreams": 5,
        "maxWidth": 1280,
        "maxHeight": 720,
        "maxFPS": 15,
        "debug": true,
        "audio": false
      }

mkormendy avatar Jan 28 '19 16:01 mkormendy

Hi @mkormendy! I use this already!

SSkull995 avatar Jan 28 '19 16:01 SSkull995

It seems that it tries to start, but then it reaches something that stops it

SSkull995 avatar Jan 28 '19 16:01 SSkull995

I run mine on MacOS High Sierra on a Mac Mini, so I'm not sure if the library that you're using for the ffmpeg is stable on Windows.

mkormendy avatar Jan 28 '19 16:01 mkormendy

I am running it on a raspi, never said Windows ahahaha On 28 Jan 2019, 17:52 +0100, Mike Kormendy [email protected], wrote:

I run mine on MacOS High Sierra on a Mac Mini, so I'm not sure if the library that you're using for the ffmpeg is stable on Windows. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

SSkull995 avatar Jan 28 '19 17:01 SSkull995

WhooPs! .. Wrong thread! 🤣

mkormendy avatar Jan 28 '19 18:01 mkormendy

Anyway, do you believe there could be something that can be done here?

SSkull995 avatar Jan 28 '19 21:01 SSkull995

Thanks!

SSkull995 avatar Jan 28 '19 21:01 SSkull995

Hi,

i have similar issues, i cannot find settings that make it work. still pictures are not a problem but streaming is unpossible.

Regards X23

x23piracy avatar Mar 08 '19 11:03 x23piracy

same issue, please help

my config:

{ "bridge": { "name": "Homebridge", "username": "CC:11:3D:E3:CE:30", "port": 51826, "pin": "031-45-154" },

"platforms": [
    {
        "platform": "Dafang",
        "mqtt": {
            "hostBroker": true,
            "port": 1883,
            "host": "localhost",
            "debug": true,
            "mongoUrl": "mongodb://localhost:27017/mqtt"
		},
        "cameras": [{
            "cameraName": "My Dafang",
            "cameraRTSPStreamUrl": "rtsp://192.168.1.21:8554/unicast",
            "mqttTopic": "myhome/dafang/#",
            "folder": "/Users/udogan/Documents/Recordings",
			"segmentLength": 60,
			"maxDirSize": 8192,
			"checkStorageSizeInterval": 300,
            "accessories": [
				{
					"name": "Living Room Motion Sensor",
					"type": "richMotionSensor",
					"threshold": 300000
				},
				{
					"name": "Living Room Auto Motion Tracking Switch",
					"type": "autoMotionTrackingSwitch"
				},
				{
					"name": "Living Room Night Vision Sensor",
					"type": "nightVisionSensor",
					"threshold": 0
				},
				{
					"name": "Living Room Night Vision Switch",
					"type": "nightVisionSwitch"
				},
				{
					"name": "Living Room Auto Night Vision Switch",
					"type": "autoNightVisionSwitch"
				},
				{
					"name": "Horizontal Left",
					"type": "moveCamera",
					"axis": "horizontal",
					"direction": "left"
				},
				{
					"name": "Horizontal Right",
					"type": "moveCamera",
					"axis": "horizontal",
					"direction": "right"
				},
				{
					"name": "Vertical Up",
					"type": "moveCamera",
					"axis": "vertical",
					"direction": "up"
				},
				{
					"name": "Vertical Down",
					"type": "moveCamera",
					"axis": "vertical",
					"direction": "down"
				},
				{
					"name": "Record Video",
					"type": "recordVideo"
				},
				{
					"name": "Record Audio",
					"type": "recordAudio"
				},
				{
					"name": "Capture Image",
					"type": "captureImage"
				},
				{
					"name": "RPi Storage Sensor",
					"type": "storageSensor"
				},
				{
					"name": "Clear Storage Switch",
					"type": "clearStorage"
				},
				{
					"name": "Reset Streaming",
					"type": "resetFFMPEG"
				},
				{
					"name": "Camera Brightness",
					"type": "brightness"
				}
			],
			"videoConfig": {
				"source": "-rtsp_transport tcp -i rtsp://192.168.1.21:8554/unicast",
				"stillImageSource": "-rtsp_transport http -i rtsp://192.168.1.21:8554/unicast -vframes 1 -r 1",
				"maxStreams": 5,
				"maxWidth": 1280,
				"maxHeight": 720,
				"maxFPS": 15,
				"debug": true,
				"audio": false
			}
		}]
	}
]

}

thecoldblooded avatar Jun 29 '19 20:06 thecoldblooded

any update on this issue? I have still images working on both OSX and IOS home.app but the stream only works on OSX. It stops after like 1 frame on IOS and then black screen.

I'm running out of ideas...

afbenevides avatar Jan 21 '20 02:01 afbenevides

I notice several people are using the "videoConfig" parameter block, but I don't see it mentioned in the plugin configuration instructions. I know homebridge-camera-ffmpeg uses these parameters, but does homebridge-dafang?

jlg89 avatar Sep 19 '20 15:09 jlg89