Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GSoC2024] added better error message when video resolution too large #7549

Merged
merged 9 commits into from
Mar 11, 2024
7 changes: 7 additions & 0 deletions cvat/apps/engine/media_extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ def __init__(self, quality=67):
quality = round(51 * (100 - quality) / 99)
super().__init__(quality)
self._output_fps = 25
self.MAX_MBS_PER_FRAME = 36864
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved
try:
codec = av.codec.Codec('libopenh264', 'w')
self._codec_name = codec.name
Expand All @@ -752,6 +753,12 @@ def _add_video_stream(self, container, w, h, rate, options):
if w % 2:
w += 1

# x264 has 4K limitations,https://github.com/opencv/cvat/issues/7425
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved
if h * w > (self.MAX_MBS_PER_FRAME << 8):
raise Exception(
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved
'Video size is more than what can be supported, refer https://github.com/opencv/cvat/issues/7425'
Viditagarwal7479 marked this conversation as resolved.
Show resolved Hide resolved
)

video_stream = container.add_stream(self._codec_name, rate=rate)
video_stream.pix_fmt = "yuv420p"
video_stream.width = w
Expand Down
Loading