Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ -z "$1" ] ; then
- echo "usage: ./record.sh videoname"
- exit 1
- fi
- VF=""
- CUR_X=$(cat /sys/bus/iio/devices/iio\:device*/in_accel_x_raw)
- CUR_Y=$(cat /sys/bus/iio/devices/iio\:device*/in_accel_y_raw)
- ABS_CUR_X=${CUR_X#-}
- ABS_CUR_Y=${CUR_Y#-}
- if [ $ABS_CUR_X -ge $ABS_CUR_Y ] ; then
- if [ $CUR_X -ge 0 ] ; then
- echo "portrait"
- VF="-vf transpose,hflip"
- else
- echo "portrait inverted"
- VF="-vf transpose,vflip"
- fi
- else
- if [ $CUR_Y -lt 0 ] ; then
- echo "landscape clockwise"
- VF=""
- else
- echo "landscape counterclockwise"
- VF="-vf hflip,vflip"
- fi
- fi
- media-ctl -d1 -l'"gc2145 4-003c":0->1:0[0],"ov5640 4-004c":0->1:0[1]' || exit $?
- media-ctl -d1 -V'"ov5640 4-004c":0[fmt:UYVY8_2X8/1280x720@1/30]' || exit $?
- ffmpeg -input_format yuv420p -s 1280x720 -f video4linux2 -thread_queue_size 4096 -i /dev/video3 -f pulse -thread_queue_size 256 -i alsa_input.platform-sound.HiFi__hw_PinePhone_0__source -c:a aac -c:v libx264 -preset ultrafast -qp 23 "$1.mp4" || exit $?
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement