picamera2 icon indicating copy to clipboard operation
picamera2 copied to clipboard

[BUG] `enable_sps_framerate` parameter only works for hardware encoder

Open mikkelam opened this issue 1 year ago • 3 comments

Please only report one bug per issue!

Describe the bug Cannot include enable_sps_framerate. As this interface is kinda hidden in how it switches, it's not easy for a user to understand this difference.

To Reproduce

FPS = 30
enc = H264Encoder(enable_sps_framerate=True, framerate=FPS)

Expected behaviour A clear and concise description of what you expected to happen.

Console Output, Screenshots

  encoder = H264Encoder(enable_sps_framerate=True, framerate=FPS)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: LibavH264Encoder.__init__() got an unexpected keyword argument 'enable_sps_framerate'

Hardware : rpi4 -> rpi5 is what made me see the problem

Additional context Add any other context about the problem here.

mikkelam avatar Oct 25 '24 15:10 mikkelam

Hi, I can put this on the list of little jobs to do. PRs also welcome!! :)

davidplowman avatar Oct 28 '24 09:10 davidplowman

Hi, I can put this on the list of little jobs to do. PRs also welcome!! :)

I could try. How would you like me to handle it? I cannot see a similar configuration on the pyav side. Should we give a warning or silently accept the flag?

mikkelam avatar Oct 28 '24 10:10 mikkelam

Well, I think there is a "framerate" parameter in the codec context that one could set, and I think that does get reflected in the SPS. Though there might be some confusion about whether libav is talking about frames or fields, I'm not quite sure. But it might even be the right thing to do!!

davidplowman avatar Oct 28 '24 13:10 davidplowman