Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # ----------
- # This script uses x264/mkvmerge to convert any mkv x264 video to 8-bit (high @ 4.1 Profile) circumventing possible
- # issues with the High 10 Profile (Hi10p)
- #
- # While Hi10p is supreme to 8-Bit (regarding both file size and quality), there is a serious lack of support for it,
- # especially on linux (surprise, surprise!). Only newer versions of mplayer/2 and ffmpeg support this format.
- # And even then you won't get GPU acceleration rendering the support useless unless you have a fast CPU, especially regarding
- # 1080p material found in anime movies and BD rips of series.
- #
- # Unfortunately, more and more anime fansub groups are jumping on the Hi10P train :-(. Some don't even bother to tag
- # their files with something like "Hi10p".
- # ----------
- # Needed tools:
- # MKVToolnix (install Ubuntu mkvtoolnix package)
- # x264 (install Ubuntu x264 package)
- # ----------
- # Usage:
- # transcode_8bit <output directory> FILE1 FILE2 ...
- # ----------
- # initialize variables
- OUTPUTDIR=$1
- shift
- if [ ! -d $OUTPUTDIR ]
- then
- mkdir $OUTPUTDIR
- fi
- WORKDIR=$HOME
- TEMPFILE=$WORKDIR/transcode.8bit.temp.$$.mkv
- for input in "$@"
- do
- output=$input
- output=${output##*/}
- output=${output%.mkv}[8-bit].mkv
- output=$OUTPUTDIR/$output
- echo "processing $input -> $output ..."
- # use x264 to transcode the video stream -- not sure which crf-value I should use
- # priorize quality over file size!
- x264 --threads=auto --tune animation --preset veryfast --profile high --level 4.1 --crf 16 -o "$TEMPFILE" "$input"
- # use mkvmerge to put everything back together (except the original video, of course)
- mkvmerge -o "$output" -D "$input" "$TEMPFILE"
- # make things pretty
- echo
- # clean up temp files
- if [ -e $TEMPFILE ]
- then
- rm -f "$TEMPFILE"
- fi
- echo "processing $input -> $output done"
- echo
- done
- # all done
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement