ini file - minimal example
The first example sets up Snowmix to mix video using a geometry of 1024x576 running at 25 fps. The control port for connecting to Snowmix for executing commands and queries is set to 9999.
# The system control port is the control port you can connect to to communicate with Snowmix system control port 9999 # The system geometry is geometry selected for the video mixer. system geometry 1024 576 BGRA # The system frame rate is the frame rate by which Snowmix is to mix video and produce output for system frame rate 25 # This is the control socket that a GStreamer shmsrc module connects to for control messages system socket /tmp/mixer1
The above configuration is the minimum configuration required for Snowmix to run. Save it as minimal.ini in the ini directory of Snowmix in your home directory. On Linux that will typically be $HOME/.snowmix/ini. On Mac OS X it might be $HOME/Snowmix/ini/.
Assuming you have set the environment variable SNOWMIX to where Snowmix was installed, typically /usr/local/lib/Snowmix-0.5.0 on Linux and /opt/local/lib/Snowmix-0.5.0 on Mac OS X, you can now run Snowmix using the following command:
$ snowmix ini/minimal.ini
Snowmix will search for the ini file using the following ordered search path:
- Current Working Directory
If the environment variable SNOWMIX_PREFIX does not exist, it will use '.snowmix' on Linux and 'Snowmix' on Mac OS X as default.
Snowmix won't do much with your minimal ini file, but if Snowmix is started with this file, Snowmix is ready to mix video. When Snowmix is running, you should be able in another window to run the script output2screen and see a black mixed frame with the geometry of 1024x576.
IMPORTANT: To exit/terminate Snowmix, it is important that you type 'quit' + <ENTER> in its terminal window. Alternatively you can make a TCP connection to a running Snowmix session using the following command and then type 'quit' + <ENTER>.
$ nc localhost 9999
If you do not terminate Snowmix typing quit, allocated shared memory will stay allocated. See also How to terminate Snowmix.
ini file - minimal example with one video feed overlayed
The next example adds a video feed and overlay it.
system control port 9999 system geometry 1024 576 BGRA system frame rate 25 system socket /tmp/mixer1 # Feed 0 is defined by default and it has the same size as the system (here 1024x576) feed idle 0 1 # Define feed 1 as a 704x576 feed feed add 1 Camera 1 feed geometry 1 704 576 feed live 1 feed idle 1 100 ../frames/dead-704x576.bgra feed socket 1 /tmp/feed-1-control-pipe # Set cutout/clip values. This is not needed if we uses virtual feeds or shape based feeds feed cutout 1 0 0 704 576 feed shift 1 160 0 # Feed 0 is by default in the stack to overlay. Tell Snowmix to overlay feed 1 as well. # The stack command is not needed if you are using virtual feeds or shape based feeds instead. stack 0 1
The above configuration is the minimum configuration with a single feed required for Snowmix to run. Save it the same place as before in the ini directory as the file minimal-1feed.ini and run it using the following command:
$ snowmix ini/minimal-1feed.ini
When Snowmix is running, you should be able to run the script output2screen in another window and see the *dead image* placed at 0,0 with covering until and including 703,575. Feed 0 being the black background can be seen covering from 704,0 until and including 1023,575.
ini file - minimal example with 1 feed and 3 virtual feeds, text and an image
The next example adds text, and image and 3 virtual feeds.
# Base settings for 1024x576@25 fps # Output control socket is /tmp/mixer1 require version 0.4.4 system control port 9999 system geometry 1024 576 BGRA system frame rate 25 system socket /tmp/mixer1 feed idle 0 1 # Base settings for a single feed of 704x576 feed add 1 Camera 1 feed geometry 1 704 576 feed live 1 feed idle 1 100 ../frames/dead-704x576.bgra feed socket 1 /tmp/feed-control-pipe # The command 'stack 0' applies default and as such is not needed # stack 0 # Set a text center of top of Camera 1 text string 0 Example text font 0 Sans Bold 12 text place 0 0 0 352 0 0.2 0.2 0.2 nw text place align 0 center top # Load image and place it at 4,6 image load 0 ../images/CS_logo-black-64x64.png image place 0 0 4 6 # Creating 3 virtual feeds sourced by feed 1 virtual feed add 1 Camera 1 virtual feed source feed 1 1 virtual feed add 2 Camera 1 scaled 1/2 virtual feed source feed 2 1 virtual feed add 3 Camera 1 scaled 1/2 virtual feed source feed 3 1 # Place 3 virtual feeds # virtual feed place rect <vir id> <x> <y> <width> <height> <src_x> <src_y> <rotation> <scale_x> <scale_y> <alpha> virtual feed place rect 1 0 0 704 576 0 0 0.0 1.0 1.0 1.0 virtual feed place rect 2 704 0 320 288 704 16 0 0.0 0.5 0.5 1.0 virtual feed place rect 3 704 288 320 288 704 16 0 0.0 0.5 0.5 1.0 # Define a new command (macro) command create Show virtual feed overlay all image overlay all text overlay all loop command end Show # This command macro Show will run at frame rate before outputting a mixed frame overlay finish Show
Save it in the ini directory the same place as before as the file example-3vfeed and run it using the following command:
$ snowmix ini/example-3vfeed.ini
When Snowmix is running, you should be able to run the script output2screen and see the result.