Addition of letterboxing (AKA padding)

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
BaconKoss
Posts: 7
Joined: Tue Mar 24, 2020 4:39 pm

Addition of letterboxing (AKA padding)

Post 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

Woodstock
Veteran User
Posts: 3621
Joined: Tue Aug 27, 2013 6:39 am

Re: Addition of letterboxing (AKA padding)

Post 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.

BaconKoss
Posts: 7
Joined: Tue Mar 24, 2020 4:39 pm

Re: Addition of letterboxing (AKA padding)

Post 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

BaconKoss
Posts: 7
Joined: Tue Mar 24, 2020 4:39 pm

Re: Addition of letterboxing (AKA padding)

Post 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".

Woodstock
Veteran User
Posts: 3621
Joined: Tue Aug 27, 2013 6:39 am

Re: Addition of letterboxing (AKA padding)

Post 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.

BaconKoss
Posts: 7
Joined: Tue Mar 24, 2020 4:39 pm

Re: Addition of letterboxing (AKA padding)

Post 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

User avatar
Rodeo
HandBrake Team
Posts: 12520
Joined: Tue Mar 03, 2009 8:55 pm

Re: Addition of letterboxing (AKA padding)

Post by Rodeo »

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.

BaconKoss
Posts: 7
Joined: Tue Mar 24, 2020 4:39 pm

Re: Addition of letterboxing (AKA padding)

Post 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

User avatar
JohnAStebbins
HandBrake Team
Posts: 5575
Joined: Sat Feb 09, 2008 7:21 pm

Re: Addition of letterboxing (AKA padding)

Post by JohnAStebbins »

According to the log you posted, you set video quality to RF 22 (not 6000kbps ABR encoding) and audio bitrate to 128kbps.

User avatar
JohnAStebbins
HandBrake Team
Posts: 5575
Joined: Sat Feb 09, 2008 7:21 pm

Re: Addition of letterboxing (AKA padding)

Post by JohnAStebbins »

Ah, you didn't tell it to use the preset you imported. -Z or --preset

BaconKoss
Posts: 7
Joined: Tue Mar 24, 2020 4:39 pm

Re: Addition of letterboxing (AKA padding)

Post 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.

BaconKoss
Posts: 7
Joined: Tue Mar 24, 2020 4:39 pm

Re: Addition of letterboxing (AKA padding)

Post 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.

mduell
Veteran User
Posts: 7116
Joined: Sat Apr 21, 2007 8:54 pm

Re: Addition of letterboxing (AKA padding)

Post by mduell »

This is all covered in the documentation available in HandBrake.exe --help

User avatar
JohnAStebbins
HandBrake Team
Posts: 5575
Joined: Sat Feb 09, 2008 7:21 pm

Re: Addition of letterboxing (AKA padding)

Post 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.

User avatar
Rodeo
HandBrake Team
Posts: 12520
Joined: Tue Mar 03, 2009 8:55 pm

Re: Addition of letterboxing (AKA padding)

Post by Rodeo »

BaconKoss wrote:
Wed Mar 25, 2020 6:09 pm
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?
That question was already answered earlier:
Woodstock wrote:
Wed Mar 25, 2020 12:58 am
In addition to the --preset-import, you have to specify the name of the preset (the file import can have multiple presets in it).

Post Reply