Advertisement
Guest User

record.sh

a guest
Sep 26th, 2023
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.02 KB | None | 0 0
  1. #!/bin/bash
  2. if [ -z "$1" ] ; then
  3.   echo "usage: ./record.sh videoname"
  4.   exit 1
  5. fi
  6.  
  7. VF=""
  8. CUR_X=$(cat /sys/bus/iio/devices/iio\:device*/in_accel_x_raw)
  9. CUR_Y=$(cat /sys/bus/iio/devices/iio\:device*/in_accel_y_raw)
  10. ABS_CUR_X=${CUR_X#-}
  11. ABS_CUR_Y=${CUR_Y#-}
  12. if [ $ABS_CUR_X -ge $ABS_CUR_Y ] ; then
  13.   if [ $CUR_X -ge 0 ] ; then
  14.     echo "portrait"
  15.     VF="-vf transpose,hflip"
  16.   else
  17.     echo "portrait inverted"
  18.     VF="-vf transpose,vflip"
  19.   fi
  20. else
  21.   if [ $CUR_Y -lt 0 ] ; then
  22.     echo "landscape clockwise"
  23.     VF=""
  24.   else
  25.     echo "landscape counterclockwise"
  26.     VF="-vf hflip,vflip"
  27.   fi
  28. fi
  29.  
  30. media-ctl -d1 -l'"gc2145 4-003c":0->1:0[0],"ov5640 4-004c":0->1:0[1]' || exit $?
  31. media-ctl -d1 -V'"ov5640 4-004c":0[fmt:UYVY8_2X8/1280x720@1/30]' || exit $?
  32. 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 $?
  33. exit 0
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement