airsdk / Adobe-Runtime-Support

Report, track and discuss issues in Adobe AIR. Monitored by Adobe - and HARMAN - and maintained by the AIR community.
206 stars 11 forks source link

[Linux] `Camera` cannot use high resolution with high FPS #3426

Open itlancer opened 2 months ago

itlancer commented 2 months ago

Problem Description

Camera cannot use high resolution with high FPS for Linux platform. May be AIR doesn't work with MJPEG mode and use YUV limited mode. It cause that AIR cannot be used for real tasks right now if you need camera usage for Linux.

Tested with latest AIR 51.1.1.3 with multiple different Linux x86_64 devices (Ubuntu and Debian), different OS versions, cameras and different applications. Same issue in all cases. There is no such issue using non-AIR applications. There is no such issue with the same devices and cameras but with Windows OS.

Tested with Logitech C270 HD webcam, Prestigio Windows Hello FullHD Camera and many others. For FullHD cameras ffmpeg -f v4l2 -list_formats all -i /dev/video0 returns:

[video4linux2,v4l2 @ 0x55b262f57e00] Compressed:       mjpeg :          Motion-JPEG : 1920x1080 320x180 320x240 424x240 640x360 640x480 848x480 960x540 1280x720
[video4linux2,v4l2 @ 0x55b262f57e00] Raw       :     yuyv422 :           YUYV 4:2:2 : 640x480 320x180 320x240 424x240 640x360 848x480 960x540 1280x720 1920x1080

And you can use: ffplay -f v4l2 -input_format mjpeg -framerate 30 -video_size 1920x1080 -i /dev/video0 to test it with non-AIR apps:

Input #0, video4linux2,v4l2, from '/dev/video0':B sq=    0B f=0/0   
  Duration: N/A, start: 84821.132041, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 1000k tbn

Related issues: https://github.com/airsdk/Adobe-Runtime-Support/issues/2699 https://github.com/airsdk/Adobe-Runtime-Support/issues/2693 https://github.com/airsdk/Adobe-Runtime-Support/issues/2691 https://github.com/airsdk/Adobe-Runtime-Support/issues/2687 https://github.com/airsdk/Adobe-Runtime-Support/issues/2018 https://github.com/airsdk/Adobe-Runtime-Support/issues/1980 https://github.com/airsdk/Adobe-Runtime-Support/issues/1895 https://github.com/airsdk/Adobe-Runtime-Support/issues/1802 https://github.com/airsdk/Adobe-Runtime-Support/issues/906

Steps to Reproduce

Launch application with code below with any Linux device with connected FullHD (or even HD) camera. It will try to start camera output with 1920x1080@30 mode.

Application example with sources attached. linux_camera_high_fps_bug.zip

package {
    import flash.display.Sprite;
    import flash.media.Camera;
    import flash.media.Video;

    public class LinuxCameraHighFPSBbug extends Sprite {
        private var cam:Camera;

        public function LinuxCameraHighFPSBbug() {
            cam = Camera.getCamera();
            cam.setMode(1920, 1080, 30);
            const vid:Video = new Video();
            vid.width = cam.width;
            vid.height = cam.height;
            vid.attachCamera(cam);
            addChild(vid);
            trace(cam.width, cam.height, cam.fps);
        }
    }
}

Actual Result: In traces you will see: 1920, 1080, 30 But actually (by eye and events) it looks and works like ~5 FPS. Also camera output has incorrect color profile. Colors little different when you use the same example and camera for Windows. Absolutely the same situation when you try to use 720p mode with high FPS.

Expected Result: AIR application use 1920x1080@30 mode.

Known Workarounds

none May be write native extension to use camera.

itlancer commented 1 month ago

Issue still exists with latest AIR 51.1.1.5.