Log in

View Full Version : Remove black bars


jriker1
18th June 2021, 17:29
If I have a 4k video that I'm re-encoding and it has say 60 pixels of black bars on the top and bottom, how would I remove them as part of the ffmpeg encoding process? So take the 4096×2160 file and make it 4096x2040? Not smooshing if that's a word the content, but removing the bars.

microchip8
18th June 2021, 17:58
If I have a 4k video that I'm re-encoding and it has say 60 pixels of black bars on the top and bottom, how would I remove them as part of the ffmpeg encoding process? So take the 4096×2160 file and make it 4096x2040? Not smooshing if that's a word the content, but removing the bars.

run: ffplay -i myfile -vf cropdetect

let it run for a while to get the right values, then use these values in ffmpeg:

ffmpeg -i myfile -vf crop=xxxx:xxxx:xx:xx

jriker1
18th June 2021, 18:18
Cool, thanks for the help.

asarian
18th June 2021, 18:21
run: ffplay -i myfile -vf cropdetect

let it run for a while to get the right values, then use these values in ffmpeg:

ffmpeg -i myfile -vf crop=xxxx:xxxx:xx:xx


Far be it from me to argue with a hevc coder, but I personally do my cropping manually, so as to avoid 'shifting' block boundaries that may affect deblocking in QTGMC and such. Like from a 60px bar I will first crop off 48px (divisible by 16), do the denoising, and then, as postprocessing, crop off the remaining 12px.

jriker1
18th June 2021, 18:25
Far be it from me to argue with a hevc coder, but I personally do my cropping manually, so as to avoid 'shifting' block boundaries that may affect deblocking in QTGMC and such. Like from a 60px bar I will first crop off 48px (divisible by 16), do the denoising, and then, as postprocessing, crop off the remaining 12px.

Maybe not related but curious. Do you deinterlace with 4k content or just making a general comment about automating black bar detection?

asarian
18th June 2021, 18:34
Maybe not related but curious. Do you deinterlace with 4k content or just making a general comment about automating black bar detection?

I don't possess an interlaced HDR blu-ray yet (but if I did, I would certainly deinterlace it, also with QTGMC). But yes, my comment was more generally directed at processing original 4K sources at 16px boundaries.

benwaggoner
19th June 2021, 00:23
Maybe not related but curious. Do you deinterlace with 4k content or just making a general comment about automating black bar detection?
There is no interlaced 4K content, huzzah! Evil has been vanquished!

ATSC 1.0 almost had no 1080i as well, but Intel blinked at the last minute.

It's been too long since I've shared the link to Defining Vision (https://smile.amazon.com/Defining-Vision-Broadcasters-Government-Revolution/dp/0156005972), the great page-turner true crime story of video standards development.

benwaggoner
19th June 2021, 00:26
I don't possess an interlaced HDR blu-ray yet (but if I did, I would certainly deinterlace it, also with QTGMC). But yes, my comment was more generally directed at processing original 4K sources at 16px boundaries.
The 4K Blu-ray standard does not allow for 2160i, just 2160p.

Most 4K is encoded with HEVC, which generally works fine down to mod4. mod16 was required for MPEG-2 and VC-1. H.264 was generally okay with mod8.

Also, note that mod16 cropping can't be symmetrical with 1080p, as it is really 1088 with the bottom 8 lines hidden. So mod 16 from the top, and mod16+/-8 from the bottom.

asarian
19th June 2021, 08:47
The 4K Blu-ray standard does not allow for 2160i, just 2160p.

Glad to hear it. :)


Most 4K is encoded with HEVC, which generally works fine down to mod4. mod16 was required for MPEG-2 and VC-1. H.264 was generally okay with mod8.

Also, note that mod16 cropping can't be symmetrical with 1080p, as it is really 1088 with the bottom 8 lines hidden. So mod 16 from the top, and mod16+/-8 from the bottom.

:thanks:

FranceBB
19th June 2021, 11:27
There is no interlaced 4K content, huzzah! Evil has been vanquished!


Yeah, and you won't find it in broadcast either since the standard is 50p 10bit planar for PAL and 60p 10bit planar for NTSC, so this nightmare was finally over for broadcasters as well.

It was a big fat "cheer" celebration in 2016 over here 'cause it meant we didn't have to interlace everything we received (only to see people's TV at home bob it in a way or another) any longer... :D