-
Notifications
You must be signed in to change notification settings - Fork 27
/
rewrapmxf
executable file
·47 lines (42 loc) · 1.51 KB
/
rewrapmxf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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:0)
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