OK that's a start at least

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/20/2016 at 20:110 Comments

So I managed to write a bash script that

Here it is:



trap 'jobs -p | xargs --no-run-if-empty kill' EXIT

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

while true; do
    # find newest file and compare
    FILE=$(ls -t out*.png | head -n 1)
    { output=$(compare -metric MSE -fuzz 20% $FILE references/novideo.png tmp.jpg 2>&1 1>&3-) ;} 3>&1
    # extract and compare, output binary value indicating if HDEV stream is available or not
    value=$(echo $output | cut -d "(" -f2 | cut -d ")" -f1)
    echo $value'>'$threshold | bc -l 

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

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

    sleep 5

Some things are still missing: