Skip to content

Instantly share code, notes, and snippets.

@pablasso
Forked from stylesuxx/x4convert.sh
Created May 29, 2015 03:25
Show Gist options
  • Save pablasso/1fd71a60a90cf4aab136 to your computer and use it in GitHub Desktop.
Save pablasso/1fd71a60a90cf4aab136 to your computer and use it in GitHub Desktop.
#!/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=1280,height=720,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