Page 1 of 1

Addition of letterboxing (AKA padding)

Posted: Tue Mar 24, 2020 4:57 pm
by BaconKoss
Description of problem or question:

I have an AVC clip that's 1296x1080 and I want to add letterboxing at the top and the bottom, let's say 20px each. I tried the --pad command in the advanced options, but it doesn't seem to work. Supposedly padding only works with HandbrakeCLI for some reason.

Can I...

- set everything up in the GUI version of Handbrake
- export the queue as .json
- modify the line with the advanced options
- execute the .json script in HandbrakeCLI?

Is this command correct?

--pad="width=1296:height=1120:color=black:x=20:y=20" -h 1120

I really need some help as all this information is barely documented. Why can't I do that with the Handbrake GUI?

Steps to reproduce the problem (If Applicable):

-

HandBrake version (e.g., 1.0.0):

1.3.1

Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Windows 10 1909

Activity log: https://pastebin.com/RMEfysVP

Re: Addition of letterboxing (AKA padding)

Posted: Tue Mar 24, 2020 8:00 pm
by Woodstock
The PAD filter is only implemented in the CLI, so your experiment with the advanced options in the GUI wasn't going to work.

If everything you want is set up in a preset, you can tell the CLI to load that, AND add the --pad command to that. Since you're only adding top/bottom padding, you should leave the x=20 part out, or you will have the picture off to the side.

Re: Addition of letterboxing (AKA padding)

Posted: Tue Mar 24, 2020 8:35 pm
by BaconKoss
Woodstock wrote: Tue Mar 24, 2020 8:00 pm The PAD filter is only implemented in the CLI, so your experiment with the advanced options in the GUI wasn't going to work.

If everything you want is set up in a preset, you can tell the CLI to load that, AND add the --pad command to that. Since you're only adding top/bottom padding, you should leave the x=20 part out, or you will have the picture off to the side.
Can you be a bit more specific, please?

Should I do everything in the GUI (including the advanced settings), export the queue to .json and then just do this in CMD?

HandBrakeCLI --preset-import-file EXAMPLE.json -i C:\inputfile.mp4 -o C:\outputfile.mp4

with advanced settings looking like this:

--pad="width=1:height=1340:color=black:y=20" -h 1120

Re: Addition of letterboxing (AKA padding)

Posted: Tue Mar 24, 2020 8:39 pm
by BaconKoss
Can't find a way to edit the previous post. I just want to say that the last line is supposed to have "1296" after "width=" and not just "1".

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 12:58 am
by Woodstock
In addition to the --preset-import, you have to specify the name of the preset (the file import can have multiple presets in it). That will get the rest of your settings put in place, so the --pad can just add the letterbox top/bottom.

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 1:52 pm
by BaconKoss
This is such a hassle.

Can I just set everything up in the GUI, export the preset to JSON, open it in a text editor, set "x264UseAdvancedOptions" at the bottom to "true" and somehow input the "pad" command below?

That way I'd only need to execute one script in CLI, as executing two JSONs (one with my custom preset and the other with the additional advanced options) doesn't work no matter what I do.

https://superuser.com/questions/783373/ ... ndbrakecli
- -Z is only for built-in presets. and the import options (--preset-import-file and --preset-import-gui) dont successfully work with an exported preset (.json) from the gui. and instead of failing, they default to x264/rf22

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 2:08 pm
by Deleted User 11865
BaconKoss wrote: Wed Mar 25, 2020 1:52 pm This is such a hassle.

Can I just set everything up in the GUI, export the preset to JSON, open it in a text editor, set "x264UseAdvancedOptions" at the bottom to "true" and somehow input the "pad" command below?
No. x264 doesn't do padding, it's a video encoder only. The pad filter is a HandBrake filter, whatever options you pass to x264 will not be able to add HandBrake's pad filter which x264 knows nothing about.

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 4:40 pm
by BaconKoss
So I did this:

HandBrakeCLI --preset-import-file "C:\Program Files\HandBrake\HandBrakeCLI\OHOHOHO.json" --pad="width=1296:height=1120:color=black:x=20:y=20" -i D:\SAMPLE.mkv -o D:\SAMPLE_1.mp4

OHOHOHO.json looks like this: https://pastebin.com/SEmE8DiD

The bars were added, but the video bitrate is 3500 kbps and the audio bitrate is 128 kbps, even though they were set to 6000 and 256 respectively. It looks like HB defaulted to one of the default presets.

Log: https://pastebin.com/GWVTeHjD

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 5:46 pm
by JohnAStebbins
According to the log you posted, you set video quality to RF 22 (not 6000kbps ABR encoding) and audio bitrate to 128kbps.

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 5:49 pm
by JohnAStebbins
Ah, you didn't tell it to use the preset you imported. -Z or --preset

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 6:09 pm
by BaconKoss
JohnAStebbins wrote: Wed Mar 25, 2020 5:49 pm Ah, you didn't tell it to use the preset you imported. -Z or --preset
-Z only works with the presets available in Handbrake GUI ("Very Fast 1080p30" etc.).

I used --preset-import-file "C:\Program Files\HandBrake\HandBrakeCLI\OHOHOHO.json". Why doesn't that work?

Can somebody please just tell me EXACTLY what I should do? I tried to avoid being spoonfed, but I'm running out of ideas.

Last thing I can think of is editing AppData\Roaming\HandBrake\presets.json so that I can just use the "-Z. --preset" command and add the padding commaned after that.

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 6:24 pm
by BaconKoss
Nevermind. I just learned about VidCoder and it did exactly what I wanted.

I like Handbrake, but it really needs more detailed documentation and a few more options.

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 6:32 pm
by mduell
This is all covered in the documentation available in HandBrake.exe --help

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 8:22 pm
by JohnAStebbins
-Z only works with the presets available in Handbrake GUI ("Very Fast 1080p30" etc.).
Wrong
I used --preset-import-file "C:\Program Files\HandBrake\HandBrakeCLI\OHOHOHO.json". Why doesn't that work?
--preset-import-file can be used to import multiple files and a file can contain multiple presets. Therefore, you also must tell it what preset to use.
Can somebody please just tell me EXACTLY what I should do?
I thought I had
Nevermind. I just learned about VidCoder and it did exactly what I wanted.
Glad you found a solution that works for you.

Re: Addition of letterboxing (AKA padding)

Posted: Wed Mar 25, 2020 8:54 pm
by Deleted User 11865
BaconKoss wrote: Wed Mar 25, 2020 6:09 pm
JohnAStebbins wrote: Wed Mar 25, 2020 5:49 pmAh, you didn't tell it to use the preset you imported. -Z or --preset
-Z only works with the presets available in Handbrake GUI ("Very Fast 1080p30" etc.).

I used --preset-import-file "C:\Program Files\HandBrake\HandBrakeCLI\OHOHOHO.json". Why doesn't that work?
That question was already answered earlier:
Woodstock wrote: Wed Mar 25, 2020 12:58 amIn addition to the --preset-import, you have to specify the name of the preset (the file import can have multiple presets in it).