Log in

View Full Version : add black bars on top and bottom


varekai
29th December 2018, 13:42
wrong forum

StainlessS
30th December 2018, 12:34
Wrong forum.
Maybe move to New and alternative a/v containers, or some other forum.

EDIT: To below. I just wanted for you to get the best answer, you may not have gotten any answers in this forum.

varekai
30th December 2018, 13:51
Wrong forum.
Maybe move to New and alternative a/v containers, or some other forum.OK! Posted same question here before, you gave me instructions some time ago so I thought I'd ask for help here.

Qaenos
30th December 2018, 15:34
Is this what you are trying to do:

YourVideo = ColorBars(640,480) # This should be the video you are adding black bars to. I'm using ColorBars as a test.
BarH = 100 # Your desired height of each black bar
BarW = YourVideo.Width # Width of black bar has to be the same as your video
BlackBar = BlankClip(YourVideo, Width = BarW, Height = BarH) # Create a black bar using your video as a template (so that the pixel type, fps, etc. match)
FinalVideo = StackVertical(BlackBar, YourVideo, BlackBar) # Place a black bar on top and below your video
Return FinalVideo

varekai
30th December 2018, 15:54
Is this what you are trying to do:

See this post: https://forum.doom9.org/showthread.php?p=1861425#post1861425

Groucho2004
30th December 2018, 16:20
YourVideo = ColorBars(640,480) # This should be the video you are adding black bars to. I'm using ColorBars as a test.
BarH = 100 # Your desired height of each black bar
BarW = YourVideo.Width # Width of black bar has to be the same as your video
BlackBar = BlankClip(YourVideo, Width = BarW, Height = BarH) # Create a black bar using your video as a template (so that the pixel type, fps, etc. match)
FinalVideo = StackVertical(BlackBar, YourVideo, BlackBar) # Place a black bar on top and below your video
Return FinalVideo
Yes, all roads lead to Rome. I prefer the shorter route (http://avisynth.nl/index.php/AddBorders).

varekai
30th December 2018, 19:03
Yes, all roads lead to Rome. I prefer the shorter route (http://avisynth.nl/index.php/AddBorders).swoosh...that's way over my head...:o

Qaenos
30th December 2018, 19:23
Yes, all roads lead to Rome. I prefer the shorter route (http://avisynth.nl/index.php/AddBorders).

Excellent! I didn't know that existed. :)

varekai
30th December 2018, 20:15
Excellent! I didn't know that existed. :)Oh... how I wish I could understand how this could help me... :o

StainlessS
30th December 2018, 22:27
Oh... how I wish I could understand how this could help me... :o

Not sure that it can, I assumed that you do not want to re-encode the clip because of the ffmpeg requirement.

But In Avisynth eg,

BTOP=100 # or whatever, best be a multiple of two
BBOT=100 # Ditto

AviSource("...")
AddBorders(0,BTOP,0,BBOT,Color=$000000) # Black
Return Last


There is also LetterBox which is sort of Crop and Addborders combined(result frame size does not change):- http://avisynth.nl/index.php/Letterbox

I do note that the old Letterbox docs were wrong,
Letterbox(clip,int top,int bottom,int "left",int "right",int "color")
Left and Right were never args to letterbox, should have been x1 and x2.

varekai
31st December 2018, 12:48
@StainlessS

Thanks for trying to help.
I really don't understand how avisynth works.
It would be ideal if encoding could be avoided because it's very timeconsuming.
I don't ask you to micromanage me but I need more guidance with values and how to "load" these values into avisynth, like using a batfile if possible?
Basically its about to pad an mkv, 3840x1598 to 3840x2160 keeping correct color values.

Kind regards

Color primaries : BT.2020
Transfer characteristics : PQ
Matrix coefficients : BT.2020 non-constant
Mastering display color primaries : Display P3
Mastering display luminance : min: 0.0050 cd/m2, max: 4000 cd/m2
Maximum Content Light Level : 1125 cd/m2
Maximum Frame-Average Light Level : 248 cd/m2

Groucho2004
31st December 2018, 13:12
It would be ideal if encoding could be avoided because it's very timeconsuming.
It can't be avoided if you want to add black bars.
So, since you already have a batch file that adds them with ffmpeg and you learned in the other thread how to adjust the colour metadata you're good to go. You don't need Avisynth in this case.

varekai
31st December 2018, 13:31
It can't be avoided if you want to add black bars.
So, since you already have a batch file that adds them with ffmpeg and you learned in the other thread how to adjust the colour metadata you're good to go. You don't need Avisynth in this case.
Thanks for clarifying! I'm a happy camper! :D

Regards