1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

Added tdm-media utilities used to manage media.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2015-07-16 11:08:23 +02:00
parent fda99682e3
commit bcc3729141
3 changed files with 99 additions and 0 deletions

34
bin/tdm-media Executable file
View file

@ -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 "$@"

62
bin/tdm-media-cbz Executable file
View file

@ -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

View file

@ -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