gpt4 book ai didi

ubuntu - Gstreamer 管道仅适用于 sudo

转载 作者:行者123 更新时间:2023-12-04 18:31:19 33 4
gpt4 key购买 nike

我在 headless Ubuntu 20.04 LTS 上运行以下 Gstreamer 管道:

gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480,framerate=30/1 ! vpuenc_h264 bitrate=500 ! avimux ! filesink location='vid.avi'
当我使用 sudo在此之前,相机开始成功录制视频。但是,如果没有`sudo,我会收到以下错误:
====== VPUENC: 4.5.5 build on Aug  4 2020 21:46:19. ======    wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Aug  4 2020 21:45:37)    vpulib: 1.1.1    firmware: 1.1.1.436900:00:00.054172250  1474 0xaaaac8897000 ERROR                default gstallocatorphymem.c:149:base_alloc: Allocate phymem 4194320 failed.0:00:00.054212750  1474 0xaaaac8897000 ERROR                default gstvpu.c:90:gst_vpu_allocate_internal_mem: Could not allocate memory using VPU allocator0:00:00.054236000  1474 0xaaaac8897000 ERROR                 vpuenc gstvpuenc.c:543:gst_vpu_enc_start:<vpuenc_h264-0> gst_vpu_allocate_internal_mem fail0:00:00.054260875  1474 0xaaaac8897000 WARN            videoencoder gstvideoencoder.c:1643:gst_video_encoder_change_state:<vpuenc_h264-0> error: Failed to start encoder0:00:00.054321250  1474 0xaaaac8897000 INFO        GST_ERROR_SYSTEM gstelement.c:2140:gst_element_message_full_with_details:<vpuenc_h264-0> posting message: Could not initialize supporting library.0:00:00.054391000  1474 0xaaaac8897000 INFO        GST_ERROR_SYSTEM gstelement.c:2167:gst_element_message_full_with_details:<vpuenc_h264-0> posted error message: Could not initialize supporting library.0:00:00.054416250  1474 0xaaaac8897000 INFO              GST_STATES gstelement.c:2960:gst_element_change_state:<vpuenc_h264-0> have FAILURE change_state return0:00:00.054438375  1474 0xaaaac8897000 INFO              GST_STATES gstelement.c:2547:gst_element_abort_state:<vpuenc_h264-0> aborting state from READY to PAUSED0:00:00.054464625  1474 0xaaaac8897000 INFO              GST_STATES gstbin.c:2968:gst_bin_change_state_func:<pipeline0> child 'vpuenc_h264-0' failed to go to state 3(PAUSED)

I inspected the plugins using gst-inspect-1.0 | grep -i vpu and I got the following:

vpu:  vpuenc_h264: IMX VPU-based AVC/H264 video encoder
vpu: vpuenc_vp8: IMX VPU-based VP8 video encoder
vpu: vpudec: IMX VPU-based video decoder
没有 sudo 是否可以做到这一点? ?

最佳答案

发生这种情况的原因是 VPU 设备归 root 所有。
我将当前用户添加到一个新组并将VPU设备的组更改为新组,然后更改该组的读写权限。

# change the VPU devices group to a group called video
sudo chgrp video /dev/mxc_*
sudo chgrp video /dev/ion
# grant read and write permissions to the group
sudo chmod 660 /dev/mxc_*
sudo chmod 660 /dev/ion

关于ubuntu - Gstreamer 管道仅适用于 sudo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65618288/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com