Random Quote Board

Rastering Analog Video with Gnu Radio

Gary Schafer, September 2025

I attended Shmoocon a few years ago, and was able to take part in my first "capture the flag". One of the "flags" required viewing an analog video signal. This was before I'd begun playing around with SDRangel, so I needed some way to raster the video signal without requiring a TV set (which wasn't handy at the time). I came up with a Gnu Radio flowgraph to do it. I was in a hurry at the time, so my first flowgraph was barebones. I've since enhanced it. That's what I'll cover here.

Let's get a couple of things out of the way right now about what this flowgraph will (and will not) do.

  1. This flowgraph will work on NTSC, PAL or SECAM signals.
  2. I'm just going for video. I didn't add audio demodulation (if any) on the signal.
  3. This flowgraph will only show the image in black and white. Getting to the color means properly and precisely demodulating the chroma subcarrier signal, plus figuring out how to separate out the Y, U and V signals. That's a bit more than I want to do and, frankly, I'm not certain how I would do it in Gnu Radio.
  4. For the purposes of this flowgraph, I consider PAL and SECAM to be the same thing. Since I'm not dealing with color (see previous comment), the timing is my only concern. The timing for these two types are equivalent.
  5. Gnu Radio does not currently have a way to sync with the video signal. Instead, we'll create our own sync that should be good enough.
  6. I didn't setup up the screen controls and display for neatness. I didn't bother adding values to the "GUI Hint" properties to any of the control or display blocks.

I'm going to jump into the flow of rastering, with the assumption that you, the reader, already has a basic understanding of analog video rastering. If not, well, go ahead and try it anyway if you have a known analog video transmitter near you! What have you got to lose?

General Flow of Rastering with Gnu Radio

Image showing a wide DVD player with a small, gray box on top. The gray box roughly 5 cm square and 3 cm high has three colored connectors plugged into it, a yellow, red, and white one. Out of the top of the gray box extends a thin wire antenna roughly 20 cm long.
This is the transmitter, the gray box, on top of the video source feeding it, an old Panasonic DVD player. In the player is a DVD of the old 1950s movie, "The Crimson Pirate", starring Burt Lancaster. The gray box is an analog, wireless video extender. It uses FM to transmit its signal to a receiver nearby. That receiver will be plugged into the actual display.
Spectral trace showing a signal that starts low on the left, rises to a peak in the middle, then slopes down towards the right.
As it rises on the left, it seems to bounce up like a bouncing ball that initially bounces higher, then hits a peak, then drops again. This bouncing occurs before the signal peaks at the center of the display. After the peak, the signal waves up and down seemingly random til it reachs the bottom of the display on the right.
Spectral trace of a FM video signal. This was captured with a 20 MHz sample rate, so that span on this display is also 20 MHz. I captured this with a Signal Hound BB60C and Signal Hound's "Spike" software.
Block diagram showing a signal flow from the top left to the bottom right. Each line ends with a block that connects to the left end of the line below. There are three lines total. Along the top are blocks for entering variables and controls for adjusting certain parameters.
Gnu Radio flowgraph for rastering video. This particular flowgraph uses the Ettus Research USRP B200-mini for input. It would work just as well with a HackRF One or even a file containing samples of a modulated video signal. The "Quadrature Demod" block is due to the transmitter using FM. If it had been an actual, over-the-air analog video broadcast, I would probably have used a "Complex to Mag" block.

I've also made the flowgraph available if you wish to download it.

Here's how to work with this flowgraph. Before running it, enter the appropriate values in the blocks marked with the comment, "USER ENTERED VARIABLE". These are:

When you run it, the flowgraph:

  1. Performs calculations based on the video type (NTSC, PAL/SECAM). These include calculating the horizontal line rate, the number of pixels in the width of the Video SDL Sink, the limits for the horizontal line rate adjustment, and the maximum limits for the horizontal and vertical shift.
  2. Inputs the signal. This can be from a SDR, from a file, or from a network connection. For this post, I used the USRP B200-mini.
  3. Filters the signal. This will either be based on the signal and SDR (either with the sample rate or with a manual setting for the SDR's input bandwidth), or with an external filter. I'd use an external filter if I was going after an AM signal that used VSB. If there was an audio signal on the next channel down (meaning within a few MHz of the video carrier), I'd throw in a filter to get rid of that before demodulation. But for FM video? Those are wide enough bandwidth that by setting the sample rate properly, the signal will already be filtered just based on the sample rate.
  4. Demodulates the signal. For those outside of the USA, you may still have broadcast analog video signals. If that is what you're going for, then you'll need an AM demodulator (a "Complex to Mag" block works nicely). If you're going after an analog video transmitter such as a wireless video extender or perhaps a drone, those transmissions are FM (a "Quadrature Demod" block works here). For this post, I'm using an analog wireless video extender. It uses FM. Hence, the "Quadrature Demod" block.
  5. Filters the baseband signal. NTSC, for example, uses the bottom 4.2 MHz for video. This includes a chroma subcarrier at roughly 3.58 MHz. For FM video, audio subcarriers exist at 6 and 6.5 MHz, while for AM broadcast video, the audio subcarrier exists at 4.5 MHz. This filter gets rid of any audio subcarriers.
  6. Adjusts the sample rate. There are two parts to this. The first is to get to the approximate sample rate required by the specific video standard (namely either NTSC or PAL/SECAM). The second step is to get the precise timing so that the image will not drift on the display. I do both steps with the "Polyphase Arbitrary Resampler".
  7. Adjusts the amplitude of the video signal. The Video SDL Sink (the block we'll use to display the video signal) will use an unsigned 8-bit integer (uchar). This means we need to have amplitudes between 0 (black) and 255 (white). I'm performing this in two blocks. The first is a multiplication that takes place in the "Gain" setting of the "Quadrature Demod" block. This multiplication is essentially a contrast adjustment. The other block is an "Add Const" (add a constant) to adjust the level of the overall signal and keep it within the 0 - 255 limits. This is essentially a "brightness" adjustment.
  8. Shifts the video display so that it is centered horizontally and vertically. Once you have the timing set juuuuust right, the display should not be moving, but it doesn't mean it will be centered, either horizontally or vertically. Therefore, I'm using a "Delay" block to adjust these positions. NOTE: This block is not absolutely required. You can get away without it by using the timing adjustment earlier. But this is tricky. However, if you're operating at the very edge of your system (seeing overflows from the SDR, primarily), then you can delete this block and just use the timing.
  9. Interlaces the lines. As I said, broadcast analog video is interlaced. I'm using two blocks to interlace the video, a "Delay" block in combination with a "Stream Mux" block. The delay adds a half-frame (one field) delay, then multiplexes the non-delayed and delayed to provide for the interlacing.
  10. Finally, displays the video. The Video SDL Sink display ratio (say, widescreen or 4:3) can be set using the "Display Width" and "Display Height" values. I'm using a relatively large size because I'm fortunate to have multiple monitors. If you're operating on a small laptop or tablet screen, you may wish to decrease these values to a size that works for your screen. This will probably take some trial-and-error.

Once the flowgraph is truly running, you'll need to make a few adjustments. I'll give the general flow here.

  1. If needed, adjust the center frequency of your SDR to that of the video transmitter, then adjust the appropriate gain values of that SDR so that you have a decent signal strength.
  2. Once you have a video signal on the time display, adjust the contrast and brightness controls so that the signal amplitude extends as much between the top and bottom of the display as possible.
  3. Adjust the horizontal rate. This is what sets the sync for the signal. The rate is in Hz, but the step size is 1/1000th of a Hz. This means it will change slooooowly. You can try sliding the slider manually. I tend to use the up / down arrows. Anyway, once the signal stops drifting, you're set. I've set the limits for the timing to be within +/- 10 Hz of the video type horizontal rate. This has worked on pretty much every transmitter I've seen. HOWEVER, given the possibility that this will be used by many more people, if you adjust the sliders to the limit and it is still drifting, you'll need to increase those limits. ALSO, the video display will probably continue to drift very slowly over time. So this may need to be adjusted periodically.
  4. Adjust the position of the display using the horizontal and vertical shift sliders to center the display.
Screen showing several horizontal slider bars along the top and a screen showing a filled blue screen along the bottom.
Screen showing the various controls along the top and the time domain display along the bottom. The time display shows a full frame (two fields) in order to set the amplitudes correctly.
Video screen showing a display with the actual bottom of the screen centered vertically and the right edge roughly centered horizontally.
The initial display after setting the timing correct.
Video screen centered properly.
The properly-centered video display. After adjusting the timing for drift, I used the horizontal and vertical shift controls to move the display so that it was centered.

Final Notes

Here are a couple of other things I learned while I was putting together this flowgraph and this post:

I normally only do one post a month, but I decided to throw this together now in order to have it for reference for my next post on hacktv. Til then!

Here's a Random Fact...