-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,227 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
mediamicroservices | ||
================== | ||
================== | ||
|
||
Various media processing scripts. Use at your own risk. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
# interpret Interleaved 2/5 barcode 58 byte barcode values used by the ProBell tape management system | ||
|
||
if test $# != 1 | ||
then | ||
echo "You must supply one argument, a scanned interleaved 2/5 barcode value"; exit | ||
fi | ||
|
||
barcode="$1" | ||
|
||
translatebyte() | ||
{ | ||
val=`echo $1 | echo $(cut -c $2-$3) + 32 | bc` | ||
if [ "$val" = 131 ] ; then | ||
echo 9 | awk '{printf("%c", $0);}' | ||
else | ||
echo $val | awk '{printf("%c", $0);}' | ||
fi | ||
} | ||
addcolons() | ||
{ | ||
echo $(echo $1 | cut -c 1-2):$(echo $1 | cut -c 3-4):$(echo $1 | cut -c 5-6):$(echo $1 | cut -c 7-8) | ||
} | ||
|
||
get_ids() | ||
{ | ||
barcode=$1 | ||
c00=`translatebyte $barcode 2 3` | ||
c01=`translatebyte $barcode 4 5` | ||
c02=`translatebyte $barcode 6 7` | ||
c03=`translatebyte $barcode 8 9` | ||
c04=`translatebyte $barcode 10 11` | ||
c05=`translatebyte $barcode 12 13` | ||
c06=`translatebyte $barcode 14 15` | ||
c07=`translatebyte $barcode 16 17` | ||
c08=`translatebyte $barcode 18 19` | ||
c09=`translatebyte $barcode 20 21` | ||
c10=`translatebyte $barcode 22 23` | ||
c11=`translatebyte $barcode 24 25` | ||
c12=`translatebyte $barcode 26 27` | ||
c13=`translatebyte $barcode 28 29` | ||
c14=`translatebyte $barcode 30 31` | ||
c15=`translatebyte $barcode 32 33` | ||
c16=`translatebyte $barcode 34 35` | ||
c17=`translatebyte $barcode 36 37` | ||
c18=`translatebyte $barcode 38 39` | ||
c19=`translatebyte $barcode 40 41` | ||
echo $c00$c01$c02$c03$c04$c05$c06$c07$c08$c09$c10$c11$c12$c13$c14$c15$c16$c17$c18$c19 | ||
} | ||
|
||
ids=`get_ids $barcode` | ||
|
||
materialid=$(echo $ids | cut -d ' ' -f 2) | ||
if [[ $(echo "$materialid" | tail -c +9 | head -c 1) == "H" ]] ; then | ||
materialid="${materialid}D" | ||
fi | ||
echo deviceid,$(echo $ids | cut -d ' ' -f 1),materialid,$materialid,som,`addcolons $(echo $barcode | cut -c 42-49)`,duration,`addcolons $(echo $barcode | cut -c 50-57)` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# blackatends | ||
# Accepts one or many video files as an input and determines how many frames of black are at the beginning and at the end | ||
scriptdir=`dirname "$0"` | ||
. "$scriptdir/variables" | ||
. "$scriptdir/functions" | ||
[ ! -f "$scriptdir/variables" -o ! -f "$scriptdir/functions" ] && { echo "Missing '$scriptdir/variables' and/or '$scriptdir/functions'. Exiting." ; exit 1 ;}; | ||
|
||
[ "$#" = 0 ] && { ask_input ; once="y" ;}; | ||
|
||
while [ "$*" != "" -o "$once" = "y" ] ; do | ||
once="n" | ||
[ "$#" != 0 ] && sourcefile="$1" | ||
black_at_ends "$sourcefile" | ||
shift | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
# checksumpackage | ||
# make checksum.md5 via md5deep for package | ||
# version 1.1 adds use of dfxml | ||
version=1.1 | ||
|
||
scriptdir=`dirname "$0"` | ||
. "$scriptdir/variables" | ||
. "$scriptdir/functions" | ||
[ ! -f "$scriptdir/variables" -o ! -f "$scriptdir/functions" ] && { echo "Missing '$scriptdir/variables' and/or '$scriptdir/functions'. Exiting." ; exit 1 ;}; | ||
|
||
check_dependencies md5deep xml | ||
|
||
# local variables | ||
CHECKSUMNAME="checksum.md5" | ||
DFXMLNAME="dfxml.xml" | ||
|
||
while [ "$*" != "" ] ; do | ||
if [ -d "$1" ] ; then | ||
pwd=`pwd` | ||
"$scriptdir/removeDSStore" "$1" | ||
if [ ! -s "${1}/metadata/$CHECKSUMNAME" -o ! -s "${1}/$CHECKSUMNAME" ] ; then | ||
report "${BLUE}making Digital Forensics XML (${DFXMLNAME}) and $CHECKSUMNAME for ${1}${NC}" | ||
cd "$1" | ||
if [ -d objects ] ; then | ||
md5deep -drl objects > "metadata/$DFXMLNAME" | ||
xml sel -T -t -m "/dfxml/fileobject" -v "hashdigest" -o " " -v "ctime" -o " " -v "filename" -n "metadata/$DFXMLNAME" > "metadata/$CHECKSUMNAME" | ||
else | ||
maketemp | ||
md5deep -drl . > $TMPFILE | ||
mv $TMPFILE "$DFXMLNAME" | ||
xml sel -T -t -m "/dfxml/fileobject" -v "hashdigest" -o " " -v "ctime" -o " " -v "filename" -n "$DFXMLNAME" > "$CHECKSUMNAME" | ||
fi | ||
cd "$pwd" | ||
else | ||
report "${BLUE}${CHECKSUMNAME} already exists, skipping for ${1}${NC}" | ||
fi | ||
else | ||
report "${BLUE}ERROR: $0 requires directories as input and $1 is not a directory.${NC}" | ||
fi | ||
shift | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# left 2 stereo mix | ||
|
||
scriptdir=`dirname "$0"` | ||
. "$scriptdir/variables" | ||
. "$scriptdir/functions" | ||
|
||
suffix="_left2stereo" | ||
|
||
if test $# != 1 ; then | ||
report "${RED}You must supply one argument. Refer to a file after calling the `basename $0` script.${NC}"; exit | ||
fi | ||
|
||
while [ "$*" != "" ] ; do | ||
|
||
input_movie="$1" | ||
name=`basename "$1"` | ||
|
||
codec_tag_string=`ffprobe -show_streams -print_format compact "$input_movie" 2>/dev/null| grep codec_type=video | grep -o "codec_tag_string=[^|]*" | cut -d= -f2` | ||
|
||
[ "$codec_tag_string" = "mpeg" ] && { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mxf" ; } ; | ||
[ "$codec_tag_string" = "mpeg" ] || { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mov" ; } ; | ||
|
||
if [ -f "${input_movie%.*}${suffix}.${extension}" ] ; then | ||
report "${RED}The intended output of `basename $0` already exists. Skipping for now. Please delete \"${input_movie%.*}${suffix}.${extension}\" and rerun or figure out why you are trying to do this.${NC}" | ||
else | ||
cmd="ffmpeg -i '$input_movie' $ffmpeg_opts -filter pan=stereo:c0=c0:c1=c0 '${input_movie%.*}${suffix}.${extension}'" | ||
echo "$cmd" | ||
eval "$cmd" | ||
report "${GREEN} `basename $0` is done with ${name}.${NC}" | ||
fi | ||
shift | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# this script takes one argument which is a video file. It then rewraps it to make a new file. | ||
|
||
scriptdir=`dirname "$0"` | ||
. "$scriptdir/variables" | ||
. "$scriptdir/functions" | ||
|
||
if test $# != 1 ; then | ||
report "${RED}You must supply one argument. Refer to a file after calling the `basename $0` script.${NC}"; exit | ||
fi | ||
|
||
while [ "$*" != "" ] ; do | ||
|
||
input_movie="$1" | ||
name=`basename "$1"` | ||
|
||
codec_tag_string=`ffprobe -show_streams -print_format compact "$input_movie" 2>/dev/null| grep codec_type=video | grep -o "codec_tag_string=[^|]*" | cut -d= -f2` | ||
|
||
[ "$codec_tag_string" = "mpeg" ] && { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mxf" ; } ; | ||
[ "$codec_tag_string" = "mpeg" ] || { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mov" ; } ; | ||
|
||
if [ -f "${input_movie%.*}_voladj.${extension}" ] ; then | ||
report "${RED}The intended output of `basename $0` already exists. Skipping for now. Please delete \"${input_movie%.*}_rewrap.${extension}\" and rerun or figure out why you are trying to do this.${NC}" | ||
else | ||
report "${GREEN}Generating '${input_movie%.*}_rewrap.${extension}' ...${NC}" | ||
cmd="ffmbc -i '$input_movie' -vcodec copy -acodec copy '${input_movie%.*}_rewrap.${extension}'" | ||
eval "$cmd" | ||
report "${GREEN} `basename $0` is done with ${name}.${NC}" | ||
fi | ||
shift | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# this script takes one argument which is a video file. It evaluates the audio of the file, determines the difference needed to change the audio to -30dB as a mean_volume and then makes that adjustment to an output MXF file. The video track is simply copied. | ||
|
||
scriptdir=`dirname "$0"` | ||
. "$scriptdir/variables" | ||
. "$scriptdir/functions" | ||
|
||
if test $# != 1 ; then | ||
report "${RED}You must supply one argument. Refer to a file after calling the `basename $0` script.${NC}"; exit | ||
fi | ||
|
||
while [ "$*" != "" ] ; do | ||
|
||
input_movie="$1" | ||
name=`basename "$1"` | ||
|
||
codec_tag_string=`ffprobe -show_streams -print_format compact "$input_movie" 2>/dev/null| grep codec_type=video | grep -o "codec_tag_string=[^|]*" | cut -d= -f2` | ||
|
||
[ "$codec_tag_string" = "mpeg" ] && { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mxf" ; } ; | ||
[ "$codec_tag_string" = "mpeg" ] || { ffmpeg_opts+=" -c:v copy -c:a pcm_s24le " ; extension="mov" ; } ; | ||
|
||
if [ -f "${input_movie%.*}_voladj.${extension}" ] ; then | ||
report "${RED}The intended output of `basename $0` already exists. Skipping for now. Please delete \"${input_movie%.*}_voladj.${extension}\" and rerun or figure out why you are trying to do this.${NC}" | ||
else | ||
report "${GREEN}Getting volume data for $name ...${NC}" | ||
volume_data=`ffmpeg -i "$input_movie" -af volumedetect -f null - 2>&1 | grep volumedetect` | ||
mean_volume=`echo "$volume_data" | grep "mean_volume" | cut -d: -f2 | cut -d " " -f2 | cut -d " " -f1` | ||
max_volume=`echo "$volume_data" | grep "max_volume" | cut -d: -f2 | cut -d " " -f2 | cut -d " " -f1` | ||
adjustment=`echo -30 - "$mean_volume" | bc` | ||
report "${GREEN}MEAN volume is ${mean_volume}dB. MAX volume is ${max_volume}db. Will adjust by ${adjustment}dB.${NC}" | ||
report "${GREEN}Generating '${input_movie%.*}_voladj.${extension}' ...${NC}" | ||
cmd="ffmpeg -i '$input_movie' $ffmpeg_opts -af volume=${adjustment}dB '${input_movie%.*}_voladj.${extension}'" | ||
eval "$cmd" | ||
report "${GREEN} `basename $0` is done with ${name}.${NC}" | ||
fi | ||
shift | ||
done |
Oops, something went wrong.