Jump to content

(Failing to) crop a file


arrbee99

Recommended Posts

arrbee99

Am trying to crop a mkv video using this -

REM Testing for loop
FOR %%m in (*.mkv) do (
REM Cut from all sides
ffmpeg -i "%%m" -vf "crop=1800:900;120:180" -c:a copy "%%~nm_cut_all.mkv"
echo ====================================================
)

Its supposed to crop from all sides. The mkv is 1920x1080. Its saved as a windows.bat file. When I run it it seems to run, pops up a window which disappears super quick and creates a new file with nothing in it. So, no success. Any ideas why not please (apart from me not knowing what I'm doing) ?

Link to comment
Share on other sites

arrbee99

Yes, seems to work well.

I do wonder though about the above if it does more than just remove bits round the edge, as the resulting files are so much smaller - generally they're less than half the size after going from 1920x1080 to (in the latest version) 1670x920.

Link to comment
Share on other sites

Have you tried playing these files back through different clients to see if there is any bad side effects?

Link to comment
Share on other sites

arrbee99

Only the briefest of skim throughs, and only in vlc. They seemed fine, but I just wonder. Like I say maybe 45% of original size, and apparently the same reduction for bitrate, but same resolution and framerate. I don't exactly expect bluray quality and they're pretty decent.

Its like it decides to compress them. Just hoping for an explanation or a 'thats completely standard' really...

Link to comment
Share on other sites

crusher11

Well yeah, you're re-encoding. No other way to crop. But there are no encoding parameters given so I assume it's just throwing in defaults, which likely aren't as good as the original compression depending on the source.

 

Link to comment
Share on other sites

arrbee99

Hmmm. So cropping automatically re-encodes. I guess the -c:a copy in the first post only copies the audio ? I can't use -c copy to copy video ?

Link to comment
Share on other sites

crusher11

No, because there's no way to copy it. It's editing the picture, and therefore has to do a new video encode.

-c:v copy would copy the video if you were doing an edit that could be done losslessly, but you aren't.

Edited by crusher11
  • Like 1
Link to comment
Share on other sites

Load one of the cropped videos up onside the original and look at the Media Info section of both.  How much difference do you see in the bitrate?

You could also use MediaInfo program as well outside of Emby if you have that.

But as crusher11 mentioned you're only copying audio, no subs, chapters or anything else as well as re-encoding the video with nothing specified.

Edited by cayars
Link to comment
Share on other sites

arrbee99
14 minutes ago, crusher11 said:

No, because there's no way to copy it. It's editing the picture, and therefore has to do a new video encode.

-c:v copy would copy the video if you were doing an edit that could be done losslessly, but you aren't.

Oh well. Such is life. Thanks for the info 😀

Link to comment
Share on other sites

arrbee99
4 minutes ago, cayars said:

Load one of the cropped videos up onside the original and look at the Media Info section of both.  How much difference do you see in the bitrate?

You could also use MediaInfo program as well outside of Emby if you have that.

They vary a bit but its roughly 3800kb/s to 1800kb/s.

Seems to be just the way it is. I'll survive...

Link to comment
Share on other sites

Quite a bit of a difference.  The new files is using less than half the bitrate of the original.

BTW, why do you want to crop the videos?

Link to comment
Share on other sites

arrbee99
3 minutes ago, cayars said:

Quite a bit of a difference.  The new files is using less than half the bitrate of the original.

BTW, why do you want to crop the videos?

True. Maybe I could try using that crf thing, or maybe its not worth the effort.

Doing a bit of, erm, home recording and I haven't found a way, yet, to record exactly the bit of the window I want, so I need to remove some borders.

Link to comment
Share on other sites

From decades of playing with video, my personal advise is don't change the video from standard resolutions as some clients won't like this and do weird things you don't expect unless you know exactly how to author the video and set aspect ratios, etc

With that said, if these videos will only be used in Emby then test watching them in every client you have access to before committing to crop all your videos.
Just a case of better safe than sorry.

 

  • Like 1
Link to comment
Share on other sites

arrbee99

Yep, they're just for Emby and I'll see how they go. They've just passed the vlc test so far...

  • Like 1
Link to comment
Share on other sites

crusher11
6 hours ago, arrbee99 said:

They vary a bit but its roughly 3800kb/s to 1800kb/s.

Seems to be just the way it is. I'll survive...

Or you could throw in some encoding settings? 

Link to comment
Share on other sites

arrbee99

I probably could if I knew what I was doing.

Do you mean crf ? doesn't that depend on whether its x264 or x265 or something. If I look in MediaInfo it says Video Format: AVC and Codec ID: V_MPEG4/ISO/AVC if that counts for anything.

Link to comment
Share on other sites

crusher11
ffmpeg -i "%%m" -vf "crop=1800:900;120:180" -c:a copy -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -x264opts level=4.1:ref=4:colormatrix=bt709 "%%~nm_cut_all.mkv"

And as above this won't copy subtitles, chapters, etc.

Link to comment
Share on other sites

arrbee99

Bit rate for cropped version is much higher now thanks. Bit of a struggle to spot much of a difference tbh so far. So do I want to keep that extra info or not...quite probably. I think.

Link to comment
Share on other sites

  • 1 month later...
arrbee99
On 7/28/2021 at 5:52 PM, crusher11 said:

ffmpeg -i "%%m" -vf "crop=1800:900;120:180" -c:a copy -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -x264opts level=4.1:ref=4:colormatrix=bt709 "%%~nm_cut_all.mkv"

And as above this won't copy subtitles, chapters, etc.

Seeing as I know nowt about the various media formats and containers and thingies, regarding the above, would anyone happen to know if I can use it as is for mp4 videos, or does it need to be changed (apart from the .mkv bit at the end of course) pleasey.

Link to comment
Share on other sites

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