Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- ### Phyrne's HD PVR capture script ###
- # Set an alias for the device
- HDPVR=/dev/video0
- # Set an alias for the filename
- DT=$(date +"%H %M %a %d-%b")
- # Check for the external drive
- DRV=`lsusb | grep "JMicron"`
- if [ "x${DRV}x" != "xx" ]; then
- sudo mount -t vfat /dev/sdb1 ~/Captures && echo "Capture drive mounted!"
- else
- echo "Please insert the capture drive and re-run the script" && exit
- fi
- # Load the hdpvr module if necessary
- PVR=`lsmod | grep "hdpvr"`
- if [ "x${PVR}x" != "xx" ]; then
- echo "HD PVR module is already loaded :)"
- else
- echo "Loading HD PVR module..." && sudo modprobe hdpvr && echo "Done!"
- fi
- sudo /usr/bin/v4l2-ctl --verbose -d $HDPVR -c video_bitrate_mode=0
- sudo /usr/bin/v4l2-ctl --verbose -d $HDPVR -c video_bitrate=13500000
- sudo /usr/bin/v4l2-ctl --verbose -d $HDPVR -c video_peak_bitrate=20200000
- sudo /usr/bin/v4l2-ctl --verbose -d $HDPVR --set-ctrl brightness=125 --set-ctrl contrast=60 --set-ctrl hue=15 --set-ctrl saturation=85 --set-ctrl sharpness=130
- # Capture footage to the capture drive
- # Check the HD PVR is plugged in and active
- ACT=`ls /dev/ | grep "video0"`
- if [ "x${ACT}x" != "xx" ]; then
- #sudo cat $HDPVR > ~/Captures/$DT.ts
- sudo ffmpeg -i $HDPVR -vcodec copy -acodec ac3 -ab 128k -f matroska /tmp/capture.mkv && sudo mv /tmp/capture.mkv ~/Captures/"$DT".mkv
- else
- echo "The HD PVR is not active :( Make sure you're sending a video signal to it!" && sudo umount -l ~/Captures && sudo rmmod hdpvr
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement