News:

--

Main Menu

Crop *without* quality loss

Started by enthousiast, August 08, 2020, 08:45:07 PM

Previous topic - Next topic

enthousiast

Hi!

Don't know if what I m about to ask can be done already - or even if it doesn't make sense in video. But there it goes anyway!

I want to crop a video file. It's shot in 4K (super35 format) using a Sony a6300. More details regarding the codec:
Video: MPEG4 Video (H264) 3840x2160 25fps 83697kbps [V: Video Media Handler (h264 high L5.1, yuv420p, 3840x2160, 83697 kb/s)]
Audio: QT PCM 48000Hz stereo 1536kbps [A: Sound Media Handler (pcm_s16be, 48000 Hz, 2 channels, s16, 1536 kb/s)]

If I do a crop, it seems I ll have to chose a codec. It looks that 'closest' match to what is outputed by my camera is the "Mpeg4AVC (x264)" (there's also Nvidia H264...)
If I chose any codec however, the output stream will be re-compressed using that codec/settings - which ultimately means loss of quality in the end result.
So, my question is: is there a way to construct the cropped video without it being recompressed?

For image processing e.g. in GIMP, when you edit a JPEG and wish to export the processed file, you get an option "use quality settings from original". Which allows you to save without that quality loss (as it uses the original profile). Does the same concept can also be applied here, for video, when cropped?

eumagga0x2a

Some containers like MKV support specifying crop metadata (not supported by Avidemux), i.e. the video remains unmodified, but the player is advised to output only a part of the picture.

There are fundamentally lossless codecs (e.g. HuffYUV) and also lossless presets for fundamentally lossy codecs like H.264 or VP9. Neither is practicable, either due to huge output file size, due to very slow operation or both.

Any modification of the picture = recompression required = quality loss if the compression is lossy.

"Use quality settings from the original" = keep quality loss the same as during creation of the current source, multiplying each generation.

enthousiast

I was afraid that would be the case.

"video remains unmodified, but the player is advised to output only a part of the picture" >>> that's no good anyway, because the whole point a cropping in certain cases is to also save some disk space

lossless codecs are also N/A due to enormous size

Thanks for the update (even if it was bad news as expected)

matter

I'm not getting how removing data as in the case of cropping has to increase the file size because isn't cropping just saying, get rid of pixels in such-and-such coordinate range and leave the rest as they are? Figuratively like deleting rows and columns in a spreadsheet. It would seem that cropping is *not* like, say, increasing contrast or rotating a video, where each pixel has to be recalculated. Can anyone explain what I'm missing and why the parts that are remaining unaltered have to be recalculated?

sark

#4
Quote from: matter on July 06, 2023, 07:32:57 AMI'm not getting how removing data as in the case of cropping has to increase the file size
It doesn't. Though a lossless codec is likely to increase the file size (assuming original isn't lossless). Bitrate, or the quality setting dictate file size. An increase or not, would depend on the original bitrate, or quality settings.

Quote from: matter on July 06, 2023, 07:32:57 AMIt would seem that cropping is *not* like, say, increasing contrast or rotating a video, where each pixel has to be recalculated. Can anyone explain what I'm missing and why the parts that are remaining unaltered have to be recalculated?
The moment you re-encode, you are recalculating pixels. With a lossless codec there will always be some loss, whether visually noticeable, or not.