Last active
May 14, 2017 12:34
-
-
Save jtsaito/aed8bc7b58aa222fa49812bef2943ba9 to your computer and use it in GitHub Desktop.
Transcode 720 to 1080 with ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script downsizes video files from 1080 to 720 resolution using ffmpeg. | |
# It expects input files in ./movies and an output dir ./720. | |
transcode () | |
{ | |
file=$1 | |
indir=$2 | |
outdir=$3 | |
quality=23 # 0 - 51 (best - worst). default: 23. | |
ffmpeg -i $indir/$file \ | |
-map 0:0 -map 0:1 -map 0:2 -map 0:3 -map 0:4 \ # channel map for 2 audio and 2 sub titles | |
-vf scale=-1:720 -c:v libx264 -crf $quality -preset fast \ | |
-c:a:0 copy -c:a:1 copy -c:s copy $outdir/720-"$file" # copy channels | |
} | |
inputdir="movies" | |
outputdir="720" | |
for f in `ls -1 $inputdir`; do | |
transcode $f $inputdir $outputdir | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment