Jump to content

Cropping .mkv files


Go to solution Solved by kanipek,

Recommended Posts

HrHauptfeld
Posted (edited)

I bought myself an OLED TV a few month back. After watching Netflix and Co. for some time, I wanted to watch my old TV-Series and Movies. The annoying thing about having a proper black on screen is, that all these older movies and series which where recorded in 4:3 or some other resolutions, now have these ugly grey areas on both sides of the original image. I think these where added when they put these movies on discs to make them into a "16:9" movie. To be honest, these stupid grey bars on both sides are driving me insane.

I've already been recommended to use Shutter Encoder for removing the grey bars. I've been successful in removing the horizontal bars from a movie that was recorded in 2.35:1 by using the advanced cropping function. But I'm really struggling with the sources that have an 4:3 image.
If I select the area to crop, the same way I did with the 2.35:1 movie, I'm just getting a heavily zoomed version of the top left of the original image plus the left grey/black bar. See imgs below.

Selection in Shutter Encoder:

Spoiler

selection.PNG.6fbae1e79bb31093c3b96d16b4e53cd6.PNG

Result after converting:

Spoiler

result.thumb.PNG.2db15d7d533a2853cfb586df8bf9c606.PNG


Any ideas why this is happening? The only difference I've noticed is that the 4:3 source files have a resolution of 1080p, while the 2.35:1 file was just about 720p or less. The video format of the 16:9 files is also AVC (advanced video codec), while the other one was mpeg. And of course the that one has vertical bars and the other one had horizontal bars.
Also quite interesting are the pixel values in the cropping selection window. I'm not sure if Shutter Encoder downscales the video so that it fits the sceen or if there's another reason for not having the full resolution of the source file.

 

 


 

Edited by HrHauptfeld
PenkethBoy
Posted (edited)

have you tried Handbrake - IIRC in has an option to autocrop the black bars video?

also check the bars are actually part of the video and not an artifact of the image ratio in the player

Edited by PenkethBoy
  • Solution
Posted

Handbrake will do this quite easily/nicely. Vidcoder gives you a slightly improved UI - uses Handbrake in the backend.

Just to be clear about what you are trying to do - You have these media files where the letter/pillar boxing (top/side bars) is actually in encoded in the files and you wish to remove the bars encoded in the files. Is that correct?

arrbee99
Posted

The attached is a modified version of a file PenkethBoy send me ages ago. It might help. Should crop the sides of mp4 files. I presume you can change the type of file. It does every mp4 it finds thats in the same directory as the cropping file (which should be a Windows batch file, extension .bat).

You also need to have a copy of ffmpeg. I think I used these instructions -

https://video.stackexchange.com/questions/20495/how-do-i-set-up-and-use-ffmpeg-in-windows

Anyway, Might help, might not. PenkethBoy will probably point out how rubbishy the changes I made to his original are (don't really know what I'm doing...)

 

 

Crop left and right plus copy minus 240.zip

PenkethBoy
Posted

thats fine but is set at a fixed width removal of 240px which may or may not work for the OP

easy enough to change

HrHauptfeld
Posted (edited)
On 02/01/2021 at 11:58, PenkethBoy said:

have you tried Handbrake - IIRC in has an option to autocrop the black bars video?

also check the bars are actually part of the video and not an artifact of the image ratio in the player

Handbrake is indeed way better suited for this job. So far with all my test files, it removed all the bars automatically.

12 hours ago, kanipek said:

Handbrake will do this quite easily/nicely. Vidcoder gives you a slightly improved UI - uses Handbrake in the backend.

Just to be clear about what you are trying to do - You have these media files where the letter/pillar boxing (top/side bars) is actually in encoded in the files and you wish to remove the bars encoded in the files. Is that correct?

Vidcoder works fine as well. And yes, the bars are encoded in the files and I want them gone.

Is there a way to force Handbrake/Vidcoder to stay as close to the source files as possible without having to manually adjust the encoding settings every time (so that the codec, frame- and bitrates stay the same as they are in the original)? In my case, the audio and subtitle tracks should be a 1:1 copy from the originals. The same goes for the video itself, minus the side bars of course.

Just asking because I don't have that much knowledge about all these things and how they can impact the quality.

 

Edited by HrHauptfeld
clarified things a little more
pwhodges
Posted

Just be aware that sometimes a disc may use some of the black bar area for subtitles.  This is uncommon, but should be born in mind if you ever use subtitles - cropping in this case will also affect the subtitles and may make them unusable.

Paul

HrHauptfeld
Posted
2 minutes ago, pwhodges said:

Just be aware that sometimes a disc may use some of the black bar area for subtitles.  This is uncommon, but should be born in mind if you ever use subtitles - cropping in this case will also affect the subtitles and may make them unusable.

Paul

really? even if they are embedded in the mkv container and not burned into the image? I always thought that they are added by the programs playing the movies and automatically adjusted to fit the screen.

pwhodges
Posted

Yes, but their position depends on where they think the edge of the image is.

Paul

HrHauptfeld
Posted
8 minutes ago, pwhodges said:

Yes, but their position depends on where they think the edge of the image is.

Paul

thats good to know. thanks.
However, I'm rarely using the subs. They are mainly there for parts that are hard to understand or in a completely foreign language. So I guess I skip the additional work for now :)

pwhodges
Posted

For most people this will never be an issue. 

But specifically, it affects most episodes of the new US release of the anime InuYasha - certainly up to the third volume (just released), which covers up to 83 episodes; so it mattered to me!  

Paul

PenkethBoy
Posted
4 hours ago, HrHauptfeld said:

Handbrake is indeed way better suited for this job. So far with all my test files, it removed all the bars automatically.

Vidcoder works fine as well. And yes, the bars are encoded in the files and I want them gone.

Is there a way to force Handbrake/Vidcoder to stay as close to the source files as possible without having to manually adjust the encoding settings every time (so that the codec, frame- and bitrates stay the same as they are in the original)? In my case, the audio and subtitle tracks should be a 1:1 copy from the originals. The same goes for the video itself, minus the side bars of course.

Just asking because I don't have that much knowledge about all these things and how they can impact the quality.

 

setup your own profile(s) with the settings you want - save and then set as default - in handbrake at least

Posted
10 hours ago, HrHauptfeld said:

Handbrake is indeed way better suited for this job. So far with all my test files, it removed all the bars automatically.

Vidcoder works fine as well. And yes, the bars are encoded in the files and I want them gone.

Is there a way to force Handbrake/Vidcoder to stay as close to the source files as possible without having to manually adjust the encoding settings every time (so that the codec, frame- and bitrates stay the same as they are in the original)? In my case, the audio and subtitle tracks should be a 1:1 copy from the originals. The same goes for the video itself, minus the side bars of course.

Just asking because I don't have that much knowledge about all these things and how they can impact the quality.

 

I have a fair bit of knowledge converting videos. I have asked the same question many times (usually to myself). I have not found the equivalent of "lossless" conversion. But as @PenkethBoy mentioned you can figure out settings that give you the results you are looking for and then save as a profile in both Handbrake and Vidcoder.

I personally convert to MP4 so I started with a built in profile and modified from there. You may want to do this for a few different resolutions - 1920x1080, 1280x720, 1440x1080, 960x720, 640x480 etc. 

HrHauptfeld
Posted
17 hours ago, PenkethBoy said:

setup your own profile(s) with the settings you want - save and then set as default - in handbrake at least

 

10 hours ago, kanipek said:

I have a fair bit of knowledge converting videos. I have asked the same question many times (usually to myself). I have not found the equivalent of "lossless" conversion. But as @PenkethBoy mentioned you can figure out settings that give you the results you are looking for and then save as a profile in both Handbrake and Vidcoder.

I personally convert to MP4 so I started with a built in profile and modified from there. You may want to do this for a few different resolutions - 1920x1080, 1280x720, 1440x1080, 960x720, 640x480 etc. 

Yeah, guess there's no way around it. Thanks for your help guys!
Maybe someday, if I'm bored enough, I'll check if Handbrake or Vidcoder can be passed commands and started from the console as well. Than I could write a small Powershell script that analyses the source files and passes the values to the SW so that you don't have to do this by yourself. 
As of now, I'll setup some presets and do everything manually. So far I have discovered 8 movies and 2 TV-Shows which would need about 4-5 different presets. That's just not enough to write a script for :)

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...