From charlesreid1

Before we begin: qsstv in action...

Slow Scan Television from charlesreid1 on Vimeo.

Overview

qsstv is a utility for dealing with slow scan television signals. My first experience using qsstv was part of the Defcon Darknet CTF game, where one of the challenges involved slow scan TV images and several related challenges.

sstv

First, let's talk about slow scan TV. This is a method for transmitting images, pioneered by ham radio operators, for transmitting images using narrow bandwidth (3 kHz), an order of magnitude smaller than the bandwidth required to send moving television images (6 MHz).

Slow scan television was allowed for use by radio amateurs in 1968, and was utilized as a part of the Apollo lunar missions.

A sample SSTV signal is provided on Wikipedia: https://upload.wikimedia.org/wikipedia/commons/c/ce/SSTV_sunset_audio.ogg

See the SSTV page for details.

qsstv

The utility qsstv is an open-source slow scan television program. The program does not implement any kind of radio receiver - that's the job of a handheld radio transceiver or an SDR system. It simply takes audio input from the microphone or line in. This means you can use qsstv several ways:

  • set up a microphone next to your radio transceiver and tune it in to an sstv signal
  • download an MP3 of a pre-recorded sstv signal
  • utilize an RTL-SDR and software to tune the SDR receiver, and use that to tune into the sstv signal

Installing

This install assumes a basic "offline" setup: piping a pre-recorded SSTV signal from audio out to audio in, and demodulating it with qsstv.

Later in the page we'll look at some other, alternative configurations using SDR.

installing qsstv on kali linux

Before you begin, you'll want to set up a tool to control your audio streams: pavucontrol.

From there you can start up qsstv

pavucontrol

if you need a way to pipe audio out to audio in, use pavucontrol

apt-get install pavucontrol

start qsstv

start qsstv by running that command from the command line. This will open a GUI window. Once the qsstv program is open, you can configure the audio in/out settings with pavucontrol.

configure pavucontrol

make output monitor:

Click input devices

Click "Monitors" from drop down menu on bottom

Should see "Monitor of built-in audio analog stereo"

Click the lock to unlock it

hook up output monitor to qsstv input:

Once you have started qsstv:

Click recording

Pick Monitor of built-in audio analog stereo

This links the audio input that qsstv is receiving to the audio output monitor that you've created (the thing that captures all the audio out).

check configuration:

To check your configuration:

Start playing a sound (using the program "Video", for example) to audio out

Now open pavucontrol, and go to the Input Devices tab.

The "Monitor of built-in audio analog stereo" device should have a volume indicator that should be jumping around.

run qsstv

now that qsstv is working and the audio channels are properly configured, you can click the "Play" button in qsstv (the blue button with a right-facing triangle). That will set qsstv into listen mode. Now you can switch over to the "Video" program, or whatever audio player you're using, to play the SSTV signal. The waveform of the audio signal should show up on the right side, and the instantaneous spectral plot should be dancing in the upper right corner. The image will appear one line at a time in the middle of the window.

Qsstv in action.png

crashing:

qsstv is crashing whenever it tries to autosave an image. Not sure what is going on.

Have just been using the sstv sample found in wikimedia commons.

Here is a sample that I created by running an image of Jupiter from NASA through the SSTV transmit tab:

debugging:

I was having some issues with qsstv crashing midway through drawing images. this was happening with SSTV signals from a variety of sources.

To debug the behavior and figure out what was happening, I ran qsstv through gdb:

# gdb
GNU gdb (Debian 7.11.1-2) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".

(gdb) load /usr/bin/qsstv
You can't do that when your target is `None'

(gdb) exec-file /usr/bin/qsstv

(gdb) run
Starting program: /usr/bin/qsstv /usr/bin/qsstv
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe827b700 (LWP 10798)]
[New Thread 0x7fffd8320700 (LWP 10799)]
[New Thread 0x7fffd78e7700 (LWP 10800)]
[New Thread 0x7fffcab95700 (LWP 10801)]
[New Thread 0x7fffca394700 (LWP 10802)]
[New Thread 0x7fffc9b93700 (LWP 10803)]
[New Thread 0x7fffc9392700 (LWP 10804)]
[New Thread 0x7fffc8b91700 (LWP 10805)]

Thread 5 "rx-thread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffcab95700 (LWP 10801)]
0x0000555555691df4 in ?? ()

(gdb) 

(gdb) bt
#0  0x0000555555691df4 in ?? ()
#1  0x00005555562c9090 in ?? ()
#2  0x00005555562aed50 in ?? ()
#3  0x00007fffc40274e0 in ?? ()
#4  0x00005555562c9090 in ?? ()
#5  0x00007fffc40274f8 in ?? ()
#6  0x000055555568c450 in ?? ()
#7  0x0000555555dd6dc0 in ?? ()
#8  0x00007fffcab91c10 in ?? ()
#9  0x0000000000000011 in ?? ()
#10 0x00007fffc40274f8 in ?? ()
#11 0x00005555563d4c80 in ?? ()
#12 0x00007fffc40274e0 in ?? ()
#13 0x0000000000000000 in ?? ()

This is not built with debug flags. Not helpful.

I also tried changing the method specification, from Auto to Martin 1, but that had no effect.

It looked like the crash was happening around 25% of the way through, which corresponded to the autosave feature's first attempt to save the image, so this was an indication it was an issue saving the image.

I changed the format from png to jpg, but the program still crashed - no change in crash behavior.

"Trash folder does not exist" message also appeared - so perhaps a directory issue. I checked Options > Configuration in qsstv and looked at the directories for images in/out. They all existed.

hail mary (worked):

Somewhere right smack in the middle of all of the problems I was having with QSSTV, the audio on the laptop running Kali Rolling stopped working. Not great, for a laptop that's supposed to be a RADIO laptop, if your sound isn't working.

My hail mary was to reinstall the audio stuff, except not using the audio drivers in the apt repositories - but rather, installing everything by hand. This worked like a charm.

#!/bin/sh

apt-get remove --purge alsa-*
apt-get remove --purge pulseaudio

wget ftp://ftp.alsa-project.org/pub/firmware/alsa-firmware-1.0.29.tar.bz2
tar -vxjf alsa-firmware-1.0.29.tar.bz2
cd alsa-firmware-1.0.29/
./configure && make && make install

cd ../

wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.2.tar.bz2
tar -vxjf alsa-lib-1.1.2.tar.bz2
cd alsa-lib-1.1.2/
./configure && make && make install

cd ../

wget ftp://ftp.alsa-project.org/pub/plugins/alsa-plugins-1.1.1.tar.bz2
tar -vxjf alsa-plugins-1.1.1.tar.bz2
cd alsa-plugins-1.1.1/
./configure && make && make install

cd ../

wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.1.2.tar.bz2
tar -vxjf alsa-utils-1.1.2.tar.bz2
cd alsa-utils-1.1.2/
apt-get install -y libncurses5 libncurses-dev xmlto # <--- this will take a while
./configure && make && make install

cd ../

apt-get install -y pulseaudio

Once this script is finished, you can reboot:

$ reboot now

your audio should be working once you restart. You may have to run pulseaudio at the command line, but probably not.

(also see: Kali/Fixes)



Receiving SSTV Signals

To receive slow scan television signals, qsstv uses audio in. This is possible because SSTV is designed to use about the same bandwidth as a voice signal (3 kHz) so can be played by and picked up by a sound card.

Receiving methods

qsstv is able to use the sound card to receive signals, in place of a radio receiver. Therefore, there are several ways to get signals to qsstv:

  • Connecting audio out to audio in (in software, on same computer)
  • Connecting audio out (device 1) to audio in (device 2)
  • Microphone

I used the first method, as I was testing out the SSTV functionality with pre-recorded SSTV signals. I was playing these wav/mp3 files to audio out, then capturing that audio out and sending it to audio in, so that qsstv could hear it too.

The second method - connecting audio out of one device to audio in of another device - is useful if you are running a radio receiver. This setup would enable you to receive SSTV signals with the radio, then pipe that audio to the computer's audio in, where qsstv could hear it too.

The third method is a variation on the previous method - if you have a handheld radio, say, and are tuning into an SSTV signal, you can hold the speaker up to a microphone, and the entire contents of the signal will be transferred from the speaker to the microphone. (Remember - this is only a 3 kHz wide signal, so there's no "hidden" information that's lost this way.)

Connecting audio out to audio in

After installing qsstv on a Kali Linux laptop, I was able to connect the audio out to the audio in via software. This was done using the pavucontrol utility, which provides a more advanced sound configuration interface than the Sound control panel.

Run pavucontrol on the command line to open the control panel. Click Input Devices, then pick Monitors from the drop down on the bottom. Play some sound and make sure the "Monitor of Built-In Audio Analog Stereo" indicator is bouncing and moving with the sound. Then start up qsstv program, then click the Recording tab of the pavucontrol control panel. Change the recording input device for the qsstv program to the "Monitor of Built-In Audio Analog Stereo" device, which will hook up the audio in (which the qsstv program is listening to) to the audio out (which is what the wav/mp3 player is playing, and what is coming out of the speakers).

Now when you play a wav or mp3 file with an SSTV signal in it, you'll hear it coming out of the speakers, but that will also be sent to the qsstv audio inputs, where it will be fed to the SSTV demodulator, and translated from audio back into an image.


Transmitting SSTV Signals

Luckily, the qsstv software makes it just as easy to transmit signals as it is to receive them. It also makes recording signals to an MP3 or wav file very easy, so it's also possible to create your own SSTV signals in audio files and post them for others to decode. You can also port those files over to a computer with an SDR to transmit them over the air (within legal limits, of course.)

Creating SSTV Signal from Image

To create an SSTV signal from an image, open qsstv and click the "Transmit" tab on the top.

Load image

The first thing you need to do is load an image to transmit. Click the icon of the file folder, which will take you to a file picker. Once you pick your image, it will open in the main console, and you can start to prepare for transmission of your image.

Qsstv image tx loaded.png

Saving output to file

If you are interested in saving the transmission output to a file (a wav file), you can set that up in the program configuration. Click "Options" in the menu bar on the top of the window, then Configuration.

Here, you'll click the Sound tab, and under the Sound Output section, make sure you are recording the sound output to a file.

Qsstv configuration.png

Adjusting scheme

Next, you can adjust the modulation scheme to be something other than Martin 1 (which is the most common image mode) - you have a really big list to choose from. You can also pick different bandwidths, etc.

Here is an example of an image sent using the Robot 72 modulation scheme:

Contrast with the Martin 1 modulation scheme:

Begin transmission

Once you are ready to go, click the Play button to begin transmission. If you selected a sound output that would record to a file, you will be prompted for a filename here. This is the name of the wav file that qsstv will generate as it plays the sound. Once it is finished with its transmission, the file is finished and you can go share it with your friends.

Flags