Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera Settings Setup #30

Open
JamSponge opened this issue Nov 11, 2022 · 0 comments
Open

Camera Settings Setup #30

JamSponge opened this issue Nov 11, 2022 · 0 comments

Comments

@JamSponge
Copy link

Hello! This definitely isn't the way you're supposed to use github, but I'm an idiot. I tweaked this function a bunch to get it working neatly with my studio micro 4ks:

def setCameraControlVideomode(self, camera: Union[ATEMConstant, str, int], video_mode: str) -> None:
"""Set Camera Control Video Mode
fps: int, resolution: int, pal_or_ntsc: str, interlaced: int
Args:
camera: see ATEMCameras
fps (int): ?
resolution (int): ?
interlaced (int): ?
"""
# 0= resolution // 1= framerate (approx!) // 2= interlaced ("i" or "p") // 3= NTSC or PAL
video_mode_dict = {
#"f1080i50": (1,3,1,1), #Not supported by camera
#"f525i59_94_ntsc" :
#"f625i_50_pal"
#"f525i59_94_ntsc_16_9"
#"f625i_50_pal_16_9"
#"f1080i23_98": (0,3,1,1),
#"f1080i24": (0,3,1,0),
"f720p50": (3,2,0,0),
"f720p59_94":(4,2,0,1),
"f720p60": (4,2,0,0),
"f1080i25": (1,3,1,0),
"f1080i29_97": (2,3,0,1),
"f1080i30": (2,3,1,0),
"f1080i59_94": (2,3,1,1),
"f1080i60": (2,3,1,0),
"f1080p23_98": (0,3,0,1),
"f1080p24": (0,3,0,0),
"f1080p25": (1,3,0,0),
"f1080p29_97": (2,3,0,1),
"f1080p30": (2,3,0,0),
"f1080p50": (3,3,0,0),
"f1080p59_94": (4,3,0,1),
"f1080p60": (4,3,0,0),
"f2160p23_98": (0,6,0,1),
"f2160p24": (0,6,0,0),
"f2160p25": (1,6,0,0),
"f2160p29_97": (2,6,0,1),
"f2160p30": (2,6,0,0)
}

    camera_val = self.atem.cameras[camera].value

    self.switcher._prepareCommandPacket("CCmd", 24)
    self.switcher._outBuf.setU8(0, camera_val)
    self.switcher._outBuf.setU8(1, 1)
    self.switcher._outBuf.setU8(2, 0)
    self.switcher._outBuf.setU8(4, 0x01)   # Data type: int8
    self.switcher._outBuf.setU8(7, 0x05)   # 5 Byte array
    #self.switcher._outBuf.setU8(9, 0x05)   # 5 byte array
    self.switcher._outBuf.setU8(16, video_mode_dict[video_mode][0])
    self.switcher._outBuf.setU8(17, video_mode_dict[video_mode][3])   # Regular M-rate
    self.switcher._outBuf.setU8(18, video_mode_dict[video_mode][1])
    self.switcher._outBuf.setU8(19, video_mode_dict[video_mode][2])
    self.switcher._outBuf.setU8(20, 0x00)   # YUV
    self.switcher._finishCommandPacket()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant