#!/bin/sh ## TODO: option to replace original file. ## TODO: audio quality. Copy if AAC or OGG <320k. ## TODO: crop options. ## TODO: handle srt encoding. if [ -z "$(command -v ffmpeg)" ]; then echo "ffmpeg required." exit fi _printhelp() { cat <&1 | grep -c 'Stream') for i in $(seq 0 $STREAM_NUM); do STREAM_TITLE="${STREAM_TITLE}-metadata:s:$i title= " done fi ffmpeg $TC_OVERWRITE -i "$1" \ -c:v $TC_VIDEO_CODEC $TC_VIDEO_OPT \ -c:a $TC_AUDIO_CODEC $TC_AUDIO_OPT \ -c:s copy \ -map 0 $STREAM_TITLE \ $TC_SAMPLE $TC_USER_OPT "${1%.*}-$(date '+%F-%H%M%S').mkv" } for i in "$@"; do ## Argument is a folder. We search for all video files in there. if [ -d "$i" ]; then ## TODO: provide max-depth as option. while read -r j; do _tc_transcode $j done <