Anyone else need a Hikvision Linux video codec?

TD22057

n3wb
Joined
Mar 14, 2015
Messages
26
Reaction score
1
I've purchased a few Hikvision cameras now and there are things that I really like about them (build quality, picture quality, firmware features like NFS and CIFS sharing, and especially price) but now I'm running into a few things that I really hate about them. I can sort of ignore the incredibly stupid firmware language/region locking stuff but the custom video codec is killing me.

I have an Ubuntu Linux box as my home server that I run a lot things on (plex, apache, file sharing, backups, etc). I have 3 cameras that are using CIFS shares to save motion events which works great. I don't want to expose these cameras to the internet but I want some way to access the real time streams and the saved videos from outside my LAN. So I though I would write a web page/server that re-streams the rtps streams for viewing and makes the saved videos available. All of that isn't a huge problem except for the fact that Hikvision uses a proprietary codec inside their mp4 video files. They provide a Windows DirectShow filter (sort of like a codec) so that WMP and VLC can play the videos but they don't provide one on Linux which makes this impossible.

I've looked at the 32 bit Linux iVMS-4200 software, the Android iVMS-4200 software, and the Windows video filter, and the Hikvision SDK and they all contain the same set of libraries. The Hikvision SDK has some documentation on what they do and it seems pretty clear that SystemTranform or StreamTransClient library provides the video conversion functions for the clients. The 64 bit Hikvision SDK has a note saying that 64 bit can't decode video which is discouraging but probably not a deal killer. I also found a stackoverflow question where someone claims they reverse engineered the Hikvision YUV2RBG algorithm which might also be helpful (optimization - optimize python nested loops for YUV2RGB conversion - Stack Overflow).

What I'm hoping to do is figure out how to wrap these libraries in some code to make a real Linux video codec so that ffmpeg and vlc can read and play these videos on Linux (32 and 64 bit). I am a Linux C++ developer in my day job but I have no experience with video processing or codec writing. Does anyone else need these capability? Or have video processing expertise they can share? Or have experience w/ the Hikvision SDK?

If people are interested in the result or can help w/ the coding, let me know and we can set up a github repository to collaborate on.

TD
 

TD22057

n3wb
Joined
Mar 14, 2015
Messages
26
Reaction score
1
rtsp://your_camera_ip in u VLC player
More specifically: rtsp://IP:554//Streaming/Channels/1 for the main stream or /2 for the sub stream.

There are really 2 separate issues that I need to resolve: streaming and playing saved videos. Streaming of the substream works on windows, linux, and android with vlc with mpeg or mp4 codec. Streaming of the main channel works on windows and android but dies on linux. I now think that the issue on linux is that the buffer sizes are too small for a full size 3MP stream since it can handle the substream in mp4. That should be fixable since vlc works fine on the other two platforms.

Trying to play a saved video works fine on windows (after installing the Hikvision software), works fine on android (strange), and fails on linux. It's possible the failure on linux is because of the same problem as the streaming and fixing one might fix both. I was originally trying to embed the saved mp4 file in a web page using the html 5 video element and that failed completely and it shouldn't really be related to whether or not vlc works or not. Though I guess if it's a limitation in the underlying codec library that could affect both processes.
 

hikcamuser

n3wb
Joined
May 1, 2015
Messages
15
Reaction score
0
I am not sure this helps you, but I am able to playback the recorded files just fine on fedora 21 with mplayer and vlc.

mplayer reports the file as being MPEG-PS format and it uses ffmpeg's ffh264 video decoder.
 

TD22057

n3wb
Joined
Mar 14, 2015
Messages
26
Reaction score
1
Thanks. I was able to get smaller resolution videos to play find on Ubuntu but for some reason vlc dies on the full 3 MP videos. I haven't had time to go back and see if it's resolution, bit rate, or what yet. So it's not really a codec problem at all - just something wrong w/ the software/memory/??? on my box.
 

hikcamuser

n3wb
Joined
May 1, 2015
Messages
15
Reaction score
0
Also, VLC in linux seems to play them at the correct speed; where as mplayer plays them at 2x speed... strange... :)
 

ximilion

n3wb
Joined
Nov 2, 2015
Messages
2
Reaction score
0
Hi , was able to play it in ubuntu 15.04 using pipelight by enabling hikvision plugin. Pipelight works with firefox but no longer work with chrome/chromium.
 

ximilion

n3wb
Joined
Nov 2, 2015
Messages
2
Reaction score
0
there is an error when first opening firefox after the installation ..something about a problem with webcomponents, just choose ignore. quit firefox. then open terminal window and do "sudo pipelight-plugin --create-mozilla-plugins"

---that should do it
 
Top