Skip to content

Instantly share code, notes, and snippets.

@lukas2511
Last active January 15, 2018 15:32
Show Gist options
  • Save lukas2511/86a74fc04c1c0ed3c3b76cd076a9b17c to your computer and use it in GitHub Desktop.
Save lukas2511/86a74fc04c1c0ed3c3b76cd076a9b17c to your computer and use it in GitHub Desktop.
docker container for casparcg testing
# run "xhost local:root" on host machine
FROM debian:latest
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt install -y xorg v4l2ucp libgl1 libraw1394-11 libavc1394-0 libiec61883-0 libgtkextra-dev libnss3 libgconf2-4 vnc4server fluxbox libasound2 vlc
RUN apt -y purge libturbojpeg0
ADD http://de.archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_1.3.0-0ubuntu2_amd64.deb /deb/libjpeg-turbo8.deb
ADD http://security.ubuntu.com/ubuntu/pool/main/libg/libgcrypt11/libgcrypt11_1.5.3-2ubuntu4.5_amd64.deb /deb/libgcrypt11.deb
RUN dpkg -i /deb/*.deb
VOLUME /stuff
VOLUME /dev/dri
VOLUME /tmp/.X11-unix
WORKDIR /stuff
#!/usr/bin/env python3
import socket
import time
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("172.17.0.2", 5250))
channels = {
1: '"http://cdn.c3voc.de/s1_native_sd.webm"',
2: '"http://cdn.c3voc.de/s2_native_sd.webm"',
3: '"http://cdn.c3voc.de/s3_native_sd.webm"',
4: '"http://cdn.c3voc.de/s4_native_sd.webm"',
}
presets = {
1: {
1: {'visible': True, 'position': (0.05, 0.05), 'size': (0.75, 0.75)},
2: {'visible': True, 'position': (0.70, 0.70), 'size': (0.25, 0.25)}
},
2: {
1: {'visible': True, 'position': (0.0, 0.0), 'size': (1, 1)},
},
3: {
2: {'visible': True, 'position': (0.0, 0.0), 'size': (1, 1)},
},
4: {
1: {'visible': True, 'position': (0.0, 0.0), 'size': (0.5, 0.5)},
2: {'visible': True, 'position': (0.0, 0.5), 'size': (0.5, 0.5)},
3: {'visible': True, 'position': (0.5, 0.0), 'size': (0.5, 0.5)},
4: {'visible': True, 'position': (0.5, 0.5), 'size': (0.5, 0.5)},
},
}
sock.send(b'PLAY 1-0 "BGLOOP" CUT 1 Linear RIGHT LOOP\r\n')
for channel_id, channel in channels.items():
sock.send(b"PLAY 1-%d" % channel_id + channel.encode())
time.sleep(1)
sock.send(b'MIXER 1-%d VOLUME 0\r\n' % channel_id)
sock.send(b"\r\n")
print(channel)
sock.send(b"PLAY 2-1 route://1\r\n")
def load_scene(scene_id):
if not scene_id in presets:
return
commands = ''
for channel_id, channel in channels.items():
if channel_id in presets[scene_id]:
scene = presets[scene_id]
print(scene)
commands += 'MIXER 1-%d OPACITY 1\r\n' % channel_id
commands += 'MIXER 1-%d FILL %.2f %.2f %.2f %.2f\r\n' % ((channel_id, ) + scene[channel_id]['position'] + scene[channel_id]['size'])
else:
commands += 'MIXER 1-%d OPACITY 0\r\n' % channel_id
sock.send(commands.encode())
load_scene(1)
while True:
cmd = input().strip()
if cmd == 'p':
sock.send(b'PLAY 2-2 IRISH-COFFEE\r\n')
sock.send(b'PLAY 2-3 PAUSE\r\n')
sock.send(b'MIXER 2-1 VOLUME 0\r\n')
sock.send(b'MIXER 2-2 VOLUME 1\r\n')
elif cmd == 'P':
sock.send(b'STOP 2-3\r\n')
sock.send(b'MIXER 2-2 VOLUME 0\r\n')
sock.send(b'MIXER 2-1 VOLUME 1\r\n')
else:
try:
scene_id = int(cmd)
except:
continue
load_scene(scene_id)
@michael-riha
Copy link

any success with casperCG and docker?
from what i see, casperCG isn't included in your container, yet. right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment