picamera2
picamera2 copied to clipboard
[BUG] start_and_record_video() ignores quality argument when calling start_encoder()
Describe the bug
When using start_and_record_video()
the quality
argument is ignored when the function calls start_encoder()
.
The function is called in picamera2.py line 1904:
self.start_encoder(encoder, output, quality)
But the signature of that method is:
def start_encoder(self, encoder=None, output=None, pts=None, quality=None, name=None)
You can hopefully see the problem, start_and_record_video
is calling the method with positional arguments, even though quality
is not the third argument. Probably the fix is very simple, use keyword arguments at least for quality
.
# picamera2.py line 1904
self.start_encoder(encoder=encoder, output=output, quality=quality)
To Reproduce
Set a breakpoint within start_encoder()
in order to view the values of the parameters.
from picamera2 import Picamera2 from picamera2.encoders import Quality picam2 = Picamera2() picam2.start_and_record_video('test.mp4', duration=5, quality=Quality.VERY_HIGH)
Expected behaviour I expect the start_encoder() function to be called with the selected quality.
Console Output, Screenshots Setting a breakpoint within start_encoder() shows the values of the passed parameters
output = {str} 'test.mp4'
pts = {Quality} <Quality.VERY_HIGH: 4>
quality = {NoneType} None
You can see that the pts
argument contains the quality value, and quality
is None
.