petergeneric / unifi-protect-remux

Tool to help remux .ubv files from Ubiquiti's Unifi Protect system so they can be turned into standard .mp4 files
GNU Affero General Public License v3.0
272 stars 19 forks source link

Add Support for H265 HEVC Encoding #43

Open mattreidy opened 1 month ago

mattreidy commented 1 month ago

UniFi Protect Application 4.0.21 now adds H265 HEVC as an option for newer cameras and is used when "Enhanced" encoding is selected in the camera recording settings. ("Standard" encoding continues to be H.264).

It would be great if this utility could support both types of encoding.

https://community.ui.com/releases/UniFi-Protect-Application-4-0-21/6890a055-2a90-4011-a3e6-18f8e290244f

mattreidy commented 1 month ago

I'm unsure of the actual format of the UBV file when Enhanced encoding is used, but the remux utility does not work with it.

petergeneric commented 1 month ago

It's likely a simple matter of changing how the bitstream is processed, or reading from a different track - do you have a sample .ubv that you are able to share without any identifying information that I could use for development purposes?

mattreidy commented 1 month ago

Here's a file wit the enhanced encoding - it would be ideal if the program could determine which encoding was used and automatically handle it vs. needing to pass in a flag etc. Thanks for responding and taking a look! I use the program to snatch a clip from a specific camera every 5 minutes and make it available as a "live" video on a web page - www.keuka.org

https://drive.google.com/file/d/1gIkG3MATIBWWOpDzRPCsJ2Xwg_fAnJQg/view?usp=sharing

petergeneric commented 1 month ago

Thanks for the sample file - I'll have a look to see what's different in the structure. I would also hope to have it natively detect and extract H264/H265 depending on what is in the file.

FYI if you haven't already tried it, give Ubiquiti's native tool a go - it is available at /usr/share/unifi-protect/app/node_modules/.bin/ubnt_ubvexport (at least on my cloudkey). I built this tool before Ubiquiti provided that, and while I still think my tool is able to recover more from corrupted files ubnt_ubvexport seems to work well on normal files.