DATV Express with vMix using ffmpeg to generate the Transport Stream

Out of the box DATV Express runs only with very specific hardware – typically Hauppauge capture cards with hardware MPEG2 encoders on board. Since I didn’t have a suitable card available I researched various ways to use the transmitter – the hard part being to create a suitable transport stream.

The choice of vMix was made because I’ve been using this software for a few months now on FM ATV and have found it to be a really useful way to generate a very slick feed from one or more cameras with useful additional features like text and graphics overlays, transitions and blends, desktop capture, green screen / chroma key and virtual sets – all done in real time. The free version of vMix is limited to just four inputs but that is sufficient for my purposes at present.

vMix does however require a half decent PC running Windows 7 or later, and DATV Express requires a Linux box running Ubuntu.

Here’s one of the recipe’s that I have found works reasonably well:


Note: You can use any suitable machines – these work for me!

The two computers need to be connected using a wired network – preferably not too busy. If you’re using wireless currently you can probably just hook the two machines together and set their wired network ports to fixed IP addresses on the same subnet e.g for the Windows box and for Linux.

Leave them connected to the wireless network for internet access – the wired connection will then only be used for DATV Express.

Make sure you’re using a different subnet to that used by your wireless network or there will be problems! Make a note of the IP address for your linux box as we’ll need that later. Check the machines can ping each other:
On the Windows box:


On the Linux box:


Both of these should result in replies being reported. Firewalls may complain – allow access!

Main laptop / vMix:
Install and configure vMix if you haven’t already got it. There’s some great video introductions on YouTube which will help with this.

Note – if you don’t want to use vMix you can use any other directShow camera or video capture device and audio input device – you’ll need to change the ffmpeg command below.
Provide some input e.g. from a camera or a colour – choose colour bars to get the vMix test card.
Set the external output (Settings / External Output) to PAL 25p 640×480 (or 720×576 different resolutions may or may not work with your receiver).
Enable the external output (Click External at bottom centre of the window)

Install ffmpeg from http://ffmpeg.zeranoe.com/builds/ – I’m using the 32 bit static build.

Create a batch file e.g. vmix2tx.bat – put the following in it:

@echo off
rem vMix to Transport Stream for DATV Express
rem by Chris mw0llk January 2015.
rem with thanks to Rob m0dts for the linux shell script on which this was based.
echo Enter the following values to start the Tx, Press Enter for default (previous) values

if X%SR%==X set SR=2000
set defSR=%SR%
set /p SR=Enter SR in KS (%SR%):
if X%SR%==X set SR=%defSR%

if X%FEC%==X set FEC=5/6
set defFEC=%FEC%
set /p FEC=Enter FEC in KS (%FEC%):
if X%FEC%==X set FEC=%defFEC%

rem Save values for next time
rem If these lines cause errors your system may not support SETX
rem If so just comment them out
if not %SR%==%defSR% setx SR "%SR%"
if not %FEC%==%defFEC% setx FEC "%FEC%"

echo Symbol rate: %SR%, FEC: %FEC%. Calculating bitrates... 

rem Calculate Video bit rate value for current SR/FEC 
set /a DSR=2*%SR% 
echo DSR is %DSR% 

set /a DECFEC=1000*%FEC% 
set /a RS=188000/204 
set /a TS=%DSR% * %RS% / 1000 * %DECFEC% / 1000 
set /a TSMAUD=%TS%-128 
set /a VIDRATE=%TSMAUD% * 75 / 100 
set /a BUFSIZE=%VIDRATE% * 7 / 10 

echo Transport Stream rate for current SR/FEC is: %TS% 
echo Video bit-rate: %VIDRATE% 

start "Video feed to DATV Express" /high c:\ffmpeg\bin\ffmpeg -f dshow -i video="vMix Video" -f dshow -i audio="vMix Audio" -f mpeg2video -pix_fmt yuv420p -r 25 -s 640x480 -aspect 4:3 -qmin 2 -qmax 35 -b:v %VIDRATE%k -minrate %VIDRATE%k -maxrate %VIDRATE%k -bufsize %BUFSIZE%k -acodec mp2 -ab 128k -ac 2 -f mpegts -mpegts_original_network_id 1 -mpegts_transport_stream_id 1 -mpegts_service_id 1 -mpegts_pmt_start_pid 4096 -streamid 0:289 -streamid 1:337 -metadata service_provider="MYCALL" -metadata service_name="My Station ID" -y udp://

The start command is used to set the priority for ffmpeg to high – this helps ensure it gets sufficient cpu attention on my i3 – you may not need to do this – experiment once things are working using task manager – right click on ffmpeg in the processes tab and choose Set Priority.

You may need to change the path to ffmpeg depending where you installed it.

You will need to change the metadata tags to your own call sign and station ID, and change the IP address and port to suit your chosen linux box – see next step:

You may need to change one or more of the transport stream IDs depending upon your receiver settings and abilities. If you’ve not already got the receiver working with DATV Express leave the values as they are – when you tune your receiver it will pick up these values. If you’re sending to a repeater you may well need to change some of the IDs.

That’s it for now on the Windows box. Next we have to set up the Linux box to deliver the transport stream to the DATV Express card.


My netbook happens to run Lubuntu 14.04 – it could probably have been any Ubuntu variety though I have noticed that different distros either still have ffmpeg or have migrated to avconv. Either way both commands accept the same options so can be used interchangeably. We’re not going to use ffmpeg/avconv unless extra buffering is needed in this particular recipe.

All my tests with the DATV Express software from the main web site have failed. I’m not sure what the problem is but the only way I’ve found to get it working for now is to use the DATV Express Server software which Charles G4GUO has published via github. This does mean a little more work but it is straightforward and should work on most systems.

To date I’ve built it on an old Pentium 4 running Ubuntu 14.04, my netbook running Lubuntu 14.04 and my i3 laptop running Ubuntu Studio 12.10. I’ve also built it on two raspberry pi’s – a model b /512 and a new V2 pi. All have worked insofar as the software compiled successfully and ran.

In order to use the Express Server you’ll need to build it using Qt Creator (But see note added at the end of this). Use Lubuntu Software Centre, Synaptic Package Manager or apt-get to install Qt Creator, git and libusb-dev which is also needed.

sudo apt-get install qtcreator git libusb-dev

If you’ve never built any software or you’re using a newly set up system you’ll probably need to add gcc and qt4-dev to this list:

sudo apt-get install gcc qt4-dev qtcreator git libusb-dev

Expect it to take a while – make tea etc. as many packages will also be downloaded and installed to satisfy dependencies.
Create a suitable directory under your home

mkdir datv
cd datv

Grab the latest git repository for Express Server

git clone https://github.com/G4GUO/express_server.git

This will create another sub-folder: express_server, and will populate it with the source code. Fire up Qt Creator and open ~/datv/express_server/express_server.pro

You’ll get a warning about No .user settings… – choose Yes

Accept the defaults in the Configure Project dialog… – choose Configure Project

Assuming no errors occurred hit Ctrl-B or choose

Build/Build Project "express_server"

Again assuming no errors occurred you should now have a file ~/datv/build-express_server-Desktop-Debug/express_server. You could run this but it would not be able to see the various firmware and configuration files included in the git repository. You’ll need to fire up a terminal window and navigate to the original git folder:

cd ~/datv/express_server

In that same folder you’ll find datvexpress.txt – edit this file to the desired values for frequency, FEC etc. Ensure that you set the tsock value to match the port number in the ffmpeg command line on the Windows machine (1234).

Connect DATV Express, power it up and start the server:


The server should start up and initialise the card by sending the various firmwares to it. After a pause you should see “UDP sockets and process threads are running”.

If your receiver is tuned and on you’ll see a blank screen rather than no signal – this shows all is well!

If it simply says it cannot find the DATV Express hardware you need to read the manual from the DATV Express web site – you’ll need to set the permissions by modifying a udev file.

Alternatively just run it as root:

sudo su

Sending the transport stream:

Go back to the Windows machine and launch the batch file we created earlier. Choose symbol rate and FEC to match the settings in datvexpress.txt on the linux box.

ffmpeg will launch in a new window and display something like:

Press [q] to stop, [?] for help
frame=  167 fps= 25 q=3.0 size=    1288kB time=00:00:06.60 bitrate=1599.0kbits/s dup=1 drop=0

The numbers will keep changing! If instead you get lots of error messages or buffer overflow warnings check and re-check the various IP addresses etc. and that the machines can communicate to each other (ping works). Also look for over zealous firewalls and other communication problems. There are diagnostic tools which can help – I’ll hopefully write up some of these in the near future.

If everything works whatever vMix is putting out to it’s external output should now be transmitted in DVB-S mode by DATV Express. If you’ve not already tuned in now it the time to figure out your receiver. I use a 5cm length of wire at transmitter and receiver for benchtop testing at 23cm frequencies. These can be directly received by most free to air satellite receivers.

You’ll need to set up a transponder on the corresponding frequency and symbol rate then scan for channels. On my receiver the transponder is set to 11030 MHz which when used with a 9750 LNB gives an IF of  1280mHz. Polarisation is irrelevant.

Controlling DATV Express

You can switch DATV Express ptt on and off by writing to a temporary file. Details on how to do this are in commands.txt in the source code directory on the Linux box.

I usually run a second terminal window or, if using Linux without XWindows running I switch between consoles (ctrl-alt-F1 ctrl-alt-F2 etc.) in order to issue commands.

Useful commands include:

echo "set freq 437000000" >> /tmp/expc
echo "set ptt rx" >> /tmp/expc
echo "set ptt tx" >> /tmp/expc
echo "set kill" >> /tmp/expc

…many more are documented. You can change things like FEC on the fly. If you do so you will need to stop and restart ffmpeg. In the ffmpeg window hit ‘q’ and it will safely terminate. Launch it again and set the new values for FEC or symbol rate.

Note that if you cheated and are running express server as root you’ll need to do

sudo su

before sending any of these commands. Doing sudo echo won’t work because of the redirected output!

The last command (set kill) is important – this gracefully shuts down the software and hardware – if you terminate it using ctrl-c or similar the board will continue trying to transmit which is undesirable!

Have fun…


Since I wrote this Charles G4GUO has kindly pointed out that the latest revision of Express Server on Github can now be built using make. This means that you do not need to install Qt Creator and qt4-dev but may need to install ‘make’:

sudo apt-get install gcc make git libusb-dev
sudo make
sudo make install

Note that I haven’t tested this!

Thanks for your input Charles!

5 thoughts on “DATV Express with vMix using ffmpeg to generate the Transport Stream”

Leave a Reply

Your email address will not be published. Required fields are marked *