Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # somagic-record -- Record video from the Somagic EasyCAP and encode to H.264 format
- # Written by Jeffry Johnston, 2012. Released to the public domain.
- # First run somagic-init, then run this script as root.
- # To end recording: killall x264 (or pkill x264).
- # TV standard: ntsc or pal
- STANDARD=ntsc
- # somagic-capture options:
- # S-VIDEO: -s
- # CVBS (sharpen): --luminance=2 --lum-aperture=3
- # Old sync: --sync=1
- SOMAGICOPTS="--sync=1 -s"
- # x264 video bitrate in kb/s (adjust for space/quality tradeoff):
- BITRATE=2000
- # x264 options (adjust for speed/quality tradeoff):
- # --preset: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
- # --threads auto: Use optimum number of threads
- X264OPTS="--preset=veryfast --threads auto"
- # mplayer options:
- # Deinterlace: -vf yadif
- MPLAYEROPTS="-vf yadif"
- # Default video and log file prefix:
- NAME="video"
- # Shouldn't need to change below
- if [ $# -eq 1 ] ; then
- NAME=$1
- elif [ $# -ne 0 ] ; then
- echo "Usage: $0 [VIDEO_PREFIX]"
- exit 1
- fi
- if [ ntsc = "$STANDARD" ] ; then
- FPS="30000/1001"
- TV="-n"
- elif [ pal = "$STANDARD" ] ; then
- FPS="25"
- TV=""
- else
- echo "Unknown TV standard: '$STANDARD', must be 'ntsc' or 'pal'."
- exit 1
- fi
- mkfifo stream.yuv >/dev/null 2>&1
- ln -s stream.yuv pipe.y4m >/dev/null 2>&1
- x264 $X264OPTS --bitrate "$BITRATE" -o "$NAME.264" pipe.y4m >"$NAME.xlog" 2>&1 &
- somagic-capture $TV $SOMAGICOPTS 2>"$NAME.slog" | mplayer -benchmark -nosound -vo yuv4mpeg $MPLAYEROPTS -demuxer rawvideo -rawvideo "$STANDARD:format=uyvy:fps=$FPS" -aspect 4:3 - >"$NAME.mlog" 2>&1 &
Advertisement
Add Comment
Please, Sign In to add comment