Monthly Archives: February 2016

In order to avoid having to run proprietary code from Google I cobbled together a script a few days ago combining youtube-dl and vlc. The result is far from perfect, but allows me to both download videos off of YouTube for safekeeping and make use of features in vlc such as fixing aspect ratios and incorrect cropping. I’m placing the following script in the public domain, in the hope that it will be useful to someone:

TITLE=$(youtube-dl -j $1 | sed -e 's/.*"fulltitle": "//;s/".*//')
echo $TITLE
cd /tmp
youtube-dl $1 -o "${TITLE}.mp4" &

# A bit of an ugly hack here, but it works
#if [ -f "${TITLE}.mp4" ]
#    # Already have the file
#    vlc "${TITLE}.mp4"
#    exit 0

# Wait for the download to start
while [ ! -f "${TITLE}.mp4.part" ]
    echo Waiting
    sleep 1

# Wait a little more so we have some data..
sleep 1
vlc "${TITLE}.mp4.part"

Some improvements could still be made. One issue is that sometimes the download finished during the final sleep, so vlc get the wrong filename. Meh!

edit: this feature is now built into both vlc and mpv, and implemented much better. Yay!

Setting up GNURadio for Raspberry Pi 2

ACTUALLY just download this Raspbian image which comes with gnuradio + hackrf + all the good stuff already (magnet link, direct link).

Another possibility is to use the regular Raspbian image and add the appropriate ppa with a prebuilt gnuradio in it. See this link for more information about that. In short:

Edit /etc/apt/sources.list and add the following line:

deb jessie main

Then update apt and install gnuradio and gnuradio-dev:

sudo apt-get update && sudo apt-get install gnuradio gnuradio-dev

Installing gqrx + osmocom + related stuff is also recommended:

sudo apt-get install gr-osmosdr libosmosdr-dev gqrx-sdr

That should get you set up for developing with gnuradio, grc and related python things :)

So far I’ve found 500 ksps is about the maximum samplerate the RPi2 can handle when running gnuradio via Python. It might be possible to go faster, since hackrf_transfer claims a transfer speed of 20 MiB/s is possible (corresponding to 10 Msps).

I’m leaving the compilation guide I already started as-is, despite not getting it to do what I wanted. Perhaps it’ll be useful to someone:

This post is an attempt at document my getting hackRF One + GNURadio running on Raspberry Pi 2.

gnuradio requires CMake>=2.8.10 for NEON support, raspbian ships with cmake 2.8.9. Grrmblr. So install that first:

git clone
cd cmake
git checkout v2.8.10
./configure && make -j3 && sudo make install

Three cores are used for make to speed things up (-j3). Four would cause X to hang. Configuring and compiling cmake will take a while, so go grab a coffee, do laundry or somesuch.

Next set up hackrf. I didn’t record this step, but if I recall correctly you need to download, compile and install gr-osmosdr. Something like this:

git clone git://
cd gr-osmosdr
mkdir build
cd build
cmake ..
make -j3
sudo make install

You can check that you got it right by running hackrf_info, then hackrf_transfer -c 127 -f 433960000 to check that the transmit functionality works (remember to attach an antenna).

Finally it is time to install gnuradio itself. A small note on boost here, since it always tends to be a problem for people stumbling upon guides like this: I’m using version 1.49. At the time of writing the latest version available via apt was 1.50. The latest official version (outside Debian) was 1.60.0.

sudo apt-get install libboost-dev libboost-filesystem-dev \
    libboost-system-dev libboost-test-dev \
    libboost-program-options-dev python-pip libcppunit-dev \
    libfftw3-dev   #TODO: gr-fft doesn't build, figure out why
sudo pip install cheetah
git clone gnuradio
git checkout 72dcbdb  #optional, master as of writing
git submodule init
git submodule update
mkdir build
cd build
cmake ..
# For some reason NEON doesn't work, so disable it by in CMakeCache.txt changing the line
# to
nano CMakeCache.txt  #do the thing
sudo make install

This will build and install.. some parts of gnuradio. Not the Python stuff though, which is what I need. Fffffff-