Skip to content

Commit 4883810

Browse files
committed
CAX 2024 build
Signed-off-by: Michael Mattsson <[email protected]>
1 parent 21dc3a5 commit 4883810

File tree

3 files changed

+87
-23
lines changed

3 files changed

+87
-23
lines changed

README.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ config:
3838
debug: true
3939
mv:
4040
ip_addr: 192.168.37.5
41+
remote_timeout: 2.0 # Positive float timeout in seconds for IP-based command
42+
# If null is given, the socket is put in blocking mode
43+
command_delay: .1 # Positive float delay after sending a MV command
44+
# Tune this if timeouts are being hit on quad layouts
4145
modes:
4246
3840x2160p60: 3
4347
3840x2160p30: 5
@@ -60,12 +64,12 @@ profiles:
6064
scene: quad
6165
# Keyed from with config.mv.modes
6266
output: 3840x2160p60
63-
# Consume key (viewport) with value (HDMI input)
64-
layout: # only use as many keys as there are viewports
65-
one: 1
66-
two: 2
67-
three: 3
68-
four: 4
67+
# Consume key (HDMI input) and put in value (Multi-Viewer viewport)
68+
layout:
69+
HDMI-1: 1
70+
HDMI-2: 2
71+
HDMI-3: 3
72+
HDMI-4: 4
6973
audio: 3
7074
encoder:
7175
# 50 - 200 "quality" slider, default is 100, ignored when --mbps is used
@@ -74,6 +78,23 @@ profiles:
7478
framerate: raw
7579
# 1920x1080 etc, raw means match input
7680
resolution: raw
81+
player:
82+
mv:
83+
# Keyed from with config.mv.scenes
84+
scene: single
85+
# Keyed from with config.mv.modes
86+
output: 3840x2160p60
87+
# Consume key (HDMI input) with value (viewport output)
88+
layout:
89+
HDMI-2: 1
90+
audio: 3
91+
encoder:
92+
# 50 - 200
93+
bitrate: 200
94+
# frame rate, raw matches input, half, one-third, quarter are valid
95+
framerate: raw
96+
# 1920x1080 etc, raw means match input
97+
resolution: 1920x1080
7798
```
7899
79100
## Prequisites and Hardware SKUs
@@ -108,7 +129,7 @@ These are the ones I've gone through.
108129

109130
#### Encoders
110131

111-
Magewell Pro Converters all have the same API and Ultra Encode would need work.
132+
Magewell Pro Converters all have the same API. The Ultra Encode series would need work.
112133

113134
- Magewell Pro Convert HDMI 4K Plus (Works 100%)
114135
- Magewell Pro Convert HDMI Plus
@@ -122,6 +143,12 @@ Magewell Pro Converters all have the same API and Ultra Encode would need work.
122143

123144
![](assets/README/marketecture.png)
124145

146+
## Demos
147+
148+
A short snippet that describes the benefit of using 4K cameras in single view modes.
149+
150+
[![Watch the video](https://img.youtube.com/vi/PLqVQgK3UIY/maxresdefault.jpg)](https://youtu.be/PLqVQgK3UIY)
151+
125152
<!--
126153
## Demonstration
127154

config.yaml-dist

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ config:
1212
debug: true
1313
mv:
1414
ip_addr: 192.168.37.5
15+
remote_timeout: 2.0 # Positive float timeout in seconds for IP-based command
16+
# If null is given, the socket is put in blocking mode
17+
command_delay: .1 # Positive float delay after sending a MV command
18+
# Tune this if timeouts are being hit on quad layouts
1519
modes:
1620
3840x2160p60: 3
1721
3840x2160p30: 5
@@ -34,12 +38,12 @@ profiles:
3438
scene: quad
3539
# Keyed from with config.mv.modes
3640
output: 3840x2160p60
37-
# Consume key (viewport) with value (HDMI input)
38-
layout: # only use as many keys as there are viewports
39-
one: 1
40-
two: 2
41-
three: 3
42-
four: 4
41+
# Consume key (HDMI input) and put in value (Multi-Viewer viewport)
42+
layout:
43+
HDMI-1: 1
44+
HDMI-2: 2
45+
HDMI-3: 3
46+
HDMI-4: 4
4347
audio: 3
4448
encoder:
4549
# 50 - 200 "quality" slider, default is 100, ignored when --mbps is used
@@ -48,3 +52,20 @@ profiles:
4852
framerate: raw
4953
# 1920x1080 etc, raw means match input
5054
resolution: raw
55+
player:
56+
mv:
57+
# Keyed from with config.mv.scenes
58+
scene: single
59+
# Keyed from with config.mv.modes
60+
output: 3840x2160p60
61+
# Consume key (HDMI input) with value (viewport output)
62+
layout:
63+
HDMI-2: 1
64+
audio: 3
65+
encoder:
66+
# 50 - 200
67+
bitrate: 200
68+
# frame rate, raw matches input, half, one-third, quarter are valid
69+
framerate: raw
70+
# 1920x1080 etc, raw means match input
71+
resolution: 1920x1080

multiviewer/uhdmcu.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import socket
33
import serial
44
import logging
5+
import time
56

67
logging.basicConfig(format='%(asctime)s %(name)s %(levelname)s %(message)s',
78
datefmt='%a, %d %b %Y %H:%M:%S +0000')
@@ -21,6 +22,16 @@ def __init__(self, config):
2122
self.connect = 'remote'
2223
self.logger.debug('Connection to MV with "{connect}" interface'.format(connect=self.connect))
2324

25+
self.inputs = {
26+
'HDMI-1': 1,
27+
'HDMI-2': 2,
28+
'HDMI-3': 3,
29+
'HDMI-4': 4
30+
}
31+
32+
self.remote_timeout = self.config['mv'].get('remote_timeout', 2.0)
33+
self.command_delay = self.config['mv'].get('command_delay', .1)
34+
2435
def __poweroff(self):
2536
self.send_command('power 0!')
2637

@@ -56,15 +67,16 @@ def __layout(self, **kwargs):
5667
grid = kwargs.get('grid')
5768

5869
if grid:
59-
window = 1
60-
for viewport in grid:
70+
for hdmi in grid:
6171
if len(grid) == 1:
62-
self.send_command(f's window {grid[viewport]}!')
72+
if grid[hdmi] == 1:
73+
self.send_command(f's in source {self.inputs[hdmi]}!')
74+
else:
75+
self.logger.debug(f'{hdmi} value not legal for scene type')
6376
else:
64-
self.send_command(f's window {grid[viewport]} in {window}!')
65-
window += 1
77+
self.send_command(f's window {grid[hdmi]} in {self.inputs[hdmi]}!')
6678
else:
67-
raise Exception(f'HDMI port number is not set')
79+
raise Exception(f'Layout not found in config file')
6880

6981
def send_command(self, cmd):
7082
console = ''
@@ -84,15 +96,19 @@ def send_command(self, cmd):
8496

8597
host = self.config['mv']['ip_addr']
8698
port = 23
87-
msg = "{command}\n".format(command=cmd)
99+
msg = "{command}".format(command=cmd)
88100

89101
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
90-
s.settimeout(.3)
102+
s.settimeout(self.remote_timeout)
91103
s.connect((host, port))
92-
self.logger.debug(f'About to send "{cmd}" to {host}:{port}')
104+
self.logger.debug(f'About to send "{cmd}" to {host}:{port} with a timeout of {self.remote_timeout}s')
93105
s.sendall(bytes(msg, encoding="ascii"))
94-
console = s.recv(64).decode().rstrip('\r\n')
106+
console = s.recv(32).decode().rstrip('\r\n')
95107
self.logger.debug('Received from MV: "{msg}"'. format(msg=console))
108+
s.shutdown(socket.SHUT_RDWR)
109+
s.close()
110+
111+
time.sleep(self.command_delay)
96112
return console
97113

98114
def apply(self, profile):

0 commit comments

Comments
 (0)