arrbee99 1544 Posted July 26, 2021 Share Posted July 26, 2021 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 More sharing options...
arrbee99 1544 Posted July 26, 2021 Author Share Posted July 26, 2021 ...and I've just spotted the (accidental) semicolon. Link to comment Share on other sites More sharing options...
Carlo 4328 Posted July 27, 2021 Share Posted July 27, 2021 You good now? Link to comment Share on other sites More sharing options...
arrbee99 1544 Posted July 27, 2021 Author Share Posted July 27, 2021 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 More sharing options...
Carlo 4328 Posted July 27, 2021 Share Posted July 27, 2021 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 More sharing options...
arrbee99 1544 Posted July 27, 2021 Author Share Posted July 27, 2021 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 More sharing options...
crusher11 842 Posted July 27, 2021 Share Posted July 27, 2021 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 More sharing options...
arrbee99 1544 Posted July 27, 2021 Author Share Posted July 27, 2021 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 More sharing options...
crusher11 842 Posted July 27, 2021 Share Posted July 27, 2021 (edited) 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 July 27, 2021 by crusher11 1 Link to comment Share on other sites More sharing options...
Carlo 4328 Posted July 27, 2021 Share Posted July 27, 2021 (edited) 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 July 27, 2021 by cayars Link to comment Share on other sites More sharing options...
arrbee99 1544 Posted July 27, 2021 Author Share Posted July 27, 2021 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 More sharing options...
arrbee99 1544 Posted July 27, 2021 Author Share Posted July 27, 2021 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 More sharing options...
Carlo 4328 Posted July 27, 2021 Share Posted July 27, 2021 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 More sharing options...
arrbee99 1544 Posted July 27, 2021 Author Share Posted July 27, 2021 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 More sharing options...
Carlo 4328 Posted July 27, 2021 Share Posted July 27, 2021 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. 1 Link to comment Share on other sites More sharing options...
arrbee99 1544 Posted July 27, 2021 Author Share Posted July 27, 2021 Yep, they're just for Emby and I'll see how they go. They've just passed the vlc test so far... 1 Link to comment Share on other sites More sharing options...
crusher11 842 Posted July 28, 2021 Share Posted July 28, 2021 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 More sharing options...
arrbee99 1544 Posted July 28, 2021 Author Share Posted July 28, 2021 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 More sharing options...
crusher11 842 Posted July 28, 2021 Share Posted July 28, 2021 Well, you can encode it to whatever you like. Link to comment Share on other sites More sharing options...
crusher11 842 Posted July 28, 2021 Share Posted July 28, 2021 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 More sharing options...
arrbee99 1544 Posted July 28, 2021 Author Share Posted July 28, 2021 Thank you. I'll give it a go Link to comment Share on other sites More sharing options...
arrbee99 1544 Posted July 28, 2021 Author Share Posted July 28, 2021 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 More sharing options...
arrbee99 1544 Posted September 10, 2021 Author Share Posted September 10, 2021 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 More sharing options...
crusher11 842 Posted September 10, 2021 Share Posted September 10, 2021 It'll work. Link to comment Share on other sites More sharing options...
arrbee99 1544 Posted September 10, 2021 Author Share Posted September 10, 2021 Excellente. Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now