1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00
nux-env/bin/tdm-media
Tony Tkacik 2715984095 Updated tdm-media to use avconv if ffmpeg is not present.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
2015-07-17 09:25:31 +02:00

39 lines
828 B
Bash
Executable file

#!/bin/bash
type ffmpeg > /dev/null 2>&1 && FFMPEG_OR_LIBAV=ffmpeg
type avconv > /dev/null 2>&1 && FFMPEG_OR_LIBAV=avconv
function task.video.change.container {
CONTAINER=$1;
shift;
echo "Using $FFMPEG_OR_LIBAV for conversion."
for video in "$@"; do
echo "Starting processing Video: $video";
$FFMPEG_OR_LIBAV -i "$video" -vcodec copy -acodec copy "${video}.$CONTAINER"
echo "Processing done.";
done
}
function task.nikon-mp4 {
task.video.change.container mp4 "$@"
}
function task.downscale {
TARGET=$1
shift
SIZE=2048
for image in "$@"; do
target_file=$TARGET/$(basename $image)
echo "Downsampling image $image to $target_file"
convert $image \
-filter Lanczos -sampling-factor 1x1 \
-resize "${SIZE}x${SIZE}>" \
-quality 90 \
$target_file
done
}
TASK=$1
shift
task.$TASK "$@"