Hello Robin,
Is it possible to get the actual fps value of the camera in a script ?
Regards,
Jean-Francois
Get camera fps in a script ?
-
- Posts: 402
- Joined: Sun Oct 13, 2019 10:52 am
- Location: Germany
- admin
- Site Admin
- Posts: 13350
- Joined: Sat Feb 11, 2017 3:52 pm
- Location: Vale of the White Horse, UK
- Contact:
Re: Get camera fps in a script ?
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
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
-
- Posts: 402
- Joined: Sun Oct 13, 2019 10:52 am
- Location: Germany
Re: Get camera fps in a script ?
Hello Robin,
Concerning the fps value in a script ... I found a way to have it ...
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
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