I have 2 preset .json files(from the GUI version on windows) to convert mkv to mp4.
- converts to h264 and adds subtitle 1
- converts to h264
I'm only trying to get no.2 to work at this stage.
for i in `*.mkv`; do HandBrakeCLI --preset-import-file HPRESET.json -Z "MYPRESET" --output *.mp4; done
no output name
HandBrakeCLI -i $1 --preset-import-gui HPRESET.json -Z "MYPRESET" --output $1.mp4
errors on output name
for i in `*.mkv`; do HandBrakeCLI --title $i --preset "Very Fast 1080p30" --output *.mp4; done
errors on output name AND not valid preset.
$ for i in `seq 4`; do HandBrakeCLI --input /dev/dvd --title $i --preset Normal --output NameOfDisc_Title$i.mp4; done
copied this from another stackoverflow question, but outputs as 1.mp4 and then 2.mp4 etc.
You can extract the filename without extension with something like that:
Example:
Same loop, different notation:
Note that the
for
command will search any file in the current directory ending with.mkv
. For each file it has found, it will save the files name into the variable$i
, then execute the commands afterdo
, then save the next files name into the variable$i
and execute the commands betweendo
anddone
. It will repeat that cycle until every file which has been found is processed.As I have no experience with handbrake presets, here a solution with
ffmpeg
: