/usr/share/doc/mediatomb-common/examples/mediatomb-transcode is in mediatomb-common 0.12.1-5ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #!/bin/sh
# This script is used by MediaTomb for transcoding support.
# Basic function that will transcode any input file into the target type
# 'dvd' ffmpeg supports
video_common() {
local input="$1"
local output="$2"
ffmpeg -i "$input" -target dvd -y "$output"
}
# Basic function that will transcode any input file into the wav format
audio_common() {
local input="$1"
local output="$2"
ffmpeg -i "$input" -f wav -y "$output"
}
# Function to transcode matroska files to dvd compatible format
transcode_matroska() {
local input="$1"
local output="$2"
local alang="$3"
local slang="$4"
# Default to english if languages are not set
[ "$alang" ] || alang="eng"
[ "$slang" ] || slang="eng"
# Use mencoder if available, else fall back to using ffmpeg.
# Transcoding using ffmpeg will not include subtitles.
if which mencoder >/dev/null 2>&1; then
mencoder "$input" -oac lavc -ovc lavc -of mpeg -mc 0 -noskip \
-lavcopts vcodec=mpeg2video:vbitrate=6000:acodec=ac3:abitrate=448 \
-vf harddup -alang "$alang" \
-slang "$slang" -font 'Bitstream Vera Sans' \
-o "$output"
else
ffmpeg -alang "$alang" -slang "$slang" -i "$input" -target dvd \
-y "$output"
fi
}
# Our "main" function below.
USAGE="
This script is used by MediaTomb for transcoding support. It can also serve as
a script to transcode various files in a format suitable for streaming directly.
Synopsis:
mediatomb-transcode [TRANSCODE FUNCTION OPTION] [GENERIC OPTIONS]
Generic Options:
-h, --help Display this help message.
-i, --input Input file that is meant to be transcoded.
-o, --output Output file that will be read back by MediaTomb.
--audio-lang Specify ISO 639 language code to use for audio.
--subtitle-lang Specify ISO 639 language code to use for subtitles.
Transcode Function Options (one is required):
--video-common Perform generic video transcoding.
--audio-common Perform generic audio transcoding.
--transcode-matroska Used in transcoding matroska files.
"
while [ "$#" -gt "0" ]
do
case "$1" in
-i|--input)
INPUT="$2"
shift; shift;
;;
-o|--output)
OUTPUT="$2"
shift; shift;
;;
--video-common)
USE_VIDEO_COMMON=1
shift
;;
--audio-common)
USE_AUDIO_COMMON=1
shift
;;
--transcode-matroska)
USE_TRANSCODE_MATROSKA=1
shift
;;
--audio-lang)
ALANG="$2"
shift; shift;
;;
--subtitle-lang)
SLANG="$2"
shift; shift;
;;
-h|--help|*)
echo "${USAGE}"
exit 1
;;
esac
done
# Perform specified function
if [ $USE_VIDEO_COMMON ]; then
video_common "$INPUT" "$OUTPUT"
elif [ $USE_AUDIO_COMMON ]; then
audio_common "$INPUT" "$OUTPUT"
elif [ $USE_TRANSCODE_MATROSKA ]; then
transcode_matroska "$INPUT" "$OUTPUT" "$ALANG" "$SLANG"
else
# Must specify one transcoding function
echo "${USAGE}"
exit 1
fi
|