1
$\begingroup$

This question is about the bitstream of modern lossy compression codecs such as H.264. I am not asking whether a tool for losslessly cropping videos exists. Since this site has people familiar with video encoding, I hope it is the right place to ask.

Since popular video codecs encode using blocks, would it be possible to crop a video on a block boundary and discard the superfluous blocks? This has always been possible in JPEG, with tools like jpegtran able to create a new jpeg without reencoding the image, since the blocks are independent from each other.

Is this also the case with a codec like H.264, or is there prediction happening between blocks in different locations? Given that H.264 has the concept of "slices" that contain many blocks, and is the smallest unit that can be decoded, I assume that there is some sort of dependency between blocks in a slice. However the introductions to the H.264 bitstream that I've been reading don't explain further.

$\endgroup$

1 Answer 1

2
$\begingroup$

As these video encoders, such as H.264, use motion estimation for regions in P-frames and B-frames [1], you can easily imagine a scenario where a block is detected to move within the original frame of the video, but would have to move from outside the crop to the inside in your desired cropped version. You would have to backtrack necessary information and potentially keep full-size I-frames in your stream. This however, would not be much different from just cropping on-the-fly. Thus I do not see a non-recoding way of cropping a compressed video.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.