====== DVswitch remote control ======
~~DRAFT~~
[[http://dvswitch.alioth.debian.org/|DVswitch]] is an application that allows interactive live-mixing of DV-sources with emphasis on streaming and archiving conference presentations.
This article describes a method that was [[http://lists.alioth.debian.org/pipermail/dvswitch-devel/2012-February/000548.html|outlined on the dvswitch mailing-list]] to allow interacting with dvswitch using external control mechanisms, such as physical buttons, sliders or apps running on a tablet or phone. To that end dvswitch has been extended to send and react on [[http://opensoundcontrol.org|OSC]] messages.
Before delving into the details here's a quick demo-video:
file=/_media/pub/av/dvosc2.flv&autostart=false&icons=false
===== Architecture =====
The concept is to create a generic interface that allows to remote-control dvswitch and specific applications for various setups and use-cases that use this control-interface. The general idea is that one can use an interface appropriate for the job at hand. OSC is easily accessible: Commandline-tools, OSC controller-apps for touch-screen phones and OSC-sequencing software are available.
A first specific application used for prototyping is a MIDI -> OSC translator called 'dvmctrl'.
/------\ +-----------+ +----------+
| | |cYEL | |cYEL |
| Midi | Midi | | OSC | |
| +--------->| dvmctrl +--------->| dvswitch |
| Desk | | | | |
| | | | | |
\------/ +-----------+ +----------+
In its current development state dvmctrl binds MIDI control-commands (from a BCF2000 MIDI-Desk) to dvswitch actions. It is intended to be used with three DV-source (two camera, one projector input), as demoed in the video above.
===== OSC control messages =====
The patched dvswitch interprets the following OSC messages:
^ osc-msg ^ type ^ ^
|/dvswitch/src/pri | i |select primary video-input [0..] |
|/dvswitch/src/sec | i |select secondary video-input [0..] |
|/dvswitch/src/snd | i |select audio-input [0..] |
|/dvswitch/rec/start | |send record-start command. |
|/dvswitch/rec/stop | |send record-stop command. |
|/dvswitch/rec/cut | |send record-cut command. |
|/dvswitch/fx/overlay | i |set A/B overlay [0..255]; 0: source A, 255: source B |
|/dvswitch/fx/fade | i |switch to A->A' fade-effect [50..15000]ms; 0:cancel-effect|
|/dvswitch/fx/pip | i |//experimental// picture-in-picture [0..4]; 0: cancel-effect, 1-4 pip-position presets |
|/dvswitch/fx/pip | fff |//experimental// picture-in-picture effect - params: x-pos, y-pos, size; all [0..1]. any value <0 will cancel the effect. |
===== Source Code =====
There are a couple of build-prerequisites to compile this beast: in particular development packages for ffmpeg (libavformat-dev, libavcodec-dev,..), cairo and cairomm, freetype, pango, jack, cmake, etc. for dvswitch; liblo-dev, alsa-dev and gnu-make for dvmctrl.
The source code of the patched dvswitch((the patch include a jack-audio-input, video-overlay/fade and OSC control)) and dvmctrl is kept in git repositories
* http://rg42.org/gitweb/?p=dvswitch.git
* http://rg42.org/gitweb/?p=dvmctrl.git
git clone git://rg42.org/dvswitch ## this checks out the "0.9-osc" branch by default
cd dvswitch
mkdir build; cd build
cmake ..
make
./src/dvswitch -o 5675 ## works IFF dvswitch is avail on the system (/usr/share/dvswitch/*png)
## otherwise you will need to install the built
git clone git://rg42.org/dvmctrl
cd dvmctrl
make
./dvmctrl # -m BCF2000 -o 5675 (these are defaults)
Now add three sources in order: cam-1, cam-2, slides/projector using dvsource-*.
===== Known Problems =====
The setup has been tested successfully for >24 hours of continuous operation - although the settings were rather static for most of the time.
A potential problem is that the the input sources must to be in fixed order for the duration of a session (particularly the video-projector - here #3 which is mapped to the fader). When a source is disconnected or dropped from dvswitch and re-connected the ordering is not necessarily identical.
This can be worked-around in 'dvmctrl' (re-map the sources) but should rather be fixed in dvsource and dvswitch itself.
===== TODO =====
* optimize the interaction design (midi-button mapping - possibly midi learn; dynamic maps)
* fix or work-around the mixer::source_id sort ordering (see known problems)
* add midi-map for record, and stop.
* make dvswitch send status information via OSC (code is prepared but no hooks are yet defined)
* send info about currently active sources (tally lights)
* send notifications about new sources or sources going away.
* transmit updates done via mouse or keyboard.
* ...
* clean up the patches for upstream inclusion
{{tag>floss video}}