Replies: 1 comment 2 replies
-
Hi. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I would like to suggest a strategy for fast, lossless cropping
Unfortunately, this method would not be codec agnostic, but hopefully the code would me mostly reusable across different codecs
First, UI element, right now we specify start and stop frames.
To specify a crop, the stop and start frame would need to define the corners of a rectangle
How the method works
Video files are made out of quantization blocks that represent parts of the screen.
The strategy is, for each block, detect if they are inside or outside the crop region.
And then zero these blocks out.
Do this for keyframes and and inter frames.
This would preserve the video without a re-encode
And it should very very fast to do.
There would be some defects
When movement from outside the crop zone goes into the crop zone, would smear zeroes (blackness) onto the video.
I don't believe this would be much of a problem as large movement would trigger a new keyframe.
Another strategy would be to define two crop zone, inner and outer.
The outer zone would keep blocks that are going to move into the inner zone in the frame between now and the next keyframe.
This would increase the processing time quite a bit however so don't get hung up on this.
I think just trying to make the crop work by just blacking out region outside the crop zone would be very useful as a fast, no re-compress, rough cropping tool
Beta Was this translation helpful? Give feedback.
All reactions