Created
May 13, 2015 00:26
-
-
Save ramzes642/bec5e2954f536e891bc9 to your computer and use it in GitHub Desktop.
Reconvert shell script for tv/mediaplayers
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/sh | |
if [ -z "$1" ] | |
then | |
echo "Usage: | |
$0 <source_dir> <dest_dir> - reencode folder | |
$0 <source_file> - reencode file in same dir | |
Reconverts video stream in media files and keeps all audio channels. Uses ffmpeg." | |
fi | |
rencode() { | |
inp=$1 | |
outp=$2 | |
ffmpeg -i "$inp" -map 0 -vcodec h264 -acodec: copy "$outp" | |
} | |
if [ $# = 1 ] | |
then | |
rencode "$1" "rencoded_$1" | |
fi | |
if [ $# = 2 ] | |
then | |
mkdir -p $2 | |
ls $1 | while read f | |
do | |
rencode "$1/$f" "$2/$f" | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment