Skip to content

Instantly share code, notes, and snippets.

@Brick85
Created July 21, 2014 11:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Brick85/0b327ac2d3d45e23ed33 to your computer and use it in GitHub Desktop.
Save Brick85/0b327ac2d3d45e23ed33 to your computer and use it in GitHub Desktop.
somagic record and play
#!/bin/sh
PIPE=/tmp/somagic-pipe
OUTFILEDIR=~/dirs/Videos/
LOGDIR=~/.somagic-log/
NOW=`date +"%m_%d_%Y_%H_%M_%S"`
OUTFILE=${OUTFILEDIR}fpv_video_${NOW}.mp4
mkdir $LOGDIR
FFMPEG_LOG=${LOGDIR}ffmpeg.log
SOMAGIC_LOG=${LOGDIR}somagic.log
MPLAYER_LOG=${LOGDIR}mplayer.log
rm $PIPE >/dev/null 2>&1
rm $OUTFILE >/dev/null 2>&1
rm $FFMPEG_LOG
rm $SOMAGIC_LOG
rm $MPLAYER_LOG
mkfifo $PIPE >/dev/null 2>&1
ffmpeg -loglevel panic -f rawvideo -pixel_format uyvy422 -video_size 720x576 -framerate 25 -i $PIPE -vcodec libx264 -preset ultrafast $OUTFILE > $FFMPEG_LOG 2>&1 &
somagic-capture 2> $SOMAGIC_LOG | tee $PIPE | \
mplayer -nosound -vo xv -vf yadif,screenshot -demuxer rawvideo -rawvideo pal:format=uyvy:fps=25 -vf crop=720:430:0:65 -monitoraspect 16:9 -aspect 4:3 -fs - 2> $MPLAYER_LOG
rm $PIPE >/dev/null 2>&1
@robdanet
Copy link

Thanks. This is the first configuration working on my Ubuntu 14.04. I only switched from ffmpeg to avconv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment