Skip to content

Patch that gets video working on my model #2

Description

@gh33291

I have two similar 3-camera solar wifi devices. Note sure what information would be useful. The equipment model on the one says HsAKQQCC and the firmware is HwHsAkQQCC_WIFI_BP5_QX68_20230421.

Video and audio decoding were failing, so I asked AI for a patch and it came up with this (which gets video working on both of my cameras):

        // === VIDEO HANDLER for your firmware: 0x28 + 0x29 = H.265 video ===
        if (rawType == 0x28 || rawType == 0x29)
        {
            const int headerSize = 16;
            if (full.Length <= headerSize) return false;

            byte[] payload = new byte[full.Length - headerSize];
            Array.Copy(full, headerSize, payload, 0, payload.Length);

            if (needDecrypt && payload.Length >= 16)
            {
                DecryptVideoFrame(payload, payload.Length);
            }

            bool keyFrame = IsKeyVideoFrame(rawType, outerFrameType, payload);

            if (mode == OutputMode.Rtsp)
            {
                snapshotManager.UpdateFrame(payload, frameWidth, frameheight, keyFrame, outerTimestamp);
            }

            var vFrame = new FrameData
            {
                RawType   = rawType,
                FrameId   = outerFrameId,
                FrameType = outerFrameType,
                FrameRate = outerFrameRate,
                Timestamp = outerTimestamp,
                Codec     = VideoCodec.H265,
                Payload   = payload
            };

            if (mode == OutputMode.Video)
            {
                stdout?.Write(payload, 0, payload.Length);
                stdout?.Flush();
            }
            else if (mode == OutputMode.Rtsp)
            {
                rtsp?.PushVideo(vFrame);
            }

            return true;
        }

It also identified rawType == 0x18 as AAC audio, but I don't need audio, so I just disabled that for now.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions