I have videos I want to split across multiple screens, so the solution I've found so far is to just crop the input video 4 times with ffmpeg (is this optimal? Is there some other way so I only need to use one command?)

Anyways, in ffmpeg crop is a video filter, and it seems that I can't specify the video codec as copy when using a video filter. Why is this the case? It seems like nothing should change if I just remove some of the video. I should be perfectly capable of just copying the same video over, with just part of it removed.

Is there any way for me to do a crop in ffmpeg without having to do a re-encode? The extra encoding time makes my processing times really long and the new bitrates caused by the re-encode makes the video parts out of sync and unable to be played properly.

Thanks

up vote 10 down vote accepted

A videofilter in ffmpeg always has to modify pixel information hence the reason why you need to re-encode. It seems logical at first that you wouldn't have to do this when cropping but the way lossy video codecs work makes this pretty impossible without re-encoding everything. They usually don't see an array of pixel information but a much more complex representation of pixel blobs that are described in a way that takes up less space than the original pixel blob, you can't really "crop" that encoding, to do a crop you would first need to decode the information to know what you are dealing with but then you need to re-encode to have it compressed again. Thats the main stepping stone. Then they also use things like motion estimation that depends on information before and after certain frames, if that information changes all of the sudden the whole thing is screwed up and you end up with tons of artifacts when decoding the video during playback.

tldr; no its not possible to crop without re-encoding in any tool.

Unless you deal with some very specific lossless non-consumer intermediate codecs that would enable it but in that case transcoding wouldn't be an issue.

  • 1
    Interesting bit of trivia: the way QuickTime movies work (.mov, at least pre-QuickTime X) actually did let you define and store crop, resize, minor edits, and even masks as metadata alongside the video stream; the player would just apply them on the fly. – NReilingh Oct 5 '14 at 22:26
  • 1
    Interesting feature but sounds like a feature that probably has caused a lot confusions when a small resolution video is taking up huge amount of space because it was heavily cropped and you don't know why. – PTS Oct 6 '14 at 12:12
  • 1
    The only thing I would add is that some formats might support splitting along group of pixel boundaries, but this would only work in very specific formats using particular settings, so there is a slight caveat, but effectively, it isn't possible in most cases and isn't worth doing in most of the situations where it might even be technically possible. – AJ Henderson Oct 6 '14 at 14:21
  • True that might be a workaround but probably very hard to actually implement practiacally. – PTS Oct 6 '14 at 14:28

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.