Security monitoring live LiveNVR no plug-ins web broadcast programs implemented snapshot function

Live monitoring program

More and more people begin to general network access security cameras streaming media server, network broadcast. But more security cameras on the market brand, model, want to access these various cameras unrealistic way through the SDK. Due to security cameras basically can output rtsp stream, so we can pull way RTSP streaming to various compatible cameras. Normal access is achieved LiveNVR RTSP / Onvif security camera, turn into HLS and RTMP stream, or may be H5 web app live broadcast on each platform.

Live snapshot program

LiveNVR realized the camera pulls RTSP streams for live monitoring. Process just live streaming media data forwarding process, not decoded, so that the CPU and other hardware resource consumption is small.
However, when live, you may want to grab the timing of a real-time picture shows the cover of the data analysis. This situation requires a timing acquisition data is decoded, or grip into bmp jpg picture.
The following is the video data into a frame picture code:

bool LiveNVRChannel::rawData2Image(char* rawBuf, int bufSize, int codec, int width, int height, const char* jpgpath)
{
    decodeParam.codec = codec;
    decodeParam.width = width;
    decodeParam.height = height;

    if (!decoderHelper_)
    {
        decoderHelper_ = new DecoderHelper;
    }

    decoderHelper_->SetVideoDecoderParam(width, height, codec);

    int ret = decoderHelper_->DecodeVideo(rawBuf, bufSize);
    if (ret < 0)
    {
        return false;
    }

    decoderHelper_->WriteJPEG(jpgpath);

    if (QTSServerInterface::GetServer()->GetThridPartPlatformModule())
    {
        if (!decodeParam.imageData)
            decodeParam.imageData = new char[width * height * 3];
        memset(decodeParam.imageData, 0, width * height * 3);

        FILE* snapFile = ::fopen(jpgpath, "rb");
        if (snapFile)
        {
            // obtain file size:  获得文件大小   
            ::fseek(snapFile, 0, SEEK_END); // 指针移到文件末位   
            decodeParam.imageSize = ftell(snapFile);  // 获得文件长度   
            ::rewind(snapFile);  // 函数rewind()把文件指针移到由stream(流)指定的开始处, 同时清除和流相关的错误和EOF标记   
            ::fread(decodeParam.imageData, 1, decodeParam.imageSize, snapFile);
            ::fclose(snapFile);
        }
    }

    return true;
}

Online Demo

LiveNVR is to achieve the traditional security RTSP cameras implemented in the Internet broadcast, recording, playback, compatible with Windows and each mobile terminal.
We can http://nvr.liveqing.com

For more information

Live Streaming Internet Security -QQ exchange group: 615 081 503

GB GB28181 no plug-ins LiveGBS-QQ exchange group: 947 137 753

Mail: [email protected]

WEB:www.liveqing.com

Tel: 189-5515-0114 (the same micro-channel)

Copyright © LiveQing.com 2016-2019

Guess you like

Origin www.cnblogs.com/marvin1311/p/10936982.html