Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize Qt Haikang sdk Video Storage

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to achieve Qt Haikang sdk video storage". In daily operation, I believe many people have doubts about how to achieve Qt Haikang sdk video storage. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to achieve Qt Haikang sdk video storage". Next, please follow the editor to study!

I. Preface

With regard to calling Haikang sdk for video storage, the overall framework processing flow follows the previous practice of vlc kernel, ffmpeg kernel and mpv kernel. Save this piece regularly, turn on a timer to judge, close the original video storage first, then start a new video storage and re-pass in the new file name, so the code of this block can be copied directly and can be used. What to do is to replace two lines of code, one line is to start the video storage function NET_DVR_SaveRealData, one line is to stop the recording storage function NET_DVR_StopSaveRealData, Haikang sdk manual is very detailed, and the naming is more standard, basically through the method function name can know the general meaning, do not have to guess.

In the same category as video storage function, there is a screenshot function, which is implemented in vlc kernel, ffmpeg kernel and mpv kernel. Three kinds of screenshots are summarized. The first is a screenshot in handle mode, which needs to be executed by calling the function of the relevant sdk, and the resolution is the original image. The second is the screenshot in callback mode, which has got the data of the picture, and you can directly take the picture of the saved video in the form with the resolution of the original image; the third is the screenshot of the form, that is, the screenshot of the current video form, and the resolution is the size of the current form.

With regard to the three functions of opening video files, video storage and screenshot saving, we should pay special attention to the Chinese path. Of course, if there is only an English path, there is no need to do any processing, but for Chinese people to use it, the Chinese path is inevitable. There are two possible ways to deal with it, one is to convert the path to utf8 format, and the other is to use QTextCodec to specify gb2312 format to redirect the path to take effect. For example, under the Haikang sdk kernel, otherwise the path is likely to fail.

II. Functional features

Support for playback of video streams and local MP4 files.

Both handle and callback modes are supported.

Multi-thread display image, do not card the main interface.

Automatically reconnect the webcam.

The border size can be set, that is, the offset and the border color.

You can set whether to draw OSD tags, that is, label text or pictures and label locations.

There are two OSD locations and styles that can be set.

You can set whether to save to a file and the file name.

You can drag the file directly to the haikangwidget control to play.

H364/h365 video streaming is supported.

Playback can be paused and resumed.

Support for storing individual video files and storing video files at regular intervals.

Customize the top suspension bar and send click signal notification, which can be set whether it is enabled or not.

Can set screen stretch fill or proportional fill.

Programmable decoding is speed priority, quality priority and balanced processing.

You can take screenshots (original pictures) and screenshots (video forms) of the video.

The video file is stored as a MP4 file.

Support focal length control, head control.

Customizable function.

Third, effect picture

4. Core code void HaiKangThread::initSave () {if (! saveFile | |! isRtsp) {return;} if (saveInterval = = 0) {saveVideo (fileName);}} void HaiKangThread::saveVideo () {if (! saveFile | |! isRtsp) {return;} / / reset the file name QString dirName = QString ("% 1max% 2") .arg (savePath) .arg (QDATE); newDir (dirName) FileName = QString ("% 1/%2_%3.mp4") .arg (dirName) .arg (fileFlag) .arg (STRDATETIME); saveVideo (fileName);} void HaiKangThread::saveVideo (const QString & fileName) {if (hand > = 0) {/ / transcoding to support the Chinese path QTextCodec * codec = QTextCodec::codecForName ("gb2312"); QByteArray data = codec- > fromUnicode (fileName) / / stop and then set NET_DVR_StopSaveRealData (hand); NET_DVR_SaveRealData (hand, data.data ());}} at this point, the study on "how to implement Qt Haikang sdk video storage" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report