Live Video and Audio with the ATSC Transmitter!

Follow our development of DSP and SDR tutorials

Moderator: robert.ghilduta

Post Reply
Posts: 27
Joined: Sun Jan 05, 2014 9:50 pm

Live Video and Audio with the ATSC Transmitter!

Post by jowijo » Sat Apr 26, 2014 4:09 am

With the ATSC Transmitter script, I managed to get live transmission OTA using a combination of Snowmix (gstreamer frontend), avconv, and tsbmuxer (Opencaster). Tested 480p (16:9), 720p60, and 1080i60 at 5, 14, and 16 megabits per second respectively. I will be posting a video and uploading a sample TS once I work out some kinks in the chain. If you want to get your feet wet and try it yourself, I have some half-baked instructions below. :D

WARNING: I am not that great at writing a "How-to", if you get stuck let me know.

My setup has two channels mapped by PSIP to 12.1 and 12.2: The first channel is a 1080i60 video feed, and a 192 kbps Stereo AC-3 feed. The second channel is audio only and sources music played in mixx (using JACK)

A rough script is here. Mind you, you'll have to change it to meet your needs; and it is set to 1080i so, if it bottlenecks, try changing it to 480p. (I'll explain this further down).

You will need a couple of things before we get going...
  • Download the "", and "" from my GDrive, and put them in a new folder.
  • Download and build Snowmix.
  • Download and install Opencaster.

The first thing we must do to properly test things, is to get our PSIP data ready. I have done most of the hard work for you, and all you need to do, is tweak some settings to your tastes:

  • Line 32 | Channel name. It is set to "BladeRF". This is a UTF-16 code and I used this to generate them.
  • Line 33 | Major Channel Number: This is set to "2" and will appear as channel 2.1 on your TV.
  • Line 109 | The PID for your MPEG-2 video is 65. Be sure to change the "streamid 0:65" option in avconv to reflect your new PID if you change it!
  • Line 117 | Same as 109, this one is audio instead. As before, change the "streamid 1:66" to whatever you change this to.
  • Line 124 | Language code (Set to "English" by default). You can find yours here.

Not much here, but some important things include:
  • Line 38: VIDEOFORMATOUT | The height is set to 1280x720. If lowering your resolution, change this to match. A great guide on supported resolutions is here. Seriously, don't go crazy--your TV/STB will not appreciate an out-of-spec resolution.
  • Line 56 bitrate | Bitrate is set to almost-but-not-really 16 MB/s. Change this to 4000 or 5000 for 480p video, 12000-14000 for 720p.
  • 62 ...oh boy... | I assume you all know how to set up an ffmpeg/avconv line, just be sure to keep things within the 17 MB/s bitrate. DO NOT change the muxrate, DO NOT use a vcodec other than mpeg2video. You do however, have some leeway with using ac3 or mp2 for audio. Some TVs play nice with MP2, some don't. Also, be sure to keep the named pipes the same.
  • Line 62b | Change "<somewhere>test.ts" to "/tmp/tx.ts"

Phew! Now for the fun part.

Once you have that all done, open a terminal and change directories:

Code: Select all

...and then run

Code: Select all

./snowmix ../ini/basic_feeds
Unless you have your own custom INI, then point it there.
You should see a blank window.

Now, in another terminal tab, run your ./ script:

Code: Select all

Now, go to another terminal tab, and execute your ATSC modulation script with the following:

Code: Select all

<your ATSC modulation py> /tmp/tx.ts
Assuming it all works, Check your TV! You should see some PID numbers, that blank window should now be buzzing with color and text, and avconv encoding. If not, it will tell you. CTRL+C to kill it at any time; and in Snowmix's tab, type "quit" to quit. Now check that TS file. Does it work? (mpv and SMPlayer work great with it, VLC doesn't open it for whatever odd reason).

[*] Some televisions like to be re-scanned before they find a new channel. Sometimes I had to do this, and sometimes I did not: your mileage may vary.
[*] I cannot guarantee this will work at all for you. Works fine for me on both Arch Linux and Ubuntu 14.

Hopefully it works for someone and you found it interesting.

- Jordan

Post Reply