diff --git a/README.md b/README.md index a151a882..c99c3db3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ mediamicroservices -================== \ No newline at end of file +================== + +Various media processing scripts. Use at your own risk. \ No newline at end of file diff --git a/barcodeinterpret b/barcodeinterpret new file mode 100755 index 00000000..7063e9f2 --- /dev/null +++ b/barcodeinterpret @@ -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)` diff --git a/blackatends b/blackatends new file mode 100755 index 00000000..cb687cd5 --- /dev/null +++ b/blackatends @@ -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 \ No newline at end of file diff --git a/checksumpackage b/checksumpackage new file mode 100755 index 00000000..fa4c3ddb --- /dev/null +++ b/checksumpackage @@ -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 \ No newline at end of file diff --git a/fix_left2stereo b/fix_left2stereo new file mode 100755 index 00000000..2cd70d65 --- /dev/null +++ b/fix_left2stereo @@ -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 diff --git a/fix_rewrap b/fix_rewrap new file mode 100755 index 00000000..adde6acf --- /dev/null +++ b/fix_rewrap @@ -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 diff --git a/fix_volume b/fix_volume new file mode 100755 index 00000000..070025e3 --- /dev/null +++ b/fix_volume @@ -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 diff --git a/functions b/functions new file mode 100755 index 00000000..5c3bf4e5 --- /dev/null +++ b/functions @@ -0,0 +1,187 @@ +get_iso8601(){ + date +%FT%T +} + +get_iso8601_c(){ + date +%Y%m%d-%I%M%S +} + +report(){ + echo `get_iso8601` - "${1}" +} + +black_at_ends(){ + input_movie="$1" + name=`basename "$input_movie"` + analysis_head_seconds=10 + analysis_tail_seconds=10 + report "${GREEN}Analyzing $name for excessive black at head or tail.${NC}" + duration=`ffprobe "$1" -show_format 2> /dev/null | grep duration | cut -d= -f2 | cut -d. -f1` + tail_start=`echo "$duration - $analysis_tail_seconds" | bc` + head_black=`ffmpeg -t "$analysis_head_seconds" -i "$1" -an -vf blackdetect=pix_th=0.05 -loglevel debug -f null - 2>&1 | grep -c -o picture_black_ratio:1` + report "${GREEN}Black frames in first $analysis_head_seconds seconds: $head_black.${NC}" + tail_black=`ffmpeg -ss "$tail_start" -i "$1" -an -vf blackdetect=pix_th=0.05 -loglevel debug -f null - 2>&1 | grep -c -o picture_black_ratio:1` + report "${GREEN}Black frames in last $analysis_head_seconds seconds: $tail_black.${NC}" +} + +maketemp(){ + tempfoo=`basename $0` + TMPFILE=`mktemp -q /tmp/${tempfoo}.XXXXXX` + if [ $? -ne 0 ]; then + echo "$0: Can't create temp file, exiting..." + exit 1 + fi +} + +ask_operator(){ + if [ -z "$op" ] ; then + printf "${BLUE}Enter the name of the operator or 'q' to quit: ${NC}" + read op + [ -z "$op" ] && ask_operator || log+="operator: ${op}\n" + [ "$op" == "q" ] && exit 0 + fi +} + +ask_mediaid(){ + if [ -z "$mediaid" ] ; then + printf "${BLUE}Enter a unique MEDIA ID: ${NC}" + read mediaid + [ -z "$mediaid" ] && ask_mediaid + # option to quit + [ "$mediaid" == "q" ] && exit 0 + # validate id and perhaps fail with exit + [ -z "$mediaid" ] && report "${RED}ERROR You must enter a valid MEDIA ID${NC}" && exit + [ ! -z `echo "$mediaid" | grep -v "^[A-Z0-9_-]*$"` ] && report "${RED}ERROR The MEDIA ID must only contain capital letters, letters, hyphen and underscore${NC}" && exit 1 + fi + [ ! -z "$mediaid" ] && log+="mediaid: ${mediaid}\n" +} + +ask_input(){ + if [ -z "$input" ] ; then + printf "${BLUE}Drag in the file: ${NC}" + read input + [ -z "$input" ] && ask_input + [ "$input" == "q" ] && exit 0 + basename=`basename "$input"` + [ ! -z "$input log" ] && log+="input: ${input}\n" + fi +} + +check_dependencies(){ + deps_ok=YES + while [ "$*" != "" ] ; do + dependency="$1" + if [ ! $(which $dependency) ] ; then + report "${RED}This script requires $dependency to run but it is not installed${NC}" + report "${RED}If you are running ubuntu or debian you might be able to install $dependency with the following command${NC}" + report "${RED}sudo apt-get install ${dependency}${NC}" + report "${RED}If you are running mac you might be able to install $dependency with the following command${NC}" + report "${RED}brew install ${dependency}${NC}" + deps_ok=NO + fi + shift + done + if [[ "$deps_ok" == "NO" ]]; then + report "${RED}Unmet dependencies${NC}" + report "${RED}Aborting!${NC}" + exit 1 + else + return 0 + fi +} + +ask(){ + # This function requires 3 arguments + # 1) A prompt + # 2) The label for the metadata value + read -p "${1}" response + if [ -z "$response" ] ; then + ask "$1" "$2" + else + log+="${2}: ${response}\n" + fi + echo +} +offerChoice(){ + # This function requires 3 arguments + # 1) A prompt + # 2) The label for the metadata value + # 3) A vocabulary list + PS3="${1}" + label="${2}" + eval set "$3" + select option in "$@" + do + break + done + log+="${label}: ${option}\n" + echo +} + +make_mezz_for_xdcam(){ + som="$1" + dur="$2" + + tmc_ms=`mediainfo --inform="Video;%Delay%" "$3"` + tmc_smp=`mediainfo --inform="Video;%Delay/String3%" "$3"` + tmc_sec=`echo "$tmc_ms * 0.001" | bc` + + som_h=`echo "$som" | cut -c 1-2` + som_m=`echo "$som" | cut -c 4-5` + som_s=`echo "$som" | cut -c 7-8` + som_f=`echo "$som" | cut -c 10-11` + som_fc=`echo "scale=3; (((((3600 * $som_h)+(60 * $som_m)+ $som_s ) * 30)+ $som_f ) - ( 2 * (((60 * $som_h)+ $som_m ) - (((60 * $som_h)+ $som_m ) / 10 )))) / 29.97" | bc` + + dur_h=`echo "$dur" | cut -c 1-2` + dur_m=`echo "$dur" | cut -c 4-5` + dur_s=`echo "$dur" | cut -c 7-8` + dur_f=`echo "$dur" | cut -c 10-11` + dur_fc=`echo "scale=3; (((((3600 * $dur_h)+(60 * $dur_m)+ $dur_s ) * 30)+ $dur_f ) - ( 2 * (((60 * $dur_h)+ $dur_m ) - (((60 * $dur_h)+ $dur_m ) / 10 )))) / 29.97" | bc` + + rel_start=`echo "scale=3; $som_fc - $tmc_sec" | bc` + pushd `dirname "$4"` + report "${GREEN}Starting ffmpeg to trim mxf file at `date`. This will take a few minutes...${NC}" + ffmpeg 2 /dev/null | grep width= | cut -d = -f 2` +} + +get_height(){ + height=`ffprobe "$1" -show_streams -select_streams 0:v 2> /dev/null | grep height= | cut -d = -f 2` +} + +get_dar(){ + dar=`ffprobe "$1" -show_streams -select_streams 0:v 2> /dev/null | grep display_aspect_ratio= | cut -d = -f 2 | sed 's|:|/|g'` +} + +get_codectagstring(){ + codec_tag_string=`ffprobe "$1" -show_streams -select_streams 0:v 2> /dev/null | grep codec_tag_string= | cut -d = -f 2` +} + +get_duration(){ + DURATION=`ffprobe "$1" -show_format 2> /dev/null | grep duration= | cut -d = -f 2` +} + +get_maxdvdbitrate(){ + get_duration "$1" + local DVDCAPACITY=37000000000 # in bits + local CAPDVDBITRATE=6000000 # in bits/second + MAXDVDBITRATE=`echo "(37000000000 - ( $DURATION * 224000 )) / $DURATION" | bc` + if ! [[ "$MAXDVDBITRATE" =~ ^[0-9]+$ ]] ; then + report "${RED}Calculation of dvd bitrate failed. Evaluated to ${MAXDVDBITRATE}. Using 4000000 as bitrate instead.${NC}" + MAXDVDBITRATE=4000000 + elif [ "$MAXDVDBITRATE" -gt "$CAPDVDBITRATE" ] ; then + MAXDVDBITRATE="$CAPDVDBITRATE" + fi +} \ No newline at end of file diff --git a/help b/help new file mode 100755 index 00000000..5fe415d1 --- /dev/null +++ b/help @@ -0,0 +1,32 @@ +#!/bin/sh +# help documentation +# This script presents an index of microservices along with their options and definitions. + +echo " + +blackatend + + Arguments: one or many video files. + Example: blackatend /path/to/file1.mov /path/to/file2.mov + Description: The script will decode the first and last few seconds of the file + and report on the number of black frames at each end. + Used by: This script is mostly used by other scripts such as ingestfile. + +checksumpackage + + Arguments: one or many Archive Information Packages (AIP) + Example: blackatend /path/to/package1 /path/to/package2 + Description: The script will use md5deep to produce a checksum.md5 file for + AIPs to help facilitate file integrity checks during long + term digital storage. + Used by: This script is mainly used by other processes and preservation staff. + +removeDSStore + + Arguments: one or many Archive Information Packages (AIP) + Example: removeDSStore /path/to/package1 /path/to/package2 + Description: The script will remove .DS_Store files from + AIPs because they are annoying. + Used by: This script is mainly used by other processes and preservation staff. + + " \ No newline at end of file diff --git a/ingestfile b/ingestfile new file mode 100755 index 00000000..06d6eb93 --- /dev/null +++ b/ingestfile @@ -0,0 +1,175 @@ +#!/bin/bash +# ingestfile +# select an audiovisual file, package it, and transcode it +version="1.0" + +makeaccesscopies="Y" # use 'Y' for yes or any other character for no +blackframetest="Y" # use 'Y' for yes or any other character for no +deliverytoomneon="N" # use 'Y' for yes or any other character for no +deliveraccesscopies="Y" # use 'Y' for yes or any other character for no +deliverytoaipstorage="Y" # use 'Y' for yes or any other character for no + +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 ;}; + +# command-line options to set mediaid and original variables +while getopts ":m:f:" opt; do + case "$opt" in + m) mediaid="$OPTARG";; + f) sourcefile="$OPTARG";; + \?) echo "Invalid option: -$OPTARG" ; exit 1 ;; + :) echo "Option -$OPTARG requires an argument" ; exit 1 ;; + esac +done +[ -n "$mediaid" ] && op="batch process" + +report "starting $SCRIPTNAME" + +ask_operator +ask_mediaid +ask_input + +echo "${BLUE}Select an audio strategy? ${NC}" +PS3="${BLUE}Selection? ${NC}" +select audiodecision in "Default audio mapping [first audio track used for stereo output]" "Only use left of the first audio track [for 21st Century]" +do + break +done + + + +echo "${BLUE}Select an cleanup strategy? ${NC}" +PS3="${BLUE}Selection? ${NC}" +select cleanupdecision in "Leave source file where it is." "Remove source file after successful ingest" +do + break +done + +if [ "$cleanupdecision" = "Remove source file after successful ingest" ] ; then + cleanup="Y" +fi + +PS3="${BLUE}What do you want to do? ${NC}" +select priority in "put in queue" "start now" +do + break +done + +# blackframe analysis +if [ "$blackframetest" = "Y" ] ; then + black_at_ends "$input" + if [ "$head_black" -gt "30" ] ; then + report "${RED}WARNING - There are at least $head_black frames of black at the beginning of ${input}${NC}" + printf "Enter q to quit, any other key to continue: " + read a1 + [ "$a1" == "q" ] && exit 0 + fi + if [ "$tail_black" -gt "30" ] ; then + report "${RED}WARNING - There are at least $tail_black frames of black at the end of ${input}${NC}" + printf "Enter q to quit, any other key to continue: " + read a2 + [ "$a2" == "q" ] && exit 0 + fi +fi + +objectsdir="$OUTDIR_INGESTFILE/$mediaid/objects" + +# check for existing output +[ -d "$OUTDIR_INGESTFILE/$mediaid" ] && report "${RED}It looks like $mediaid was already ingested. If you want to overwrite the existing one please delete $OUTDIR_INGESTFILE/$mediaid first and then try again.${NC}" && exit 1 +[ -d "$AIP_STORAGE/$mediaid" ] && report "${RED}It looks like $mediaid was already ingested. If you want to overwrite the existing one please delete $AIP_STORAGE/$mediaid first and then try again.${NC}" && exit 1 + +# queue handling +if [ "$priority" = "put in queue" ] ; then + echo "$mediaid" >> /tmp/queue.txt + next=$(head -n 1 /tmp/queue.txt) + while [ "$mediaid" != "$next" ] ; do + newnext=$(head -n 1 /tmp/queue.txt) + echo -n "This process is waiting behind these identifiers: " + cat /tmp/queue.txt | tr '\n' ' ' + echo + while [ "$next" = "$newnext" ] ; do + sleep 10 + newnext=$(head -n 1 /tmp/queue.txt) + done + next="$newnext" + done +fi + +mkdir -p "$objectsdir" +logdir="$OUTDIR_INGESTFILE/$mediaid/metadata/submissionDocumentation/logs" +mkdir -p "$logdir" +submissiondocdir="$OUTDIR_INGESTFILE/$mediaid/metadata/submissionDocumentation" +mkdir -p "$submissiondocdir" + +start=`get_iso8601` + +# rsync +report "${GREEN}STATUS Copying the original file to library storage at $objectsdir.${NC}" +rsync -av --progress --log-file="$logdir/rsync_$(get_iso8601_c)_$(basename $0)_${version}.txt" "$input" "$objectsdir/" + +rsync_err="$?" +[ "$rsync_err" -gt "0" ] && report "${RED}rsync failed with error ${rsync_err}${NC}" && exit 1 + +# transcode +if [ "$audiodecision" == "Only use left of the first audio track [for 21st Century]" ] ; then + echo hey hey + "$scriptdir/makebroadcast" -l "$OUTDIR_INGESTFILE/$mediaid" +else + "$scriptdir/makebroadcast" "$OUTDIR_INGESTFILE/$mediaid" +fi + +# upload to omneon +if [ "$deliverytoomneon" == "Y" ] ; then + report "${GREEN}STATUS Uploading $servicefile to the OMNEON.${NC}" + "$scriptdir/uploadomneon" "$objectsdir/service/${mediaid%.*}.mov" +fi + +# access copies +if [ "$makeaccesscopies" == "Y" ] ; then + report "${GREEN}STATUS Making access copies.${NC}" + "$scriptdir/makedvd" "$OUTDIR_INGESTFILE/$mediaid" + "$scriptdir/makeyoutube" "$OUTDIR_INGESTFILE/$mediaid" + if [ "$deliveraccesscopies" = "Y" ] ; then + cp -av "$OUTDIR_INGESTFILE/$mediaid/objects/access/youtube_up/" "$PODCASTDELIVER/" + fi + if [ `echo "$mediaid" | grep "$REGEX4PODCAST"` ] ; then + report "${GREEN}${media} qualifies for podcast creation.${NC}" + sh "$scriptdir/makepodcast" "$OUTDIR_INGESTFILE/$mediaid" + if [ "$deliveraccesscopies" == "Y" ] ; then + cp -av "$OUTDIR_INGESTFILE/$mediaid/objects/access/podcast/" "$YOUTUBEDELIVER/" + fi + else + report "${BLUE}${media} does NOT qualify for podcast creation, skipping.${NC}" + fi +fi +end=`get_iso8601` + +# start reporting to operator log +echo -e "$log" >> "$logdir/capture.log" +echo "datetime_start: ${start}" >> "$logdir/capture.log" +echo "datetime_end: ${end}" >> "$logdir/capture.log" + +# move and cleanup +if [ "$deliverytoaipstorage" == "Y" ] ; then + rsync -av --progress --remove-source-files "$OUTDIR_INGESTFILE/$mediaid" "$AIP_STORAGE/" + [ `du -s "$OUTDIR_INGESTFILE/$mediaid" | awk '{print $1}'` = "0" ] && rm -r "$OUTDIR_INGESTFILE/$mediaid" + report "${GREEN}STATUS Done. Final package has been delivered to $AIP_STORAGE/${mediaid}${NC}" +fi + +if [ "$cleanup" == "Y" ] ; then + if [ "$rsync_err" -gt "0" ] ; then + report "${RED}Cancelling requested deletion of source file, not looking safe.${NC}" + else + report "${GREEN}Removing the source file from ${input} as requested.${NC}" + rm "$input" + fi +fi + +# clean up queue +if [ "$priority" == "put in queue" ] ; then + tail -n +2 /tmp/queue.txt > /tmp/queue2.txt + rm /tmp/queue.txt + mv /tmp/queue2.txt /tmp/queue.txt +fi \ No newline at end of file diff --git a/install b/install new file mode 100755 index 00000000..7583a0d3 --- /dev/null +++ b/install @@ -0,0 +1,18 @@ +#!/usr/bin/ruby + +if !File.exist?("/usr/local") + puts "Please enter your password to allow the installer to make changes." + system "sudo mkdir /usr/local" + command = "sudo cp " +elsif !File.writable_real?("/usr/local") + puts "Please enter your password to allow the installer to make changes." + command = "sudo cp " +else + command = "cp " +end + +pwd = File.expand_path File.join(__FILE__, "..") + +%w[makebroadcast makeyoutube].each do |file| + system command+'"'+pwd+'/'+file+'"'+" /usr/local/bin" +end \ No newline at end of file diff --git a/makebroadcast b/makebroadcast new file mode 100755 index 00000000..43adccfd --- /dev/null +++ b/makebroadcast @@ -0,0 +1,60 @@ +#!/bin/bash +# makebroadcast +# make broadcast version + + +# command-line options to set mediaid and original variables +while getopts l opt ; do + case $opt in + l) + audioleft="Y" + shift ;; + esac +done + +version="1.0" + +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 ;}; + + +[ "$audioleft" == "Y" ] && audiomapping=" -map_audio_channel 0:1:0:0:1:0 -map_audio_channel 0:1:0:0:1:1 " + +[ "$#" = 0 ] && { ask_input ; once="y" ;}; + +while [ "$*" != "" -o "$once" = "y" ] ; do + once="n" + [ "$#" != 0 ] && input="$1" + [ -d "$input" ] && { outputdir="$input/objects/service" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + [ -f "$input" ] && { outputdir=`dirname "$input"`"/service" && logdir="`dirname "$input"`/access/logs" ;}; + [ ! "$outputdir" ] && { outputdir="$input/objects/service" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + find_input "$input" + + filename=`basename "$sourcefile"` + mediaid=`basename "$input" | cut -d. -f1` + + servicefile="$outputdir/${mediaid%.*}.mov" + [ -s "$servicefile" ] && { report "${RED}WARNING $servicefile already exists, skipping transcode${NC}" && exit;}; + + report "${GREEN}STATUS Transcoding for Omneon compliance.${NC}" + ffmbc_opts=" -r ntsc " + ffmbc_opts+=" $audiomapping -ac 2 " + + get_codectagstring "$sourcefile" + get_width "$sourcefile" + [[ "$width" -gt 720 ]] && { target="xdcamhd422" && ffmbc_opts+=" -tff -s 1920x1080 -vtag xd5b ";}; + [[ "$width" -gt 720 ]] || target="imx50" + + [ "$codec_tag_string" = "xd5b" -o "$codec_tag_string" = "mx3n" -o "$codec_tag_string" = "mx5n" ] && ffmbc_opts+=" -vcodec copy -target $target " + [ "$codec_tag_string" = "xd5b" -o "$codec_tag_string" = "mx3n" -o "$codec_tag_string" = "mx5n" ] || ffmbc_opts+=" -target $target " + + mkdir -p "$outputdir" + ffmbc_command="ffmbc -y -threads 8 -i '$sourcefile' $ffmbc_opts '$servicefile'" + report "${GREEN}Running: $ffmbc_command" + eval "$ffmbc_command" + ffmbc_err="$?" + [ "$ffmbc_err" -gt "0" ] && { report "${RED}ffmbc failed with error ${ffmbc_err}${NC}" && exit 1;}; + shift +done \ No newline at end of file diff --git a/makedvd b/makedvd new file mode 100755 index 00000000..2464a79d --- /dev/null +++ b/makedvd @@ -0,0 +1,83 @@ +#!/bin/bash +# makedvd +# make dvd +version="1.0" + +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 ffmpeg dvdauthor mkisofs + +[ "$#" = 0 ] && { ask_input ; once="y" ;}; + +while [ "$*" != "" -o "$once" = "y" ] ; do + once="n" + + [ "$#" != 0 ] && input="$1" + [ -d "$input" ] && { outputdir="$input/objects/access/dvd" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + [ -f "$input" ] && { outputdir=`dirname "$input"`"/access/dvd" && logdir="`dirname "$input"`/access/logs" ;}; + [ ! "$outputdir" ] && { outputdir="$input/objects/access/dvd" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + find_input "$input" + + filename=`basename "$sourcefile"` + mediaid=`basename "$input" | cut -d. -f1` + + isooutput="$outputdir/${mediaid%.*}.iso" + [ -s "$isooutput" ] && { report "${RED}WARNING $isooutput already exists, skipping transcode${NC}" ; exit 1 ;}; + mkdir -p "$outputdir" + get_height "$sourcefile" + get_width "$sourcefile" + get_dar "$sourcefile" + + darratio=`echo "scale=3 ; $dar" | bc` + [ `echo "scale=5 ; $darratio > 1.5" | bc -l` = 1 ] && aspect="16/9" || aspect="4/3" + + get_maxdvdbitrate "$sourcefile" + middleoptions="-r:v ntsc -c:v mpeg2video -c:a ac3 -f dvd -s 720x480 -pix_fmt yuv420p -g 18 -b:v $MAXDVDBITRATE -maxrate 9000k -minrate 0 -bufsize 1835008 -packetsize 2048 -muxrate 10080000 -b:a 448000 -ar 48000 " + if [ "$height" -eq "486" -a "$width" -eq "720" ] ; then + middleoptions+=" -vf \"crop=720:480:0:4,setdar=${aspect}\" " + elif [ "$height" -eq "480" -a "$width" -eq "720" ] ; then + middleoptions+=" -vf \"setdar=${aspect}\" " + elif [ "$height" -eq "512" -a "$width" -eq "720" ] ; then + middleoptions+=" -vf \"crop=720:480:0:32,setdar=${aspect}\" " + else + middleoptions+=" -vf \"scale=720:480:interl=1,setdar=${aspect}\"" + fi + inputoptions+=" -y" + if [ "$logdir" != "" ] ; then + mkdir -p "$logdir" + export FFREPORT="file=${logdir}/%p_%t_$(basename $0)_${version}.txt" + inputoptions+=" -report" + fi + report "${GREEN}Transcoding to DVD compliant mpeg2.${NC}" + dvdffmpegcommand="ffmpeg $inputoptions -i \"$sourcefile\" $middleoptions \"$outputdir/${mediaid%.*}.mpeg\"" + report "${GREEN}Running: $dvdffmpegcommand" + eval "$dvdffmpegcommand" + export VIDEO_FORMAT=NTSC + # chapters every 5 minutes, dvdauthor will ignore chapter markers greater than duration + report "${GREEN}Making DVD VIDEO_TS folder.${NC}" + dvdauthor --title -v ntsc -a ac3+en -c 0,5:00,10:00,15:00,20:00,25:00,30:00,35:00,40:00,45:00,50:00,55:00,1:00:00,1:05:00,1:10:00,1:15:00,1:20:00,1:25:00,1:30:00,1:35:00,1:40:00,1:45:00,1:50:00,1:55:00,2:00:00,2:05:00,2:10:00,2:15:00,2:20:00,2:25:00,2:30:00,2:35:00,2:40:00,2:45:00,2:50:00,2:55:00,3:00:00,3:05:00,3:10:00,3:15:00,3:20:00,3:25:00,3:30:00,3:35:00,3:40:00,3:45:00,3:50:00,3:55:00 -f "$outputdir/${mediaid%.*}.mpeg" -o "$outputdir/${mediaid%.*}/" 2> "${logdir}/dvdauthor_$(get_iso8601_c)_$(basename $0)_${version}.txt" + dvdauthor_err="$?" + if [ "$dvdauthor_err" -gt "0" ] ; then + report "${RED}ERROR dvdauthor reported error code $dvdauthor_err. Please review $outputdir/${mediaid%.*}/${NC}" + exit "$dvdauthor_err" + else + rm "$outputdir/${mediaid%.*}.mpeg" + fi + dvdauthor -T -o "$outputdir/${mediaid%.*}/" + volname=`echo "${DVDLABELPREFIX}${mediaid}"` + report "${GREEN}Making DVD image file.${NC}" + mkisofs -f -dvd-video -udf -V "${volname:0:32}" -v -v -o "$outputdir/${mediaid%.*}.iso" "$outputdir/${mediaid%.*}" 2> "${logdir}/mkisofs_$(get_iso8601_c)_$(basename $0)_${version}.txt" + mkisofs_err="$?" + if [ "$mkisofs_err" -gt "0" ] ; then + report "${RED}ERROR mkisofs reported error code $mkisofs_err. Please review $outputdir/${mediaid%.*}.iso.${NC}" + exit "$mkisofs_err" + else + rm -r "$outputdir/${mediaid%.*}/" + fi + report "${GREEN}STATUS ${mediaid%.*}.iso is generated.${NC}" + + shift +done \ No newline at end of file diff --git a/makemetadata b/makemetadata new file mode 100755 index 00000000..5954ae18 --- /dev/null +++ b/makemetadata @@ -0,0 +1,60 @@ +#!/bin/bash +# make dvd + +scriptdir=`dirname "$0"` +. "$scriptdir/variables" +. "$scriptdir/functions" + +counter=0 +while [ "$*" != "" ] ; do + uuid=`uuidgen` + + cd "$1" + objects_file=`find "./objects" -maxdepth 1 -mindepth 1 -type f -name "*.mov" ! -name ".*"` + service_file=`find "./objects/service" -maxdepth 1 -mindepth 1 -type f -name "*.mov" ! -name ".*"` + mkdir -p "/tmp/$uuid" + + outputdir="./metadata/submissionDocumentation/fileMeta" + mkdir -p "$outputdir" + + objectbasename=`basename "$objects_file"` + servicebasename=`basename "$service_file"` + mediaid=`basename "$1" | cut -d. -f1` + + find "./objects/access" -type d -mindepth 1 -maxdepth 1 > "/tmp/$uuid/access.txt" + while read access ; do + accessname=`basename "$access"` + find "$access" -type f ! -name ".*" > "/tmp/$uuid/access_${accessname}.txt" + while read access_file ; do + mkdir -p "$outputdir/access/$accessname" + accessbasename=`basename "$access_file"` + ffprobe 2>/dev/null "$access_file" -show_format -show_streams -show_data -show_error -show_versions -noprivate -of xml="q=1:x=1" > "$outputdir/access/$accessname/${accessbasename%.*}_ffprobe.xml" + ffprobe 2>/dev/null "$access_file" -show_format -show_streams -show_data -show_error -show_versions -of json > "$outputdir/access/$accessname/${accessbasename%.*}_ffprobe.json" + mediainfo --language=raw -f --output=XML "$access_file" > "$outputdir/access/$accessname/${accessbasename%.*}_mediainfo.xml" + done < "/tmp/$uuid/access_${accessname}.txt" + done < "/tmp/$uuid/access.txt" + + outputdir="./metadata/submissionDocumentation/fileMeta" + mkdir -p "$outputdir" + + objectbasename=`basename "$objects_file"` + servicebasename=`basename "$service_file"` + mediaid=`basename "$1" | cut -d. -f1` + + # transcode + report "${GREEN}STATUS Making metadata reports.${NC}" + + #only works with one file in objects , to do + mkdir -p "$outputdir/objects" + ffprobe 2>/dev/null "$objects_file" -show_format -show_streams -show_data -show_error -show_versions -noprivate -of xml="q=1:x=1" > "$outputdir/objects/${objectbasename%.*}_ffprobe.xml" + ffprobe 2>/dev/null "$objects_file" -show_format -show_streams -show_data -show_error -show_versions -of json > "$outputdir/objects/${objectbasename%.*}_ffprobe.json" + mediainfo --language=raw -f --output=XML "$objects_file" > "$outputdir/objects/${objectbasename%.*}_mediainfo.xml" + + mkdir -p "$outputdir/service" + ffprobe 2>/dev/null "$service_file" -show_format -show_streams -show_data -show_error -show_versions -noprivate -of xml="q=1:x=1" > "$outputdir/service/${servicebasename%.*}_ffprobe.xml" + ffprobe 2>/dev/null "$service_file" -show_format -show_streams -show_data -show_error -show_versions -of json > "$outputdir/service/${servicebasename%.*}_ffprobe.json" + mediainfo --language=raw -f --output=XML "$service_file" > "$outputdir/service/${servicebasename%.*}_mediainfo.xml" + rm -r -f "/tmp/$uuid" + shift + counter=`expr "$counter" + 1` +done \ No newline at end of file diff --git a/makepodcast b/makepodcast new file mode 100755 index 00000000..d47b6d47 --- /dev/null +++ b/makepodcast @@ -0,0 +1,37 @@ +#!/bin/bash +# makepodcast +# makes a file appropriate for podcasting +version="1.0" + +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 ] && input="$1" + [ -d "$input" ] && { outputdir="$input/objects/access/podcast" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + [ -f "$input" ] && { outputdir=`dirname "$input"`"/access/podcast" && logdir="`dirname "$input"`/access/logs" ;}; + [ ! "$outputdir" ] && { outputdir="$input/objects/access/podcast" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + find_input "$input" + + filename=`basename "$sourcefile"` + mediaid=`basename "$input" | cut -d. -f1` + + podcastoutput="$outputdir/${mediaid%.*}_podcast.mov" + [ -s "$podcastoutput" ] && { report "${RED}WARNING $podcastoutput already exists, skipping transcode${NC}" ; exit 1 ;}; + mkdir -p "$outputdir" + middleoptions="-movflags faststart -pix_fmt yuv420p -c:v libx264 -b:v 1500k -maxrate:v 3000k -minrate:v 375k -bufsize:v 6000k -vf 'yadif,scale=640:trunc(ow/dar/2)*2:interl=1' -c:a libfaac -b:a 96k " + if [ "$logdir" != "" ] ; then + mkdir -p "$logdir" + export FFREPORT="file=${logdir}/%p_%t_$(basename $0)_${version}.txt" + inputoptions+=" -report" + fi + makepodcastcommand="ffmpeg $inputoptions -i \"$sourcefile\" $middleoptions \"$podcastoutput\"" + report "${GREEN}Running: $makepodcastcommand${NC}" + eval "$makepodcastcommand" + shift +done \ No newline at end of file diff --git a/makeyoutube b/makeyoutube new file mode 100755 index 00000000..aa01ba12 --- /dev/null +++ b/makeyoutube @@ -0,0 +1,57 @@ +#!/bin/bash +# makeyoutube +# makes a file appropriate for uploading to youtube +version="1.0" + +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 ] && input="$1" + [ -d "$input" ] && { outputdir="$input/objects/access/youtube_up" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + [ -f "$input" ] && { outputdir=`dirname "$input"`"/access/youtube_up" && logdir="`dirname "$input"`/access/logs" ;}; + [ ! "$outputdir" ] && { outputdir="$input/objects/access/youtube_up" && logdir="$input/metadata/submissionDocumentation/logs" ;}; + find_input "$input" + + filename=`basename "$sourcefile"` + mediaid=`basename "$1" | cut -d. -f1` + + youtubeoutput="$outputdir/${mediaid%.*}.mp4" + [ -s "$youtubeoutput" ] && { report "${RED}WARNING $youtubeoutput already exists, skipping transcode${NC}" ; exit 1 ;}; + mkdir -p "$outputdir" + get_height "$sourcefile" + get_width "$sourcefile" + + inputoptions="" + inputoptions+=" -vsync 0" + middleoptions="" + middleoptions+=" -movflags faststart" + middleoptions+=" -pix_fmt yuv420p" + middleoptions+=" -c:v libx264" + middleoptions+=" -crf 18" + if [ "$height" -eq "486" -a "$width" -eq "720" ] ; then + middleoptions+=" -vf \"crop=720:480:0:4,yadif\" " + elif [ "$height" -eq "512" -a "$width" -eq "720" ] ;then + middleoptions+=" -vf \"crop=720:480:0:32,yadif\" " + else + middleoptions+=" -vf yadif " + fi + middleoptions+=" -c:a libfaac" + middleoptions+=" -b:a 128k" + middleoptions+=" -f mp4" + + if [ "$logdir" != "" ] ; then + mkdir -p "$logdir" + export FFREPORT="file=${logdir}/%p_%t_$(basename $0)_${version}.txt" + inputoptions+=" -report" + fi + makeyoutubecommand="ffmpeg $inputoptions -i \"$sourcefile\" $middleoptions \"$youtubeoutput\"" + report "${GREEN}Running: $makeyoutubecommand${NC}" + eval "$makeyoutubecommand" + shift +done \ No newline at end of file diff --git a/quickcompare b/quickcompare new file mode 100755 index 00000000..0dc333d1 --- /dev/null +++ b/quickcompare @@ -0,0 +1,7 @@ +#!/bin/bash +checksize=512000 +# quick file compare, not completely authoritative but decent in a short amount of time +[ ! "$#" = "2" ] && { echo Use two possibly similar files are arguments. ; exit 1 ;}; +#[ ! `du "$1" | cut -f1` = `du "$2" | cut -f1` ] && echo The files are different sizes +[ ! `head -c "$checksize" "$1" | md5` = `head -c "$checksize" "$2" | md5` ] && echo The first "$checksize" bytes have different md5s. +[ ! `tail -c "$checksize" "$1" | md5` = `tail -c "$checksize" "$2" | md5` ] && echo The last "$checksize" bytes have different md5s. \ No newline at end of file diff --git a/removeDSStore b/removeDSStore new file mode 100755 index 00000000..619eaa44 --- /dev/null +++ b/removeDSStore @@ -0,0 +1,9 @@ +#!/bin/bash +# @author Dave Rice +while [ "$*" != "" ] ; do + target=$1 + if [ -d "$target" ]; then + find "$target" -name '.DS_Store' -type f -delete + fi + shift +done diff --git a/uploadomneon b/uploadomneon new file mode 100755 index 00000000..7e52daca --- /dev/null +++ b/uploadomneon @@ -0,0 +1,49 @@ +#!/bin/bash +# uploadomneon +# upload to omneon +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 ;}; + +[ $# != 1 ] && { ask_input ; once="y" ;}; + +while [ "$*" != "" -o "$once" = "y" ] ; do +once="n" +[ "$#" != 0 ] && sourcefile="$1" +removetmp="n" +filename=`basename "$sourcefile"` + +status=`ftp -a "$OMNEONIP" < 1 ]] ; then + echo error. The clip directory of "$deviceid1" has more than 1 MXF file. + exit 1 + fi + + # test for data track + hasdata1=`if [ $(ffprobe -show_streams "$mxffile" 2>&1 | grep codec_type=data | wc -l) = 0 ] ; then echo no; else echo yes; fi` + + # start reporting to operator log + echo "datetime_start: ${start}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "datetime_end: ${end}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "operator: ${op}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "deck: ${deck1}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "barcode.1: ${barcode1}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "deviceid.1: ${deviceid1}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "materialid.1: ${materialid1}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "som.1: ${som1}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "duration.1: ${duration1}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "mxffile.1: ${mxffile}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "hasdata.1: ${hasdata1}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + if [ "$barcode2" != "" ] ; then + echo "barcode.2: ${barcode2}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "deviceid.2: ${deviceid2}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "materialid.2: ${materialid2}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "som.2: ${som2}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + echo "duration.2: ${duration2}" >> "$OUTDIR_INGESTXDCAM/$deviceid1/object/op.log" + fi + + # make and deliver broadcast version + echo making omneon version... + mezzfiledir="${OUTDIR_INGESTXDCAM}/${deviceid1}/broadcast_version" + mkdir -p "$mezzfiledir" + report "${GREEN}running make_mezz_for_xdcam $som1 $duration1 $mxffile $mezzfiledir/${materialid1}.mxf${NC}" + make_mezz_for_xdcam "$som1" "$duration1" "$mxffile" "$mezzfiledir/${materialid1}.mxf" + report "${GREEN}starting to ftp the broadcast file for "${materialid1}" to the Omneon...${NC}" + "${scriptdir}/uploadomneon" "$mezzfiledir/${materialid1}.mxf" + + if [ "$barcode2" != "" ] ; then + report "${GREEN}running make_mezz_for_xdcam $som2 $duration2 $mxffile $mezzfiledir/${materialid2}.mxf${NC}" + make_mezz_for_xdcam "$som2" "$duration2" "$mxffile" "$mezzfiledir/${materialid2}.mxf" + report "${GREEN}starting to ftp the broadcast file for "${materialid2}" to the Omneon...${NC}" + "${scriptdir}/uploadomneon" "$mezzfiledir/${materialid2}.mxf" + fi + + echo starting initial checksum and packaging... + bag baginplace "${OUTDIR_INGESTXDCAM}/${deviceid1}" + + echo "done with $deviceid1 at `date`" + fi + fi +done