Skip to content

Tijn0/OpenDahua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenDahua

PyPI - Version GitHub License

Python SDK for interacting with Dahua NVRs (Network Video Recorders) over their proprietary peer-to-peer protocol.

Installation

You can install OpenDahua with your favorite python package manager!

pip install opendahua

or

uv add opendahua

Usage

Warning

Within the async with DahuaNVR(xxx) as nvr: block you should use async for all IO operations. The peer-to-peer connection might die if you don't do this.

import asyncio
from datetime import datetime, timedelta

from opendahua import DahuaNVR


async def main() -> None:
    async with DahuaNVR("SERIAL_NUMBER_HERE", "USERNAME_HERE", "PASSWORD_HERE") as nvr:
        all_video = await nvr.get_all_video(
            channel=1,
            time_start=datetime.now() - timedelta(days=1),
        )
        
        for video in all_video:
            path = await nvr.download_video(video, "videos/")
            
            # Example: videos/ExampleNVR_ch1_20260601135935_20260601140002.dav
            print(f"Video path: {path}")
        
if __name__ == "__main__":
    asyncio.run(main())

Special thanks to

  • khoanguyen-3fc/dh-p2p: The reverse engineering work and proof-of-concept that make this project possible.

About

Python SDK for communicating with Dahua NVRs and cameras over their proprietary peer-to-peer protocol.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages