Fix Green/Distorted Webcam Image on Linux

Linux & Unix Intermediate 👁 15 views 📅 Jun 16, 2026

Green or distorted webcam feed on Linux? Usually a bad UVC driver or missing correct color format. Quick fix: override format with v4l2-ctl.

Quick answer: Run v4l2-ctl --list-formats-ext, note the preferred format (usually YUYV or MJPG), then force it with v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=YUYV before opening your app.

If you're reading this, you've probably already tried restarting your webcam app, unplugging the camera, or even reinstalling drivers. Nothing worked. The feed is either solid green, rainbow static, or looks like a corrupted JPEG. I've been there — it's especially common on Logitech C920/C922, Microsoft LifeCam, and many cheap USB cameras after a kernel update or when switching distros.

The root cause? The default UVC (USB Video Class) driver sometimes negotiates a color format your camera doesn't actually support, or it picks a resolution the camera can't handle at that format. The kernel module uvcvideo handles this, and it's usually fine — but when it's not, you get garbage output.

Step 1: Check Your Camera's Supported Formats

First, install v4l-utils if you haven't already:

sudo apt install v4l-utils   # Debian/Ubuntu
sudo dnf install v4l-utils   # Fedora

Then list your camera's capabilities:

v4l2-ctl --list-devices

This shows your camera's device path (usually /dev/video0). Now check its formats:

v4l2-ctl -d /dev/video0 --list-formats-ext

You'll see something like:

Index       : 0
Type        : Video Capture
Pixel Format: 'YUYV'
Name        : YUYV 4:2:2
    Size: Discrete 1920x1080
        Interval: Discrete 0.033s (30.000 fps)
    Size: Discrete 1280x720
        Interval: Discrete 0.033s (30.000 fps)
Index       : 1
Type        : Video Capture
Pixel Format: 'MJPG' (compressed)
Name        : Motion-JPEG
    ...

The key is the Pixel Format field. Common ones are YUYV, MJPG, NV12, and RGB3. If your camera supports multiple, note them all.

Step 2: Force a Working Format

The green/distortion usually happens when the driver picks MJPG (compressed) format but the app expects YUYV, or vice versa. Let's force a known good combination. Start with YUYV — it's uncompressed and universally supported:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=YUYV

Now open your webcam app (Cheese, guvcview, or just ffplay /dev/video0). If the image is clear, you've found the fix. If still green, try MJPG:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=MJPG

If neither works, try a lower resolution — 640x480 is a safe bet:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=640,height=480,pixelformat=YUYV

Step 3: Persist the Fix (So You Don't Have to Rerun Every Time)

Unfortunately, v4l2-ctl settings reset every time you unplug the camera or reboot. To make them stick, you can create a udev rule. Create a file like /etc/udev/rules.d/99-webcam-fix.rules:

SUBSYSTEM=="video4linux", ATTR{name}=="Your Camera Name", RUN+="/usr/bin/v4l2-ctl -d $devnode --set-fmt-video=width=1280,height=720,pixelformat=YUYV"

Replace "Your Camera Name" with the exact name from v4l2-ctl --list-devices. Then reload udev:

sudo udevadm control --reload-rules
sudo udevadm trigger

Test by unplugging and replugging the camera.

Alternative Fixes (If the Above Doesn't Work)

1. Disable autofocus and autoexposure

Sometimes the green tint comes from the camera's auto-white balance going haywire. Use v4l2-ctl to set manual controls:

v4l2-ctl -d /dev/video0 --set-ctrl=white_balance_automatic=0
v4l2-ctl -d /dev/video0 --set-ctrl=exposure_auto=1

2. Use a different app

Cheese is notoriously flaky with format negotiation. Try guvcview — it shows you exactly what format it's using and lets you override it in the GUI. Install it with:

sudo apt install guvcview   # or dnf install guvcview

Open it, go to "Image Controls" or "Format" tab, and pick a different format/resolution.

3. Blacklist and reload the uvcvideo module

If your camera is detected but still broken, the kernel module might need a kick. Unload it, then reload with a debug parameter:

sudo modprobe -r uvcvideo
sudo modprobe uvcvideo quirks=0x100

The quirks=0x100 flag disables frame buffering, which helps some webcams. Check dmesg after reloading — you'll see if the driver picked up the right format.

4. Update or downgrade the kernel

I've seen this happen after a kernel update from 5.15 to 6.2 on Ubuntu 22.04. The uvcvideo driver changed its default behavior. If you can, boot into an older kernel from GRUB and test. If that works, consider sticking with that kernel or filing a bug report.

Prevention Tip

Once you've got a working format, note it down. I keep a text file in ~/webcam-fix.txt with the exact v4l2-ctl command and udev rule. Kernel updates won't always break things, but when they do, you'll have your fix ready in 30 seconds instead of 30 minutes.

Also, avoid plugging the webcam into USB 3.0 hubs — some cameras are picky. A direct USB 2.0 port is more reliable.

If you're still stuck, check dmesg | grep uvcvideo for errors. Post the output on a forum — include your camera model and kernel version. The community's been through this before.

Was this solution helpful?