Log in or register to post comments

Video frame value changed for unknown reason

August 11, 2017 - 12:21am #1

Hi,

I got different video frame value when run the sample image target  app.

But the video frame is (VideoMode:w=640 h=480) now.  

What I need do if want the frame is (VideoMode:w=1280 h=720) ?

 

Addtional information:

device: iPad4, 1

version: 10.3.1

logs:

Some time:

2017-08-11 10:33:17.627463+0800 Vuforia[20838:10202240] VideoBackgroundConfig: size: 1536,2730

2017-08-11 10:33:17.627587+0800 Vuforia[20838:10202240] VideoMode:w=1280 h=720

2017-08-11 10:33:17.627713+0800 Vuforia[20838:10202240] width=1536.000 height=2048.000

Most of time:

2017-08-11 10:35:54.700191+0800 xxx[20849:10203248] VideoBackgroundConfig: size: 1536,2048

2017-08-11 10:35:54.700315+0800 xxx[20849:10203248] VideoMode:w=640 h=480

2017-08-11 10:35:54.700437+0800 xxx[20849:10203248] width=1536.000 height=2048.000

I also try to update the activeFormat befort ARcamera start. But not work.

- (AVCaptureDevice *)getFrontCamera
{
    // get front camera device
    NSArray *cameras = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
    for (AVCaptureDevice *device in cameras)
    {
        if (device.position == AVCaptureDevicePositionFront)
            return device;
    }
    return nil;
   
}

- (void)setupFrontCamera
{
    NSError *error = nil;
   
    AVCaptureDevice* camera = [self getFrontCamera];
    if(camera != nil && [camera lockForConfiguration:&error]){
        AVCaptureDeviceFormat *activeFormat = [camera activeFormat];
        NSLog(@"Camera activeFormat is %@", activeFormat.description);
        if(activeFormat.highResolutionStillImageDimensions.height >= 720){
            return;
        }
       
        for(AVCaptureDeviceFormat* format in camera.formats) {
            // NSLog(@"Camera support format is %@", format.description);
            CMVideoDimensions d = format.highResolutionStillImageDimensions;
           
            if([format.mediaType isEqualToString: AVMediaTypeVideo] && d.height == 720){
                camera.activeFormat = format;
                NSLog(@"Video activeFormat updated to %@", [camera activeFormat]);
                return;
            }
        }
        [camera unlockForConfiguration];
    }
}

 

 

Log in or register to post comments