PyAV
PyAV copied to clipboard
Allow bits_per_coded_sample to codec context.
Overview
Add the option to set bits_per_coded_sample on the codec context.
import av
codec = av.codec.Codec("qtrle", "r").create()
p = av.Packet()
codec.decode(p)
Results in:
Unsupported colorspace: 0 bits/sample?
---------------------------------------------------------------------------
InvalidDataError Traceback (most recent call last)
Cell In[4], line 1
----> 1 codec.decode(p)
File av/codec/context.pyx:509, in av.codec.context.CodecContext.decode()
File av/codec/context.pyx:521, in av.codec.context.CodecContext.decode()
File av/codec/context.pyx:291, in av.codec.context.CodecContext.open()
File av/error.pyx:336, in av.error.err_check()
InvalidDataError: [Errno 1094995529] Invalid data found when processing input; last error log: [qtrle] Unsupported colorspace: 0 bits/sample?
Desired Behavior
codec = av.codec.Codec("qtrle", "r").create()
codec.bits_per_coded_sample = 24
Example API
codec = av.codec.Codec("qtrle", "r").create()
codec.width = 200
codec.height = 200
codec.bits_per_coded_sample = 24
Additional context
For QuickTime VR movies I want to decode single frames.
This works for RPZA which needs the width and height of a frame.
As shown in https://github.com/PyAV-Org/PyAV/issues/1161#issuecomment-1712562068
The QTRLE decoder also needs to the bits_per_coded_sample. Which is here in the ffmpeg code:
https://github.com/FFmpeg/FFmpeg/blob/5f8c113b75de9c2a7f49e337cd332abbf8adbb6e/libavcodec/qtrle.c#L409
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.