diff --git a/bin/tdm-media b/bin/tdm-media new file mode 100755 index 0000000..7b24b23 --- /dev/null +++ b/bin/tdm-media @@ -0,0 +1,34 @@ +#!/system/bin/sh + +function task.video.change.container { + CONTAINER=$1; + shift; + for video in "$@"; do + echo "Starting processing Video: $video"; + ffmpeg -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 "$@" diff --git a/bin/tdm-media-cbz b/bin/tdm-media-cbz new file mode 100755 index 0000000..027ac42 --- /dev/null +++ b/bin/tdm-media-cbz @@ -0,0 +1,62 @@ +#!/bin/sh + +## +## Creates cbz archive from supplied folder. +## + +FILENAME=$(basename $0) +show_help() { + echo $FILENAME + grep "\#\#" $0 | cut -d\# -f3- + echo +} + +PREFIX=""; +DELETE_AFTER=false +SUFFIX=cbz +while getopts "hp:s:d" opt; do + case $opt in + +## +## -p Prefix resulting filenames with supplied prefix. +## +## All resulting files will start with supplied +## prefix e.g. -p foo- bar baz will result in +## creation of archives foo-bar.cbz and foo-baz.cbz: +## + p) + PREFIX="$OPTARG"; + ;; + +## +## -d Delete supplied folders after creating archives. + d) + DELETE_AFTER=true; + ;; +## +## -s Change file type suffix from default cbz to specified. +## +## All resulting files will end with supplied suffix instead +## of cbz. E.g. -s zip will trigger creation of normal zip files. + s) + SUFFIX="$OPTARG"; + ;; + h) + show_help;exit 1;; + \?) show_help;exit 1;; + :) echo "Option -$OPTARG requires an argument." >&2 ; exit 1;; + esac +done + +shift $(($OPTIND-1)) + +echo Prefix: $PREFIX Suffix: Delete folders: $DELETE_AFTER +echo $@ +for DIR in "$@"; do + if [ -d "$DIR" ]; then + NAME=$(basename "$DIR") + echo "Going to create $NAME" + zip -r "${PREFIX}${NAME}.${SUFFIX}" "$DIR" + fi +done + diff --git a/bin/tdm-media-nikon-mov-keyframes-jpeg b/bin/tdm-media-nikon-mov-keyframes-jpeg new file mode 100755 index 0000000..466fcc1 --- /dev/null +++ b/bin/tdm-media-nikon-mov-keyframes-jpeg @@ -0,0 +1,3 @@ +#!/bin/sh +## Extract keyframes from Nikon J1 MOV files +ffmpeg -i *.MOV -vf "select=eq(pict_type\,I),setpts=N/(29.97*TB)" thumbnails-%02d.jpeg \ No newline at end of file