Feeding Video to Portsdown from vMix

From BATC Wiki
Revision as of 09:05, 9 January 2020 by G8GTZ (talk | contribs)
Jump to navigation Jump to search

You can stream video over UDP from vMix running on a Windows PC and then transmit it using the Portsdown transmitter.

The method outlined here will also work with other DATV tranmit systems such as the F5OEO custom firmware for the Adalm Pluto.

VMix Block.jpg

Vmix

Vmix is a very flexible piece of software allowing you to mix and edit various video sources - it also has advanced facilities such as green screen and tickers. It can stream directly on to the web but also produces a directshow external output which we can use to transmit DATV.

First, install vMix on your PC and make sure that it works with your selected video source. vMix can be downloaded from here: http://www.vmix.com/ The free version handles SD video and is adequate for our needs; it works in this mode after the 60-day trial period.

Make sure that your PC with vMix and your Portsdown transmitter are on the same wired network.  Wireless networks might work but have not been tested.

Now start up vMix and select a video source. Then configure the output, by clicking the cogwheel next to the output label and then clicking Settings.

Note the video resolution should be set to match your ffmpeg script.

VMix Config.jpg

ffmpeg

FFmpeg is a free and open-source project consisting of a vast software suite of libraries and programs for handling video, audio, and other multimedia files and streams.

We use ffmpeg to take the directshow output from Vmix, encode and multiplex it in to a compliant transport stream, add the service information and send it out using the UDP protocol.

The next step is to install ffmpeg on your PC. Download the latest build from here: https://ffmpeg.zeranoe.com/builds/

Use the release build, 32-bit, static. Unzip the downloaded file and move the files to a folder called ffmpeg on your C:\ drive so that it has the folders bin, docs, licenses and presets folders inside it.

ffmpeg script or batch file

The last installation step on the PC is to install the windows batch file which will control ffmpeg. This script will vary depending upon ypur application - here are 2 examples:

H 265 file script for Nvidia GTX10xx graphics card

An example script based on one supplied by from Thomasz SPxxx is available for download here: File:sample 333ks 23 s2 440.zip - you can rename it when saving but the name indicates it is set for 333ks 2/3 FEC DVB-S2 and the TS bit rate is 440 kbit/s.

Unless you have set up system paths, this batch file must be saved in the ffmpeg /bin directory

This script is set to use the H265 encoder onboard an Nvidia graphics card but you will need to edit the script as follows:

  • Line 2+ Enter your own station details
  • Line 17 - enter the IP address and UDP in port of your Portsdown or Pluto etc
  • Line 59 - set the video resolution to match the Vmix external output resolution.

It is suggested that you save a number of batch files with different bit rates at line 11.

Alternatively you can remove the rem at the beginning of line 9 and rem out line11 - then start the file by entering the file name followed by the TS rate required. For example "Tx.bat 440"

Original Portsdown script

You can download it from here File:VMix2Portsdown.zip Unzip the file and save the and save the vMix2Portsdown.bat file to a logical place of your choice. You will need to make some amendments to the file; do this by right-clicking and selecting edit. Near the top of the file replace the callsign G8GKQ with your callsign; then replace the IP address (192.168.2.111) with the IP address of your Portsdown TX RPi. This IP address is displayed when you change the Portsdown video source to IPTSIN (don't forget to press the space bar to change the selection!).

You may want to adjust the aspect ratio of the output. This is done by editing the line...
-pix_fmt yuv420p -r 25 -s 768x576 -aspect 4:3 -qmin 2 -qmax 35^

by changing 768x576 to whatever you want. A common setting is 720x540

Save the file.

The vMix2Portsdown batch file encodes the video stream in MPEG-2 at symbol rates of 1000, 2000 and 4000 kS/S. For other encodings and rates, try one of these experimental batch files ...

To run the file, double click on the file in Windows Explorer, and it should ask for the Video bitrate and FEC, then ask you to press any key.

When you press a key, the window should change to one giving information about the stream being sent towards the Portsdown TX. The stream is simply squirted at the IP address that you entered earlier - it can be left running and the TX does not need to be on.

Using the system

  • Click OK on the Vmix external Output button. It should turn red.
  • Next, start the batch file that you created earlier - this must be running before you go in to transmit on the Portsdown.
  • Lastly, set up your Portsdown TX with IPTSIN as the input and identical SR and FEC to that set up in the batch file.
  • Select transmit and it should work. (You can select transmit and standby on the Portsdown console (or touchscreen) without having to sop or start the batch file.)

If using the F5OEO Pluto firmware, start transmit....

Using vMix with the Portsdown Software on a Raspberry Pi and DATV Express

This mode does not currently work (6 December 2017), but will be bug-fixed in the next release.

Here is the system block diagram

VMix Block Exp.jpg

Initial set-up to use DATV Express is the same.

More to follow..............

Troubleshooting for Advanced Users

The video bit rates in the Portsdown batch file are hard-coded based on what was found to work - a trial and error process to minimise both under-runs and over-runs of the transport stream in the Portsdown software. Both cause picture disturbances. If you want to see the effect of different settings, you can monitor the under-run or over-run by watching the text output from rpidatv. To do this, open 3 Linux terminal sessions; the first one should have the Portsdown Console Menu. Use the console for selecting the desired SR and FEC, but not selecting transmit. Go to the Linux command prompt on the second console to select transmit and watch the buffer messages. Do this by typing:

/home/pi/rpidatv/scripts/a.sh

The 3rd console should also be at the Linux prompt and can be used to stop the transmitted stream by typing:

sudo killall rpidatv

You can then repeat this test having adjusted the video bit rates in the vMix2Portsdown.bat file.

Most of the information on this page was originally provided by Chris MW0LLK. For more detailed information see his blog at http://www.tannet.org.uk/