SHARE
TWEET

Untitled

a guest Aug 23rd, 2011 251 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Run this script in the dir containing all the flv files you wish to convert to x264.
  3. # There are no arguments. The script will copy both the audio and video bitrates into
  4. # the new file via mediainfo.
  5.  
  6. IFS=$'\012'
  7. for file in $(find -maxdepth 1 -mindepth 1 -iname '*.flv'); do
  8.         # find flv bitrate for video and audio
  9.         vkbps=$(perl -e "print $(mediainfo --inform="Video;%BitRate%" "${file}") / 1000")
  10.         akbps=$(perl -e "print $(mediainfo --inform="Audio;%BitRate%" "${file}") / 1000")
  11.         outputname="${file%.*}.mkv"
  12.  
  13.         echo filename is ${file}
  14.         echo videobit rate set to ${vkbps}
  15.         echo audobit rate set to ${akbps}
  16.  
  17.         # do not overwrite existing mkv's
  18.         if [[ -e $outputname ]]; then
  19.                 echo >&2 Output file already exists: $outputname
  20.                 echo >&2 Skipping...
  21.                 echo >&2
  22.  
  23.                 continue
  24.         fi
  25.  
  26.         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"
  27. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top