From charlesreid1

Line 211: Line 211:
</pre>
</pre>


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


=Flags=
=Flags=

Revision as of 19:44, 11 August 2016

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

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, but will try another sample from here: http://www.kb9ukd.com/digital/

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.

Flags