[[gstreamer_video_compression]]

# Idea

To be able to efficiently send the image data over a wireless datalink, one option is to compress the video data using h264/h265 encoders. Those two are often implemented in a hardware-accelerated way on the onboard computers like RPI and Jetson Nano. We can use these encoders to compress the video data to about 1000kBit/s and keep some kind of acceptable quality in the images to be processed by the image analysis algorithms ( to be tested! ) on a basestation computer. These kind of compression is also used in existing solutions mentioned in https://www.hs-augsburg.de/homes/beckmanf/dokuwiki/doku.php?id=searchwing-wifibroadcast.

# Tests

I conducted a first test using real images from a flight to check how well data could be compressed. I used gstreamer to compress a series of images to a videofile. Following settings choosen:

• Imagesize 8MP - 3280×2464
• Framerate 1Hz
• Interframerate 1Hz / Didnt work with H265 so i choose 0.5Hz

H264

 gst-launch-1.0 -e multifilesrc location=“%04d.jpg” caps=“image/jpeg,framerate=1/1” ! jpegdec ! x264enc bitrate=1000 speed-preset=2 key-int-max=2 ! avimux ! filesink location=“out264.avi” 

H265

 gst-launch-1.0 -e multifilesrc location=“%04d.jpg” caps=“image/jpeg,framerate=1/1” ! jpegdec ! x265enc bitrate=1000 speed-preset=2 key-int-max=2 ! h265parse ! filesink location=out265.h265 

# Results

Images are still looking okay for a human beeing. If the algorithms are also okay with that reduced quality need to be tested.

H264s filesize is in line with to the specified bitrate. H265 somehow is ~4x bigger that the specified bitrate and also the quality is not really better than H264, so there are still some errors to find.

Testimages and results can be found here: https://cloud.hs-augsburg.de/s/sm6taLQCAyWMY6F

# Image compression in general

• gstreamer_video_compression.txt