HandBrakeCLI batch conversion.

General support questions
Post Reply
supertight
Posts: 171
Joined: 2017/02/07 21:47:51

HandBrakeCLI batch conversion.

Post by supertight » 2018/02/12 01:06:52

I want handbrake to convert all the .mkv in a folder to .mp4

Code: Select all

HandBrakeCLI -v -i "./${file}" -o "./${file%.mkv}.mp4" -e x264
Handbrake starts, creates 1 file named .mp4 and exits. I don't get it.

I know this is easy, I'm just not seeing the hold up.

User avatar
TrevorH
Site Admin
Posts: 33218
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: HandBrakeCLI batch conversion.

Post by TrevorH » 2018/02/12 02:03:28

You appear to have pinched the bash code out of someone's for loop and neglected to copy the for loop itself. You need to wrap that inside something that sets ${file} to something. e.g.

for file in *.mkv;do HandBrakeCLI -v -i "./${file}" -o "./${file%.mkv}.mp4" -e x264;done
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: HandBrakeCLI batch conversion.

Post by supertight » 2018/02/12 03:09:56

TrevorH wrote:You appear to have pinched the bash code out of someone's for loop and neglected to copy the for loop itself. You need to wrap that inside something that sets ${file} to something. e.g.

for file in *.mkv;do HandBrakeCLI -v -i "./${file}" -o "./${file%.mkv}.mp4" -e x264;done
I added the wrapper as suggested. Same outcome. Makes 1 file ".mp4"

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: HandBrakeCLI batch conversion.

Post by supertight » 2018/02/12 03:16:01

supertight wrote:
TrevorH wrote:You appear to have pinched the bash code out of someone's for loop and neglected to copy the for loop itself. You need to wrap that inside something that sets ${file} to something. e.g.

for file in *.mkv;do HandBrakeCLI -v -i "./${file}" -o "./${file%.mkv}.mp4" -e x264;done
I added the wrapper as suggested. Same outcome. Makes 1 file ".mp4"
Negative. I made a typo. This worked perfect.

Post Reply