It's running on the RPi now

A project log for ISS HDEV image availability

The "High Definition Earth Viewing" experiment onboard the ISS runs a few cameras, but not always. Let's find out when video is available!

ChristophChristoph 09/22/2016 at 18:340 Comments

Some tweaks were necessary before this started to work:

I also tried to get rid of some error messages popping up when temporary files weren't there (yet), and this is the result:




trap "jobs -p | xargs --no-run-if-empty kill; rm -r $outfolder" EXIT

mkdir -p $outfolder

livestreamer --player "ffmpeg -i" --player-args "{filename} -vf fps=$fps $outfolder/out%04d.png" worst &

while true; do
    # find newest file and compare
    FILE=$(ls -t $outfolder/out*.png 2>/dev/null | head -n 1)
    if [ -f $FILE ]; then
        { output=$(compare -metric MSE -fuzz 20% $FILE references/novideo.png $outfolder/tmp.jpg 2>&1 1>&3-) ;} 3>&1
        value=$(echo $output | cut -d "(" -f2 | cut -d ")" -f1)
        echo $value'>'$threshold | bc -l 

    # remove old files
    (ls -t $outfolder/out*.png 2>/dev/null | head -n 2;ls $outfolder/out*.png 2>/dev/null ) | sort | uniq -u | xargs --no-run-if-empty rm

    # check if livestreamer is still running and restart if required
    # ...

    sleep 5

It's happily printing a chain of 1's and 0's, according to live video availability. Now I just need to