Skip to content

Instantly share code, notes, and snippets.

@typomedia
Forked from typomedia/ffmpeg.h264.sh
Last active January 4, 2016 02:38
Show Gist options
  • Save typomedia/8555963 to your computer and use it in GitHub Desktop.
Save typomedia/8555963 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Copyright 2014 Typomedia Foundation. All rights reserved.
# Released under GPL version 3.
#
# FFMPEG Transcoder Script v1.2
PATH=/opt/local/sbin:/opt/local/bin:$PATH
INPUT=/mnt/media/Movies
FTYPE=*.1080.rip.mkv
# check if script is not running
if ! ps x | grep '[/]ffmpeg.h264.1080.sh' > /dev/null
cd $INPUT
# Transcode all files with the specified FTYPE
for FILE in $FTYPE
# transcode and crop video stream and copy all audio streams + subtitles
do ffmpeg -i "$FILE" -filter:v crop=1920:800:0:140 -map 0 -c:v libx264 \
-preset slow -crf 20 -c:a copy -c:s copy "${FILE%%.*}.mkv"
done
fi
@typomedia
Copy link
Author

Here you can find more infos about how to crop different sizes of a video:
http://www.ffmpeg.org/ffmpeg-filters.html#toc-Examples-6

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