onvif icon indicating copy to clipboard operation
onvif copied to clipboard

set video encoder configuration

Open RotemDoar opened this issue 1 year ago • 3 comments

My company is using Onvif to control IP cameras. We are trying to set the encoder of the cameras by using this library. We have a problem that after using the setVideoEncoderConfiguration function, the encoder of the cameras has not changed.

For example -

We trying to set the encoder of this camera to H264 (the current encoder is H265). At first we use the function - get profiles, and we got -

{
  '$': { Profile: 'Main', GovLength: 100, token: 'VideoEncode_token_1' },
  name: 'VideoEncode_1',
  useCount: 1,
  encoding: 'H265',
  resolution: { width: 1920, height: 1080 },
  rateControl: {
    '$': { ConstantBitRate: true },
    frameRateLimit: 25,
    bitrateLimit: 1536
  },
  multicast: {
    address: { type: 'IPv4', IPv4Address: '239.0.0.0' },
    port: 50554,
    TTL: 1,
    autoStart: false
  },
  quality: 3
}

and then, we are trying to set video encoder configuration. we are executing -

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.setVideoEncoderConfiguration({
                token: 'VideoEncode_token_1',
                encoding: 'H264',
                
            },(err,data)=>{
                if(err){
                    console.log(err)
                }
                else{
                    console.log(data)
                }
            })
        
        }
    );

We got no errors, but the encoder of the camera is still H265. Moreover we tried to log the return data of the xml by adding logs here - (after line 446 in media.js file)

}, function(err, data, xml) {
			console.log(data)
			console.log(xml)
			if (err || linerase(data).setVideoEncoderConfigurationResponse !== '') {
				return callback.call(this, linerase(data).setVideoEncoderConfigurationResponse !== ''
					? new Error('Wrong `SetVideoEncoderConfiguration` response')
					: err, data, xml);
			}
			//get new encoding settings from device
			this.getVideoEncoderConfiguration(options.token || options.$.token, callback); 

We got -

[ { setVideoEncoderConfigurationResponse: [ '' ] } ]
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope                                                        ><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><trt:SetVideoEncoderConfigurationResponse></trt:SetVideoEncoderConfigurationResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

any ideas what is wrong?

RotemDoar avatar Feb 19 '23 11:02 RotemDoar