Skip to content

Instantly share code, notes, and snippets.

@typomedia
Last active December 21, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save typomedia/6292423 to your computer and use it in GitHub Desktop.
Save typomedia/6292423 to your computer and use it in GitHub Desktop.
FFMPEG Transcoder Script
#!/bin/sh
# Copyright 2014 Typomedia Foundation. All rights reserved.
# Released under GPL version 3.
#
# FFMPEG Transcoder Script v1.2
EXEC=/usr/bin/ffmpeg
INPUT=/mnt/media/Movies
FTYPE=*.rip.mkv
SUFFIX=.h264.mkv
# check if script is not running
if ! ps x | grep '[/]ffmpeg.h264.sh' > /dev/null
cd $INPUT
# Transcode all files with the specified FTYPE
for FILE in $FTYPE
# transcode video stream and copy all audio streams and all subtitles
do $EXEC -i "$FILE" -map 0 -c:v libx264 -preset slow -tune film -crf 20 -c:a copy -c:s copy "$FILE${SUFFIX}"
done
fi
@typomedia
Copy link
Author

More options for encoding you will find here: https://trac.ffmpeg.org/wiki/x264EncodingGuide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment