Open 03vmate opened 2 months ago
Hi, thanks for reporting this. Yes, it does indeed seem to be broken.
The problem is that the value of V4L2_MPEG_VIDEO_H264_PROFILE_HIGH
is incorrect in the python-v4l2 package. I'll make up a PR and ask the repository owner to merge the fix. Then we'll have to make up an updated package, so it may all take a few days.
If you want a fix in the meantime, I might check out git clone https://github.com/RaspberryPiFoundation/python-v4l2
and then add the folder where you put it to your PYTHONPATH
environment variable. Then, look in the file v4l2.py
in there, and find V4L2_MPEG_VIDEO_H264_PROFILE_HIGH
. Just above that add the following new line:
V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED,
Also change the range(4)
below it to range(5)
. Then things should work.
@davidplowman Thanks for the workaround, one semi-related question: I was not able to find anything about the "default" profile when not specifying the profile
parameter. What does it default to?
Haha, good question. It seems to leave it entirely to the hardware driver which, I think, sets it to... (drum roll)
High! So it looks like leaving it out altogether would also be a workaround. Obviously would be worth checking in practice. Oh well.
The patch has also been merged now, so just waiting for a new apt package to be made up. (You could install it with pip too, but mixing pip and apt packages often seems to lead me to a dark place.)
Trying to set profile="high" for H264Encoder causes the following:
baseline
andmain
work properly, onlyhigh
causes the exception.Example code :
Using Pi4 with HQ camera, Python 3.11.2, picamera2 0.3.19, libcamera v0.3.0+65-6ddd79b5, Linux 6.6.31+rpt-rpi-v8