Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # surround_to_stereo
- FF=$(which ffmpeg)
- [[ ! $FF ]] && >&2 echo "Can't Find ffmpeg" && exit
- if [ $# -lt 2 ]; then
- >&2 echo "surround_to_stereo <filename>"
- exit
- fi
- # audio rate -- DVD AC3 5.1 is 448k native
- A_RATE="320k"
- AENC="libfdk_aac"
- # AENC="aac" # default if not there
- # A_RATE="448k"
- # use single quotes because parameter requires double inside
- AF='-ac 2 -af "pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR"'
- # if your hardware does Dolby ProLogic II this will sound better. Mine doesn't.
- # AF='aresample=matrix_encoding=dplii -ac 2 -ar 48000 -ab 256k'
- # fixes backwards-endian audio bytes or does nothing if it is OK
- BSF="aac_adtstoasc"
- fname="${1%.*}"
- ext="${1##*.}"
- outfile="${fname}.2ch.${ext}"
- # 6 to 2 channel reencode with Dolby II matrix
- ${FF} -i "${1}" \
- -fflags +genpts \
- -c:v copy \
- -c:a ${AENC}" \
- -b:a "${A_RATE}" "${AF}" \
- -bsf:a "$BSF" \
- "${outfile}"
- #END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement