Camera framerate 1% faster than requested - Raspberry Pi Forums


hi!

tried record video picamera using variable framerate (camera.framerate=0, exposure_mode='night') , detect real fps using motion vectors stream. reason calculated fps higher should be. here test script find real framerate when camera.framerate set 90.

code: select all

import picamera import picamera.array import time  fps	= 30  class detectmotion(picamera.array.pimotionanalysis): 	def analyse(self, a):# method called each frame 		self.i	+= 1 		if self.i > self.fpsupdate: 			curtime	= time.time() 			self.fps	= float(self.fpsupdate) / (curtime - self.lasttime) 			print(self.fps, self.i, curtime) 			self.i	= 0 			self.lasttime	= curtime 			self.fpsupdate	= int(self.fps * 10) 		 	def seti(self, fps): 		self.i	= 0 		self.fpsupdate	= fps * 10 		self.lasttime	= time.time()  picamera.picamera() camera: 	camera.resolution	= (80, 60) 	camera.framerate	= fps 	with detectmotion(camera) motiondetector: 		motiondetector.seti(fps) 		camera.start_recording('/dev/null', format='h264', motion_output=motiondetector) 		camera.wait_recording(300)
, screen output:

code: select all

(90.64054710017014, 901, 1404987424.683723) (91.1498060304278, 907, 1404987434.623404) (91.11016823524258, 912, 1404987444.622288) (91.09151915592423, 912, 1404987454.623219) (91.11739475477107, 911, 1404987464.610335) (91.11531729942031, 912, 1404987474.608654) (91.09084596834764, 912, 1404987484.609659) (91.12406443833711, 911, 1404987494.596044) 
calculated fps off more 1%. camera able record video faster 90 fps? same script fps=30 gives real framerate 30.363121614197492, again 1% larger.

it's not problem picamera, because raspivid gives similar results:
raspivid -w 320 -h 240 -fps 90 -qp 40 -t 300000 -o test_fps90.h264
mp4box -add test_fps90.h264 -fps 90 test_fps90.mp4
avc-h264 import - frame size 320 x 240 @ 90.000 fps
avc import results: 27395 samples - slices: 457 26938 p 0 b - 0 sei - 457 idr
saving /mnt/usbdrive/test_fps90.mp4: 0.500 secs interleaving

created video length 05:04 although should 5 minutes. number of frames+p frames 457+26938, fps=(457+26938)/300=91.317. camera clock running faster raspi clock?

lwd8cmd wrote:hi!

tried record video picamera using variable framerate (camera.framerate=0, exposure_mode='night') , detect real fps using motion vectors stream. reason calculated fps higher should be. here test script find real framerate when camera.framerate set 90.

code: select all

import picamera import picamera.array import time  fps	= 30  class detectmotion(picamera.array.pimotionanalysis): 	def analyse(self, a):# method called each frame 		self.i	+= 1 		if self.i > self.fpsupdate: 			curtime	= time.time() 			self.fps	= float(self.fpsupdate) / (curtime - self.lasttime) 			print(self.fps, self.i, curtime) 			self.i	= 0 			self.lasttime	= curtime 			self.fpsupdate	= int(self.fps * 10) 		 	def seti(self, fps): 		self.i	= 0 		self.fpsupdate	= fps * 10 		self.lasttime	= time.time()  picamera.picamera() camera: 	camera.resolution	= (80, 60) 	camera.framerate	= fps 	with detectmotion(camera) motiondetector: 		motiondetector.seti(fps) 		camera.start_recording('/dev/null', format='h264', motion_output=motiondetector) 		camera.wait_recording(300)
, screen output:

code: select all

(90.64054710017014, 901, 1404987424.683723) (91.1498060304278, 907, 1404987434.623404) (91.11016823524258, 912, 1404987444.622288) (91.09151915592423, 912, 1404987454.623219) (91.11739475477107, 911, 1404987464.610335) (91.11531729942031, 912, 1404987474.608654) (91.09084596834764, 912, 1404987484.609659) (91.12406443833711, 911, 1404987494.596044) 
calculated fps off more 1%. camera able record video faster 90 fps? same script fps=30 gives real framerate 30.363121614197492, again 1% larger.

it's not problem picamera, because raspivid gives similar results:
raspivid -w 320 -h 240 -fps 90 -qp 40 -t 300000 -o test_fps90.h264
mp4box -add test_fps90.h264 -fps 90 test_fps90.mp4
avc-h264 import - frame size 320 x 240 @ 90.000 fps
avc import results: 27395 samples - slices: 457 26938 p 0 b - 0 sei - 457 idr
saving /mnt/usbdrive/test_fps90.mp4: 0.500 secs interleaving

created video length 05:04 although should 5 minutes. number of frames+p frames 457+26938, fps=(457+26938)/300=91.317. camera clock running faster raspi clock?
think might partially down clock setting camera being defined different value (a bit lower) incoming clock supplied crystal on board. needs tweaking, haven't had time @ it.


raspberrypi



Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

Rasperry Wifi LAN Controller - Raspberry Pi Forums

Unlock car with bluetooth and car key