#!/bin/sh
# /media/bill/ATA_WDC_500G/Video production/170930 DrumLibrary - kids science/video production/capture scene  - DrumLib.sh
# www.BillHowell.ca   23Sep2017 based on :  0_vidExtrn - common data, operators.ndf
# For instructions, see /media/bill/VIDEO_PRODN/video capture/0_Howell - video capture instructions.odt

# enter measure in "/media/bill/ATA_WDC_500G/Video production/170930 DrumLibrary - kids science/video production/0_video capture - dimensions.ods"
# Type Ctrl-C to termninate recording


# directory where temporary output is written
d_temp="/media/bill/ramdisk/vidTemp/"
mkdir "$d_temp"
#pname_PID_recMyDsk=""
sleep_recrdMyDskTop=4


recrd_start()
{  
echo "Type Ctrl-C to terminate recording"
recordmydesktop -x $xPosn  -y $yPosn  --width $width  --height $height  \
       --v_quality 63  --v_bitrate 2000000 --fps 18  --device pulse  --buffer-size 264620032   \
       -o "$pName"  
}  

# 21Oct2017 I can't capture the audio with recordmydesktop, so I changed from :
#      -v_quality 63  --v_bitrate 2000000 --fps 24  --buffer-size 264620032  \
# 21Oct2017 I added :  -s_quality 8   --device pulse  
# 23Oct2017 I added --channels 2, see https://wiki.archlinux.org/index.php/RecordMyDesktop
# 23Oct2017 I reverted back removing --s_quality 8  
# 24Oct2017 slow playback - since yesterday!!  can't seem to find the problem!
#		go from --fps 24 back to original --fps 24 -> resulted in bad video quality (chunky) probably due to internet
#		BUT audio is still Slow!!  - go back to --fps 18


recrd_start_nosound()
{  
echo "Type Ctrl-C to terminate recording"
recordmydesktop  --no-sound  -x $xPosn  -y $yPosn  --width $width  --height $height  \
       --v_quality 63  --v_bitrate 2000000 --fps 24  --buffer-size 264620032  \
       -o "$pName"  
}  


#        --device pulse   --freq 48000  -o "$pName" 



#****************************************************************
# To capture Scenes of the STEM presentation

# scene xPosn  		 0.2 cm 
xPosn_scene=7
# scene yPosn  		 1.2 cm
yPosn_scene=70
# scene width  		33.2 cm
width_scene=1243
# scene height 		17.8 cm
height_scene=674


scene_capture()
{
width=$width_scene
height=$height_scene
xPosn=$xPosn_scene
yPosn=$yPosn_scene
dir_video_out="/media/bill/ATA_WDC_500G/Video production/170930 DrumLibrary - kids science/video results/"
cd "$dir_video_out"
pName="$dir_video_out""$1"
recrd_start
}


#**************************
# Capture screen video

# Which scence/image?
#scene_capture  "Introduction"
#scene_capture  "Wrong_theories"
#scene_capture  "ExpandEarth_ContDrift"
#scene_capture  "ExpandEarth_Neal_Adams_vid"
#scene_capture  "ExpandEarth_experiment"
#scene_capture  "ExpandEarth_wrong"
#scene_capture  "CI_intro"
#scene_capture  "Hearing_aids"
#scene_capture  "Language_translation"
#scene_capture  "Cognition"
#scene_capture  "Conclusions"



# to run  $ bash "/media/bill/ATA_WDC_500G/Video production/170930 DrumLibrary - kids science/video production/capture scene  - DrumLib.sh"




# enddoc