Giter Site home page Giter Site logo

set video encoder configuration about onvif HOT 3 OPEN

RotemDoar avatar RotemDoar commented on July 28, 2024
set video encoder configuration

from onvif.

Comments (3)

RogerHardiman avatar RogerHardiman commented on July 28, 2024

It is possible this will not work.
The original ONVIF API for video codec changes was called "the Media API", I'll call it "Media1"). It supported JPEG, MPEG-4 and H264
Then along came the Media2 API which is the API that also adds H265 support.

Currently this library implements lots of Media1, but only enough of Media2 for what I needed on a project.
In the code, the functions to set the Video Codec only talk to the Media(1) API.
It is possible that your camera does not know what to do when you make a change (via a Media1 API) to an ONVIF Profile that contains a Media2 value (ie H265)

The fix may be to change in libs\media.js around line 391 and change the code so it checks if the camera supports Media2, and if it does, generate the Media2 XML with the Media2 namespaces.
You can see examples of handling Media1 and Media2 around line 1052 with GetStreamUri

from onvif.

RogerHardiman avatar RogerHardiman commented on July 28, 2024

You may be lucky and find the XML for the Media2 setVideoEncoderConfiguration is exactly the same as in Media1, so it is just Namespace changes.
But on some of the other things, the API was different

from onvif.

RotemDoar avatar RotemDoar commented on July 28, 2024

ok I understand.
so you mean that I cam execute the set video configuration like this -

var Cam = require('onvif').Cam;
const cam_obj = new Cam({
    hostname: "192.168.1.55",
    username: 'admin',
    password: '123456',
    port: 80,
    timeout: 5000
    },
    async (err) => {
            if (err) {
                console.log(`load failed`)
                return
            }
            cam_obj._request({
                        service: 'media2',
                        body: cam_obj._envelopeHeader() +
                        '<SetVideoEncoderConfiguration xmlns="http://www.onvif.org/ver20/media/wsdl">' +
                            '<Configuration token = "' + 'VideoEncode_token_1' + '">' +
                            ('<Encoding xmlns="http://www.onvif.org/ver10/schema">' + 'H264' + '</Encoding>') +
                            '</Configuration>' +
                            '<ForcePersistence>true</ForcePersistence>' +
                        '</SetVideoEncoderConfiguration>' +
                        cam_obj._envelopeFooter()
                    }, function(err, data, xml) {
                        if(err){
                            console.log(err)
                        }
                        else{
                            console.log(data)
                        }
                    })
        
        }
    );

Is there any more configuration I should add?

from onvif.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.