Autocrop option for black bars in the advanced export options

One of the reasons I often export to a lossless format first, is that I need to get rid of unnecessary black bars to the left/right or top/bottom. I then feed the result to Handbrake, which removes those automatically by default (you can also switch this off or use your own crop settings).

Use case: I often have to deal with older videos (sometimes converted from 16mm film to older digital video formats, or, even worse, digitalised VHS videos). Sooner or later I’ll always stumble upon a video file that needs rescaling, either width or height, which means there is useless video space that should be removed and would also reduce the file size. A more sophisticated version of this could also detect “letterboxes” in videos and remove the black upon export.

I’m aware of the crop filters, but IMHO having something like Handbrake’s (auto)crop in the advanced export tab would be a really useful and time-saving feature.

It is not automatic, but it is not too difficult.

I know, I know, but (since it’s only a suggestion) wouldn’t it be nice if one could just rescale the video, perhaps apply some other filters, like a Denoise version or White Point (often needed with this old stuff) and then just let Shotcut remove the unnessary cruft at export time?

It’s unclear from your description if the black bars are embedded in your source material, or if they are caused by you picking the incorrect Settings > Video Mode .

If your source material does not have black bars, and you have the Shotcut Video Mode in “Automatic”, then you should not have black bars.

1 Like

@brian I don’t think my description is unclear. Just drag a badly scaled video into the timeline (thereby setting the dimensions). Rescale the video to correct it. The result is necessarily a video with black bars, either left/right or top/bottom. That’s just basic math/geometry.

I prototyped a way to add this to the Reframe filter. It could also be done in the Crop: Rectangle and Mask: Simple Shape filters. I will try to add it to the version after next.

Note to self: Run a melt job using the current project serialized to temp XML file, with in and out set to the current time position, and -attach avfilter.cropdetect -verbose -consumer null terminate_on_pause=1. Filter stderr output on the first line beginning with “[cropdetect”. Split the line on space, and select the item that begins with “crop=”. The value after “=” is width:height:x:y.

1 Like