Skip to content

[Linux] Logitech C270 camera solid black output #3828

Closed
@itlancer

Description

@itlancer

Problem Description

Logitech C270 camera usage with with Linux devices cause solid black output instead of camera view.

Tested with latest AIR 51.2.1.4 with multiple different devices, OS versions (Ubuntu 22/24 LTS x86_64) with different applications.
The same issue in all cases.
There is no such issue with the same environment using ffmpeg, Cheese, browser and other non-AIR applications.
There is no such issues with other platforms with the same camera.

Using ffmpeg/ffplay all works fine:

ffmpeg -f v4l2 -list_formats all -i /dev/video0
[video4linux2,v4l2 @ 0x587447b73380] Raw       :     yuyv422 :           YUYV 4:2:2 : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360 752x416 800x448 800x600 864x480 960x544 960x720 1024x576 1184x656 1280x720 1280x960
[video4linux2,v4l2 @ 0x587447b73380] Compressed:       mjpeg :          Motion-JPEG : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360 752x416 800x448 800x600 864x480 960x544 960x720 1024x576 1184x656 1280x720 1280x960
[in#0 @ 0x587447b73280] Error opening input: Immediate exit requested
Error opening input file /dev/video0.
ffplay -f v4l2 -input_format mjpeg -framerate 30 -video_size 1280x960 -i /dev/video0
[mjpeg @ 0x77f25c001980] unable to decode APP fields: Invalid data found when processing input
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 781.793346, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1280x960, 30 fps, 30 tbr, 1000k tbn
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[swscaler @ 0x77f25401d080] deprecated pixel format used, make sure you did set range correctly
    Last message repeated 2 times
[swscaler @ 0x77f25401d080] deprecated pixel format used, make sure you did set range correctly
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
    Last message repeated 2 times
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
    Last message repeated 1 times
[mjpeg @ 0x77f25c0025c0] unable to decode APP fields: Invalid data found when processing input
ffplay -f v4l2 -input_format yuyv422 -framerate 30 -video_size 1280x960 -i /dev/video0
[video4linux2,v4l2 @ 0x76fa70000c80] The driver changed the time per frame from 1/30 to 2/15
Input #0, video4linux2,v4l2, from '/dev/video0':B sq=    0B f=0/0   
  Duration: N/A, start: 815.580923, bitrate: 147456 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x960, 147456 kb/s, 7.50 fps, 7.50 tbr, 1000k tbn
 817.91 M-V:  0.000 fd=   0 aq=    0KB vq=16800KB sq=    0B f=0/0 

Related issues:
#3822
#2699
#2693
#2691
#2687
#1992
#1980
#1895
#1802
#906

Steps to Reproduce

Launch application with code below with Linux device with connected Logitech C270 camera.

Application example with sources and Scout log attached.
linux_logitech270_camera_bug.zip

package {
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.media.Camera;
	import flash.media.Video;
	import flash.events.PermissionEvent;
	import flash.permissions.PermissionManager;
	import flash.permissions.PermissionStatus;
	
	public class LinuxCameraHighFPSBbug extends Sprite {
		private var cam:Camera;
		private var vid:Video = new Video();
		
		public function LinuxCameraHighFPSBbug() {
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event):void {
			removeEventListener(Event.ADDED_TO_STAGE, init);
			
			var cameraPermissionManager:PermissionManager = Camera.permissionManager;
			if (cameraPermissionManager.permissionStatus != PermissionStatus.GRANTED){
				Camera.permissionManager.addEventListener(PermissionEvent.PERMISSION_STATUS, permissionChanged);
				Camera.permissionManager.requestPermission();
			} else {
				startApp();
			}
		}
	
		private function permissionChanged(e:PermissionEvent):void {
			trace("permissionChanged", Camera.permissionManager.permissionStatus);
			startApp();
		}
	
		private function startApp(e:MouseEvent = null):void {
			cam = Camera.getCamera();
			cam.setMode(1920, 1080, 60);
			vid.width = cam.width;
			vid.height = cam.height;
			vid.attachCamera(cam);
			addChild(vid);
			trace(cam.width, cam.height, cam.fps, cam.name);
			
			stage.addEventListener(MouseEvent.CLICK, startApp);
		}
		
	}
}

Actual Result:
In traces you will see:
1280 720 30 UVC Camera (046d:0825) (V4L2)
No errors. Black image instead of camera view.

Expected Result:
Correct image of camera view.

Known Workarounds

none
*write your own native extension to use camera

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions