Skip to content

Commit

Permalink
Merge pull request #215 from mediamicroservices/rewrapmxf
Browse files Browse the repository at this point in the history
Rewrapmxf
  • Loading branch information
CSchloss385 authored Feb 16, 2018
2 parents a6b362a + f0b92b3 commit dc432b5
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions rewrapmxf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
# left 2 stereo mix
VERSION=1.1
unset DEPENDENCIES
DEPENDENCIES=(ffmpeg ffprobe)

SCRIPTDIR=$(dirname "${0}")
. "${SCRIPTDIR}/mmfunctions" || { echo "Missing '${SCRIPTDIR}/mmfunctions'. Exiting." ; exit 1 ;};

_usage(){
echo
echo "$(basename "${0}") ${VERSION}"
echo "This application takes an input video file and produces an mxf file. Timecode will be set to 00:00:00;00"
echo "Dependencies: ${DEPENDENCIES[@]}"
echo "Usage: $(basename "${0}") file1 [ file2 ...]"
echo
exit
}
[ "${#}" = 0 ] && _usage
_check_dependencies "${DEPENDENCIES[@]}"

_cleanup(){
_log -a "Process quit"
exit 1
}

trap _cleanup SIGHUP SIGINT SIGTERM

while [ "${*}" != "" ] ; do
SOURCEFILE="${1}"
unset FFMPEG_OPTS
FFMPEG_OPTS+=(-c:v copy)
FFMPEG_OPTS+=(-c:a pcm_s24le)
FFMPEG_OPTS+=(-map 0:v)
FFMPEG_OPTS+=(-map 0:a)
FFMPEG_OPTS+=(-metadata timecode='00:00:00;00')
EXTENSION="mxf"
OUTPUT_MOVIE="${HOME}/Desktop/$(basename "${SOURCEFILE%.*}").${EXTENSION}"
if [ -f "${OUTPUT_MOVIE}" ] ; then
_report -wt "The intended output of $(basename "${0}") already exists. Skipping for now. Please delete ${OUTPUT_MOVIE} and rerun or figure out why you are trying to do this."
else
_report -dt "Generating ${OUTPUT_MOVIE} ... with these options ${FFMPEG_OPTS[*]}"
ffmpeg -i "${SOURCEFILE}" "${FFMPEG_OPTS[@]}" "${OUTPUT_MOVIE}"
_report -dt "$(basename "${0}") is done with $(basename "${SOURCEFILE}"). It's at ${OUTPUT_MOVIE}!"
fi
shift
done

0 comments on commit dc432b5

Please sign in to comment.