commit e3b486f8b7bd5406b26fa8870133fe16fb373a4c Author: Logan Gartner Date: Wed Dec 22 03:29:39 2021 -0700 Initial commit diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..68a49da --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/README.md b/README.md new file mode 100644 index 0000000..04cc85f --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Camrec to AVI +Converts a .camrec file to a .avi file. +AVI sucks so I recommend converting it afterwards to something less bad. + +### Requirements +Requires `bash`, `p7zip` and `ffmpeg` + +# Usage +`camrectoavi.sh input [-o outputfile]` diff --git a/camrectoavi.sh b/camrectoavi.sh new file mode 100755 index 0000000..ca4ef05 --- /dev/null +++ b/camrectoavi.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +# Arg parser +while [ ! $# == 0 ]; do + case "$1" in + -o | --output) OUTPUT=$2;; + *) + if [[ -f $1 ]]; then + INPUT=$1 + else + echo "Invalid argument \"$1\"" + exit 1 + fi + ;; + esac + shift +done + +# If no input is specified, exit +[[ ! -f $INPUT ]] && echo "No input file specified!" && exit 1 + +# If no output is specified, plop it into the same folder as the source and rename to *.avi +[[ ! $OUTPUT ]] && OUTPUT=$(echo "$INPUT" | sed 's/\(.*\)\..*/\1/').avi + +################# + +# Make tempdir +TMPDIR="/tmp/$(echo "$INPUT" | sed 's/\(.*\)\..*/\1/')-$RANDOM" +mkdir "$TMPDIR" + +# Extract camrec file +7z e "$INPUT" -o"$TMPDIR" + +# Ready up ffmpeg jank for merging audio (I hope to god there is only one video stream) +AUDIO= +NUM=0 +for i in "$TMPDIR/*.wav"; do + AUDIO+="-i $i -map $NUM " + NUM=$(( $NUM + 1 )) # Fuck you Bash +done + +# Convert contents to AVI +ffmpeg -i "$TMPDIR/Screen_Stream.avi" $AUDIO -map $NUM -c:v copy -c:a copy $OUTPUT + +rm -r "$TMPDIR"