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

[BUG] - Plugin does not respect videoConfig parameters #68

Open
jlg89 opened this issue Sep 21, 2020 · 2 comments
Open

[BUG] - Plugin does not respect videoConfig parameters #68

jlg89 opened this issue Sep 21, 2020 · 2 comments

Comments

@jlg89
Copy link

jlg89 commented Sep 21, 2020

I have two cameras, both running the latest xiaomi-dafang-hacks firmware (currently 1127052).
One is a WyzeCam V2, the other is a WyzeCam Pan.
Onboard video for both cameras is configured as 768x432, SMART, 10fps, 300kbps.
In homebridge-dafang, the videoConfig block for both cameras matches these parameters.
However, the homebridge log shows that homebridge-dafang is using different parameters when streaming.
The plugin is using a lower resolution (640x360) than specified for the WyzeCam Pan, which is technically OK, but it's using a higher resolution (1280x720) than specified for the WyzeCam V2, which isn't OK.
What's happening here?

homebridge-dafang config block:

{
    "platform": "Dafang",
    "mqtt": {
        "hostBroker": false,
        "port": 1883,
        "host": "localhost",
        "debug": false
    },
    "cameras": [
        {
            "cameraName": "Gate Cam",
            "cameraRTSPStreamUrl": "rtsp://root:[email protected]:8554/unicast",
            "mqttTopic": "yonder-alerts/gatecam/#",
            "folder": "/home/hoobs/cameras/",
            "accessories": [
                {
                    "name": "Record Video - GateCam",
                    "type": "recordVideo"
                },
                {
                    "name": "Capture Image - GateCam",
                    "type": "captureImage"
                },
                {
                    "name": "Reset Streaming - GateCam",
                    "type": "resetFFMPEG"
                },
                {
                    "name": "GateCam Motion Sensor",
                    "type": "richMotionSensor",
                    "threshold": 500000
                }
            ],
            "videoConfig": {
                "source": "-i rtsp://192.168.77.13:8554/unicast",
                "stillImageSource": "-i rtsp://192.168.77.13:8554/unicast -vframes 1 -r 1",
                "maxStreams": 2,
                "maxWidth": 768,
                "maxHeight": 432,
                "maxFPS": 10,
                "audio": false,
                "debug": true
            }
        },
        {
            "cameraName": "Study Cam",
            "cameraRTSPStreamUrl": "rtsp://root:[email protected]:8554/unicast",
            "mqttTopic": "yonder-alerts/studycam/#",
            "folder": "/home/hoobs/cameras/",
            "accessories": [
                {
                    "name": "Record Video - StudyCam",
                    "type": "recordVideo"
                },
                {
                    "name": "Capture Image - StudyCam",
                    "type": "captureImage"
                },
                {
                    "name": "Reset Streaming - StudyCam",
                    "type": "resetFFMPEG"
                },
                {
                    "name": "Recalibrate Motor - StudyCam",
                    "type": "recalibrateSwitch"
                },
                {
                    "name": "StudyCam Motion Sensor",
                    "type": "richMotionSensor",
                    "threshold": 500000
                },
                {
                    "name": "Pan Left - StudyCam",
                    "type": "moveCamera",
                    "axis": "horizontal",
                    "direction": "left"
                },
                {
                    "name": "Pan Right - StudyCam",
                    "type": "moveCamera",
                    "axis": "horizontal",
                    "direction": "right"
                },
                {
                    "name": "Pan Up - StudyCam",
                    "type": "moveCamera",
                    "axis": "vertical",
                    "direction": "up"
                },
                {
                    "name": "Pan Down - StudyCam",
                    "type": "moveCamera",
                    "axis": "vertical",
                    "direction": "down"
                }
            ],
            "videoConfig": {
                "source": "-i rtsp://192.168.77.12:8554/unicast",
                "stillImageSource": "-i rtsp://192.168.77.12:8554/unicast -vframes 1 -r 1",
                "maxStreams": 2,
                "maxWidth": 768,
                "maxHeight": 432,
                "maxFPS": 10,
                "audio": false,
                "debug": true
            }
        }
    ]
}

homebridge log:

9/21/2020, 4:18:40 PM [Dafang] Start streaming video from Gate Cam with 1280x720@299kBit
9/21/2020, 4:18:40 PM ffmpeg -i rtsp://192.168.77.13:8554/unicast -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 748236 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params lrcu0D5ZKuX8mwtJItVVN/BaA8UpKdb80YgvpfTQ srtp://192.168.77.170:54856?rtcpport=54856&localrtcpport=54856&pkt_size=1316
9/21/2020, 4:19:05 PM [Dafang] Snapshot from Study Cam at 640x360
9/21/2020, 4:19:05 PM ffmpeg -i rtsp://192.168.77.12:8554/unicast -vframes 1 -r 1 -t 1 -s 640x360 -f image2 -
9/21/2020, 4:19:06 PM [Dafang] Stopped streaming
9/21/2020, 4:19:09 PM [Dafang] Start streaming video from Study Cam with 640x360@132kBit
9/21/2020, 4:19:09 PM ffmpeg -i rtsp://192.168.77.12:8554/unicast -map 0:0 -vcodec libx264 -pix_fmt yuv420p -r 10 -f rawvideo -tune zerolatency -vf scale=640:360 -b:v 132k -bufsize 132k -maxrate 132k -payload_type 99 -ssrc 7754990 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Zb6Dn6AivPY+nLKc+vo9rACGIAhuj6d56IT5gTPF srtp://192.168.77.170:49777?rtcpport=49777&localrtcpport=49777&pkt_size=1316
9/21/2020, 4:19:36 PM [Dafang] Stopped streaming
@jlg89
Copy link
Author

jlg89 commented Sep 22, 2020

This would probably fix #62 as well.

@jlg89
Copy link
Author

jlg89 commented Sep 23, 2020

See the conclusion of #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant