Wednesday, May 8, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 5631  / 2 Years ago, wed, june 22, 2022, 11:50:21

How do I target multiple files (and or recursively through directories) with HandBrakeCLI like when using the GUI? When using the GUI with Mac I can select a folder with multiple files and queue the lot.



I guess I'm asking how do I queue with CLI?


More From » command-line

 Answers
0

With a script:



#!/bin/bash

# this script is to convert automatically a folder of video files to mp4
# You need to change SRC -- Sourse folder and DEST -- Destination folder
# The mp4 format is 480x270

SRC=/home/$USER/Videos/
DEST=/home/$USER/Videos/mp4/
DEST_EXT=mp4
HANDBRAKE_CLI=HandBrakeCLI

for FILE in `ls $SRC`
do
filename=$(basename $FILE)
extension=${filename##*.}
filename=${filename%.*}

$HANDBRAKE_CLI -i $SRC/$FILE -o $DEST/$filename.$DEST_EXT -e x264 -q 22 -r 12 -B 64 -X 480 -O
done


Save, make it exectuable and this will convert files to .mp4 in directory /home/$USER/Videos to /home/$USER/Videos/mp4/. Change and create the dirs to what you need. And alter the line with $HANDBRAKE_CLI in to use your own parameters and setting.


[#27459] Friday, June 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ouschee

Total Points: 485
Total Questions: 88
Total Answers: 106

Location: Central African Republic
Member since Mon, Aug 10, 2020
4 Years ago
ouschee questions
;