Page 1 of 1
Get camera fps in a script ?
Posted: Sun Oct 30, 2022 9:44 am
by Jean-Francois
Hello Robin,
Is it possible to get the actual fps value of the camera in a script ?
Regards,
Jean-Francois
Re: Get camera fps in a script ?
Posted: Sun Oct 30, 2022 4:12 pm
by admin
Hi Jean Francois,
there's no way to ask SharpCap for it, but you could intercept the FrameCaptured event on the camera and calculate it yourself. Some discussion of handling the event here :
viewtopic.php?p=5690#p5690
cheers,
Robin
Re: Get camera fps in a script ?
Posted: Sat Jan 07, 2023 4:27 pm
by Jean-Francois
Hello Robin,
Concerning the fps value in a script ... I found a way to have it ...
Code: Select all
import os
import time
CameraSettingFile = SharpCap.Settings.CreateCameraSettingsFile
if (CameraSettingFile == False):
SharpCap.Settings.CreateCameraSettingsFile = True
SharpCap.Settings.Save()
SharpCap.SelectedCamera.PrepareToCapture()
SharpCap.SelectedCamera.RunCapture()
time.sleep(3)
SharpCap.SelectedCamera.StopCapture()
SharpCap.ShowNotification(None)
file = SharpCap.GetLastCaptureFilename()
file_settings = os.path.splitext(file)[0] + ".CameraSettings.txt"
with open(file_settings, 'r') as fp:
for l_no, line in enumerate(fp):
if "ActualFrameRate" in line:
break
parts = line.split("=")[1]
framerate = float(parts.split("f")[0])
print framerate
if (CameraSettingFile == False):
SharpCap.Settings.CreateCameraSettingsFile = False
SharpCap.Settings.Save()
try:
os.remove(file)
os.remove(file_settings)
except:
print "No file to delete"
The script starts a capture of a film.
It opens the CameraSettings.txt file and search the line with "ActualFrameRate".
It works fine and it takes in account all the transfer from the camera to the disc.
Regards,
Jean-Francois