Skip to content

[BUG] Unable to record video after installing via apt. #1202

Open
@theslic3

Description

@theslic3

Using:
sudo apt install python3-picam2
to install picam2.

When using functionality such as .start_and_record_video():
from picamera2 import Picamera2
picam2 = Picamera2()
#video_config = picam2.create_video_configuration(main={"size":(1920,1080)})
picam2.start_and_record_video("test.mp4", duration=5)

Kept encountering :
Exception during process_requests()
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/picamera2/previews/null_preview.py", line 85, in handle_request
picam2.process_requests(self)
File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1301, in process_requests
encoder.encode(encoder.name, req)
File "/usr/lib/python3/dist-packages/picamera2/encoders/encoder.py", line 246, in encode
self._encode(stream, request)
File "/usr/lib/python3/dist-packages/picamera2/encoders/libav_h264_encoder.py", line 151, in _encode
frame = av.VideoFrame.from_numpy_buffer(m.array, format=self._av_input_format, width=self.width)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: type object 'av.video.frame.VideoFrame' has no attribute 'from_numpy_buffer'

I realised that ,after checking av version history...
Only reference to VideoFrame.from_numpy_buffer() was in version 14.0.0.
The version of av used when installing picam2 through apt versus pip is: 10.0.0 versus the 14.0.0 version.
When I installed av version 14 through pip, voila, same script worked.

Hardware :
Pi CM5,
AI Camera

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions