Initial Commit

This is the status more or less as of moving this to this machine.

I believe all these files have been modified (well maybe not all of
them, as I think a few I didn't touch because they worked as is, or I
didn't use them).
This commit is contained in:
Jigme Datse Yli-Rasku 2024-04-03 22:24:27 -07:00
parent 89da6c938c
commit fc4ba356ab
6 changed files with 199 additions and 0 deletions

3
multi-record/README.md Normal file
View File

@ -0,0 +1,3 @@
# Multi Record Tools
* multi-record.sh

3
multi-record/killffmpeg.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
killall ffmpeg

11
multi-record/multi-record.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
./record.sh -c "steinberg.json" &
./record.sh -c "webcam.json" &
./record.sh -c "capture.json" &
./video-record.sh -c "webcam-video.json" &
./video-record.sh -c "capture-video.json" &

90
multi-record/record.sh Executable file
View File

@ -0,0 +1,90 @@
#!/bin/bash
# Set the config file
recordconf="webcam.json"
#recordconf=$1
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|-\?|--help)
# show_help # Display a usage synopsis.
echo help
exit
;;
-c) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
recordconf=$2
shift
# echo recordconfig $recordconf
else
die 'ERROR: "-c" requires a non-empty option argument.'
fi
;;
--configfile) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
recordconf=$2
shift
# echo recordconfig $recordconf
else
die 'ERROR: "--inputfile" requires a non-empty option argument.'
fi
;;
-c=?*|--configfile=?*)
recordconf=${1#*=} # Delete everything up to "=" and assign the remainder.
# echo recordconfg $recordconf
;;
--configfile=) # Handle the case of an empty --file=
die 'ERROR: "--inputfile" requires a non-empty option argument.'
;;
-v|--verbose)
verbose=$((verbose + 1)) # Each -v adds 1 to verbosity.
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
# For debugging purposes
#echo $recordconf
#cat $recordconf
# This is debugging getting the values from the config
#jq '.input.video' $recordconf
#jq '.input.audio' $recordconf
#jq '.output.file' $recordconf
inputvideo=`jq '.input.video' $recordconf | tr -d \"`
inputaudio=`jq '.input.audio' $recordconf | tr -d \"`
outputdir=`date +%Y-%m-%d`/`date +%H-%M-%S`
outputfile=`jq '.output.file' $recordconf | tr -d \"`
theoutput=${outputdir}/${outputfile}
echo output $output
echo outputfile $outputfile
echo outputdir $outputdir
echo theoutput $theoutput
echo inputvideo $inputvideo
echo inputaudio $inputaudio
mkdir -p $outputdir
#echo ffmpeg -f v4l2 -framerate 24 -video_size 864x480 -c:v h264 -i ${inputvideo} -f pulse -i ${inputaudio} -c:a aac ${theoutput}
#ffmpeg -f v4l2 -framerate 24 -video_size 864x480 -i ${inputvideo} -f pulse -i ${inputaudio} -c:a aac ${theoutput}
echo ffmpeg -f pulse -i ${inputaudio} -c:a flac ${theoutput}
ffmpeg -f pulse -i ${inputaudio} -c:a flac ${theoutput} 2> /dev/null

90
multi-record/video-record.sh Executable file
View File

@ -0,0 +1,90 @@
#!/bin/bash
# Set the config file
recordconf="webcam-video.json"
#recordconf=$1
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-h|-\?|--help)
# show_help # Display a usage synopsis.
echo help
exit
;;
-c) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
recordconf=$2
shift
# echo recordconfig $recordconf
else
die 'ERROR: "-c" requires a non-empty option argument.'
fi
;;
--configfile) # Takes an option argument; ensure it has been specified.
if [ "$2" ]; then
recordconf=$2
shift
# echo recordconfig $recordconf
else
die 'ERROR: "--inputfile" requires a non-empty option argument.'
fi
;;
-c=?*|--configfile=?*)
recordconf=${1#*=} # Delete everything up to "=" and assign the remainder.
# echo recordconfg $recordconf
;;
--configfile=) # Handle the case of an empty --file=
die 'ERROR: "--inputfile" requires a non-empty option argument.'
;;
-v|--verbose)
verbose=$((verbose + 1)) # Each -v adds 1 to verbosity.
;;
--) # End of all options.
shift
break
;;
-?*)
printf 'WARN: Unknown option (ignored): %s\n' "$1" >&2
;;
*) # Default case: No more options, so break out of the loop.
break
esac
shift
done
# For debugging purposes
#echo $recordconf
#cat $recordconf
# This is debugging getting the values from the config
#jq '.input.video' $recordconf
#jq '.input.audio' $recordconf
#jq '.output.file' $recordconf
inputvideo=`jq '.input.video' $recordconf | tr -d \"`
inputaudio=`jq '.input.audio' $recordconf | tr -d \"`
outputdir=`date +%Y-%m-%d`/`date +%H-%M-%S`
outputfile=`jq '.output.file' $recordconf | tr -d \"`
theoutput=${outputdir}/${outputfile}
echo output $output
echo outputfile $outputfile
echo outputdir $outputdir
echo theoutput $theoutput
echo inputvideo $inputvideo
echo inputaudio $inputaudio
mkdir -p $outputdir
echo ffmpeg -f v4l2 -framerate 24 -video_size 864x480 -c:v h264 -i ${inputvideo} -f pulse -i ${inputaudio} -c:a aac ${theoutput}
ffmpeg -f v4l2 -framerate 24 -video_size 864x480 -fflags +genpts -use_wallclock_as_timestamps 1 -r 15 -thread_queue_size 32 -i ${inputvideo} -f pulse -thread_queue_size 32 -i ${inputaudio} -use_wallclock_as_timestamps 1 -r 15 -c:v h264 -c:a aac ${theoutput} 2> /dev/null
#echo ffmpeg -f pulse -i ${inputaudio} -c:a flac ${theoutput}
#ffmpeg -f pulse -i ${inputaudio} -c:a flac ${theoutput} 2> /dev/null

2
multi-record/videorender.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i "${1}" -c:a copy -c:v hevc_nvenc "${2}"