Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Run this script in the dir containing all the flv files you wish to convert to x264.
- # There are no arguments. The script will copy both the audio and video bitrates into
- # the new file via mediainfo.
- IFS=$'\012'
- for file in $(find -maxdepth 1 -mindepth 1 -iname '*.flv'); do
- # find flv bitrate for video and audio
- vkbps=$(perl -e "print $(mediainfo --inform="Video;%BitRate%" "${file}") / 1000")
- akbps=$(perl -e "print $(mediainfo --inform="Audio;%BitRate%" "${file}") / 1000")
- outputname="${file%.*}.mkv"
- echo filename is ${file}
- echo videobit rate set to ${vkbps}
- echo audobit rate set to ${akbps}
- # do not overwrite existing mkv's
- if [[ -e $outputname ]]; then
- echo >&2 Output file already exists: $outputname
- echo >&2 Skipping...
- echo >&2
- continue
- fi
- HandBrakeCLI -i "${file}" -o "${outputname}" --encoder x264 bframes=2:subme=6:mixed-refs=0:weightb=0:ref=5:8x8dct=0:me=umh:direct=temporal:trellis=0:b-adapt=2 --vb ${vkbps} -2 -T --aencoder faac -B ${akbps} || rm -f -- "$outputname"
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement