ERROR opening V4L interface: Operation not permitted

11,928

If /dev/video0 is owned by root video (check with ls -l /dev/video0), add yourself to the video group with usermod -aG video your_username, log out, log in, try again. (You'll likely need to be root or prefix with sudo to add yourself to the group.)

If you still get 'Operation not permitted', ensure you have set gpu_mem=128 in /boot/config.txt. It was set at 64 by default for me (on Arch Linux ARM), but increasing it to 128 did the trick.

My /etc/modules-load.d/raspberrypi.conf looks like this to get the v4l2 module loaded at boot:

snd-bcm2835
i2c-dev
bcm2835-v42l2

Tested and verified on a Pi 1 B+, and a Pi 3, both running ALARM.

Share:
11,928
Zezhou Li
Author by

Zezhou Li

Currently Master student of Electrical Engineering at Stevens Institute of Technology, focused on Machine Learning. Actively looking for full-time job in Machine Learning field.

Updated on June 05, 2022

Comments

  • Zezhou Li
    Zezhou Li almost 2 years

    I compiled mjpg-streamer in my raspberry pi, but when I run the below command, it occured an eeror shown in the title. Details are below:

    root@raspberrypi:/home/pi/mjpg-streamer-code-182/mjpg-streamer# /usr/local/bin/mjpg_streamer -i "/usr/local/lib/input_uvc.so" -o "/usr/local/lib/output_http.so -w /usr/local/www"
    

    Results:

    MJPG Streamer Version: svn rev: 
    i: Using V4L2 device.: /dev/video0
    i: Desired Resolution: 640 x 480
    i: Frames Per Second.: 5
    i: Format............: MJPEG
    ERROR opening V4L interface: Operation not permitted
    Init v4L2 failed !! exit fatal 
    i: init_VideoIn failed
    

    How can I get permitted to operate my v4l2?