Skip to content

Instantly share code, notes, and snippets.

@stylesuxx
Last active August 29, 2015 13:57
Show Gist options
  • Save stylesuxx/9921096 to your computer and use it in GitHub Desktop.
Save stylesuxx/9921096 to your computer and use it in GitHub Desktop.
Convert the faulty avi files that the X4 quadrocopter saves on the remote
#!/bin/bash
#
# Convert the (broken) avi files saved by the hubsan x4 H107D remote.
#
# This gstreamer pipeline reindexes the avi file, crops the broken parts of the
# image to the right and left and fixes the aspect ratio. The new files are
# saved into the 'fixed' folder.
#
# <chris@1337.af>
DIR=`pwd`
FILES=`pwd`/*.AVI
mkdir -p fixed
for avi in $FILES; do
fixed=$DIR"/fixed/"`echo $avi | rev | cut -c 5- | cut -d "/" -f1 | rev`".avi"
echo -e "\nProcessing" $avi
gst-launch-1.0 filesrc location=$avi ! avidemux ! jpegdec ! \
videoscale add-borders=false sharpen=1 ! \
"video/x-raw,width=320,height=240,pixel-aspect-ratio=4/3" ! \
videocrop right=15 left=5 ! \
jpegenc ! avimux ! filesink location=$fixed | grep "Execution ended after"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment