This article describes a simple video broadcasting setup based on [[:Category:Gstreamer|Gstreamer]], [[:Category:GNU Radio|GNU Radio]] and the [[:Category:USRP|Universal Software Radio Peripheral (USRP)]]. It does not (yet) provide any DVB-T or DVB-S compatible system &ndash; just a simple way to get your webcam on the air!

+

This article describes a simple video broadcasting setup based on [[:Category:Gstreamer|Gstreamer]], [[:Category:GNU Radio|GNU Radio]] and the [[:Category:USRP|Universal Software Radio Peripheral (USRP)]]. It does not (yet) provide any DVB-T or DVB-S compatible system &mdash; just a simple way to get your webcam on the air!

+

+

== Overview ==

+

+

The objective is to create a simple digital video broadcasting setup using easily available components as illustrated on the figure below. The long term goal is to get a similar setup up to [http://en.wikipedia.org/wiki/Near_space near space] and [http://en.wikipedia.org/wiki/Low_Earth_orbit LEO].

[[Image:DvbSys.jpg|600px]]

[[Image:DvbSys.jpg|600px]]

+

; UVC Webcam

+

: An UVC compliant webcam is used as a cheap but efficient video source. Current [[:Category:Cameras|webcams]] can provide video at HD resolutions, though the image quality is not as good as with a good HD camcorder. Nevertheless, [http://en.wikipedia.org/wiki/USB_video_device_class UVC cameras] are very easy to capture via USB and are thus excellent for functional and performance testing purposes.

+

; Gstreamer

+

: Gstreamer is used for everything related to video processing. This includes capturing the video frames from the camera(s), adding text overlays, compressing, encoding and multiplexing into a transport stream. See my [[Gstreamer Cheat Sheet]] for all the cool stuff we can do with Gstreamer.

+

; GNU Radio

+

: GNU Radio is used to create the software defined radio transmitters and receivers.

+

; USRP

+

: The Universal Software Radio Peripheral provides the necessary transmitter and receiver hardware to get our signals on the air (bits and bytes can not fly)

−

== Overview ==

+

Standard PC hardware is used to run both the Gstreamer and GNU Radio processes, i.e. we do not use any expensive video compression hardware. A modern PC with an Intel i7 processor is perfectly capable of compressing the HD video and running the software radio process at the same time.

−

== Conceptual prototype (DVB Mk0) ==

+

Using these components we can accomplish some very advanced and cool functionalities, such as:

−

This is the very first muck-up that I used to get my [[Logitech Webcam Pro 9000]] webcam on the air. Gstreamer and GNU Radio are connected using a named pipe.

+

# Get multiple video streams and other data into one data stream (e.g. MPEG-TS)

+

# Experiment with different codecs and containers

+

# Experiment with different combinations of modulation and FEC

+

# Run simulations without any RF hardware in the loop

+

# Get on the air on 1.2 GHz (WBX, DBSRX, RFX1200), 2.4 GHz (RFX2400) and many other frequencies

+

# Setup two-way video chats

+

+

== Source code ==

+

+

The source code is available from http://github.com/csete/gnuradio-dvb - check out with:

+

git clone http://github.com/csete/gnuradio-dvb.git

+

or

+

git clone git://github.com/csete/gnuradio-dvb.git

+

+

== V1: Conceptual prototype ==

+

+

This is the very first muck-up that I used to get my [[Logitech Webcam Pro 9000]] webcam on the air. It encodes the video to H.264/MPEG-TS and uses GMSK modulation. There is no error correction. Gstreamer and GNU Radio are connected using named pipes.

[[Image:DvbSysDia.png|700px]]

[[Image:DvbSysDia.png|700px]]

+

The setup is quite functional and robust, though it suffers from the fact that the MPEG-TS muxer does not support CBR, which is required by GNU Radio and the USRP. Consequently, the video freezes every now and then for about half a second (buffering).

+

+

There are two videos showing this prototype in action, one [http://www.youtube.com/watch?v=2VUZ7H60F68 using a video test source] and one [http://www.youtube.com/watch?v=RzIe_IWGvmA using a webcam].

Before executing anything, create the pipe that will be used to connect Gstreamer with GNU Radio:

−

[[Image:GmskTx.jpg|600px]]

+

mkfifo video1.ts

=== Receiver ===

=== Receiver ===

−

[[Image:GmskRx.jpg|600px]]

+

[[Image:Gmsk_rx.grc.png|600px]]

+

+

For Gstreamer pipeline I wanted to use something simple like

+

+

gst-launch -v playbin uri=file:///path/to/video2.ts

+

+

but this does not work (probably due to the mixed VBR/CBR). Fortunately, mplayer can be used instead:

+

+

mplayer video2.ts

+

+

Before executing anything, create the pipe that will be used to connect Gstreamer with GNU Radio:

+

+

mkfifo video2.ts

=== Transceiver ===

=== Transceiver ===

Line 28:

Line 83:

[[Image:GmskTrx.grc.jpg|600px]]

[[Image:GmskTrx.grc.jpg|600px]]

−

This transceiver has been running well on a 13" 2.4GHz MacBook Pro for more than 4.5 hours ([http://www.youtube.com/watch?v=XtlyNlRAHGM video] of the setup).

+

This transceiver has been running well on a 13" 2.4GHz MacBook Pro for more than 4.5 hours ([http://www.youtube.com/watch?v=XtlyNlRAHGM video] of the setup and [http://www.oz9aec.net/index.php/gnu-radio/gnu-radio-blog/363-full-duplex-transceiver-version-of-the-dvb-setup blog post]).

[[Image:GmskTrxSetup.jpg|400px]]

[[Image:GmskTrxSetup.jpg|400px]]

Line 35:

Line 90:

=== Simulator ===

=== Simulator ===

−

This simple simulator was used to test the idea before it was put on the air. It simply sends the video through a GMS modulator, mixes it with noise, the a GMSK demodulator.

+

This simple simulator was used to test the idea before it was put on the air. It simply sends the video through a GMSK modulator, mixes it with noise, the a GMSK demodulator.

−

''Insert flowgraph''

+

[[Image:Gmsk_sim.grc.png|700px]]

A video demo of the simulator in action is available [http://www.youtube.com/watch?v=XtlyNlRAHGM here].

A video demo of the simulator in action is available [http://www.youtube.com/watch?v=XtlyNlRAHGM here].

+

+

=== Other codecs ===

+

+

The setup was also tested using Theora codec in Ogg container. It ran very well (in some way better than H.264+MPEG-TS) in simulator and transceiver mode when using a vuideotestsrc; however, with the [[Logitech Webcam Pro 9000]] it lost sync after a few minutes and the mplayer console got filled with "Ogg: bad packet in stream 0" messages and the effective framerate was down at 1 fps.

+

+

[[Image:GR-DVB-TheoraSim.png|600px]]

+

+

[[Image:GR-DVB-TheoraTrx1.png|300px]]

+

[[Image:GR-DVB-TheoraTrx2.png|300px]]

+

+

See blog post: [http://www.oz9aec.net/index.php/gnu-radio/gnu-radio-blog/372-an-experiment-with-theora-and-ogg-for-dvb An experiment with Theora and Ogg for DVB].

+

+

== V2: Phase Shift Keying ==

+

+

''Will introduce BPSK and QPSK''

+

+

+

== V3: FEC ==

+

+

''Will ad error correction code''

+

== Problems / TODOs ==

== Problems / TODOs ==

Line 47:

Line 123:

** Fix the MPEG-TS muxer

** Fix the MPEG-TS muxer

** The MPEG-TS muxer in the mplayer repository has been updated to support CBR

** The MPEG-TS muxer in the mplayer repository has been updated to support CBR

−

+

* Reduce the delay. I suspect it is introduced by the encoder because when I mess with the RF parameters I can observe the effects immediately.

+

* The default encoding is not optimal. Try to translate ffpreset to x264enc parameters

+

* On Ubuntu 10.04, mplayer reports the framerate to be twice the actual frame rate. On 9.10 it reports the correct frame rate.

Overview

The objective is to create a simple digital video broadcasting setup using easily available components as illustrated on the figure below. The long term goal is to get a similar setup up to near space and LEO.

UVC Webcam

An UVC compliant webcam is used as a cheap but efficient video source. Current webcams can provide video at HD resolutions, though the image quality is not as good as with a good HD camcorder. Nevertheless, UVC cameras are very easy to capture via USB and are thus excellent for functional and performance testing purposes.

Gstreamer

Gstreamer is used for everything related to video processing. This includes capturing the video frames from the camera(s), adding text overlays, compressing, encoding and multiplexing into a transport stream. See my Gstreamer Cheat Sheet for all the cool stuff we can do with Gstreamer.

GNU Radio

GNU Radio is used to create the software defined radio transmitters and receivers.

USRP

The Universal Software Radio Peripheral provides the necessary transmitter and receiver hardware to get our signals on the air (bits and bytes can not fly)

Standard PC hardware is used to run both the Gstreamer and GNU Radio processes, i.e. we do not use any expensive video compression hardware. A modern PC with an Intel i7 processor is perfectly capable of compressing the HD video and running the software radio process at the same time.

Using these components we can accomplish some very advanced and cool functionalities, such as:

Get multiple video streams and other data into one data stream (e.g. MPEG-TS)

Experiment with different codecs and containers

Experiment with different combinations of modulation and FEC

Run simulations without any RF hardware in the loop

Get on the air on 1.2 GHz (WBX, DBSRX, RFX1200), 2.4 GHz (RFX2400) and many other frequencies

Source code

V1: Conceptual prototype

This is the very first muck-up that I used to get my Logitech Webcam Pro 9000 webcam on the air. It encodes the video to H.264/MPEG-TS and uses GMSK modulation. There is no error correction. Gstreamer and GNU Radio are connected using named pipes.

The setup is quite functional and robust, though it suffers from the fact that the MPEG-TS muxer does not support CBR, which is required by GNU Radio and the USRP. Consequently, the video freezes every now and then for about half a second (buffering).

Before executing anything, create the pipe that will be used to connect Gstreamer with GNU Radio:

mkfifo video1.ts

Receiver

For Gstreamer pipeline I wanted to use something simple like

gst-launch -v playbin uri=file:///path/to/video2.ts

but this does not work (probably due to the mixed VBR/CBR). Fortunately, mplayer can be used instead:

mplayer video2.ts

Before executing anything, create the pipe that will be used to connect Gstreamer with GNU Radio:

mkfifo video2.ts

Transceiver

This simple, full duplex transceiver was created to allow using one computer and one USRP for both transmit and receive. By default, both the receiver and the transmitter are set to use the same frequency so that the receiver will receive what the local transmitter transmits; however, it can also be used to make two way video contacts.

This transceiver has been running well on a 13" 2.4GHz MacBook Pro for more than 4.5 hours (video of the setup and blog post).

Simulator

This simple simulator was used to test the idea before it was put on the air. It simply sends the video through a GMSK modulator, mixes it with noise, the a GMSK demodulator.

Other codecs

The setup was also tested using Theora codec in Ogg container. It ran very well (in some way better than H.264+MPEG-TS) in simulator and transceiver mode when using a vuideotestsrc; however, with the Logitech Webcam Pro 9000 it lost sync after a few minutes and the mplayer console got filled with "Ogg: bad packet in stream 0" messages and the effective framerate was down at 1 fps.