PyAV
PyAV copied to clipboard
Add rate and framerate properties to VideoStream (fixes: #1005)
Fixes the regression introduced by #910
This PR fixes the issue by adding properties that point directly to the underlying AVStream's avg_frame_rate. It doesn't set the rate on the new codec_context, but that doesn't appear to be necessary.
I'm having another look at this, and I'm really confused. We already have Stream.average_rate, which does the exact same thing but with a more explicit name. Why do we need two additional accessors?
If the only reason is due to the historic confusion between stream and codec_context properties I'd actually favor going in the opposite direction and make both Stream.__getattr__ and Stream.__setattr__ raise an AttributeError for rate and framerate.
PyAV 10.0 is going to have some breaking changes, might as well start cleaning up..
I see your point and that makes sense. We should just probably remove these accessors, but we should be explicit that it is a breaking change.
I guess a follow on question is what to do with AudioStream.
The actual rate field for an audio stream is stored in sample_rate of the AVCodecParameters. We should probably get rid of the rate passthrough and enforce sample_rate since it is a more explicit name as well.
Closing in favour of #1036