Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video grabber with profile YUVY not YUYV #7

Open
hawkeyexp opened this issue Jan 30, 2019 · 8 comments
Open

Video grabber with profile YUVY not YUYV #7

hawkeyexp opened this issue Jan 30, 2019 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@hawkeyexp
Copy link

Hi,

i adapted your code for crankshaft (pi based android auto headunit) and noticed a prob with a Syntek STK1160 video bridge:
the request profile is not YUYV - it is YUVY. With a easy copy to test it works with wrong colors.
Can you possible add this profile ?

photo_2019-01-30_19-53-20
pojoe1j3jaiuqkiikpfdpt27oh0omgdf7

If you are interested on our free project:
getcrankshaft.com
github.com/opencardev

Thx, Hawkeye

@jonlowe
Copy link

jonlowe commented Jan 31, 2019

I think this issue may need to be expanded. I'm using a generic EasyCap, with the Empia chipset and a generic NTSC backup camera. (BTW, there are at least 4 different chipsets, STK1160 being one of the others, used in Easycaps, described here: https://www.linuxtv.org/wiki/index.php/Easycap). My EasyCap defaults to Pal output and S-video input, so I get no picture in Cam_overlay at all unless I go into V4L2 settings after each statup and reset things to NTSC and composite input. There are numerous other settings that could be changed also depending on which capture device is used. Unfortunately, there is no way short of a script to reset things at each restart of the RPi using V4l2-ctl. Even the V4l2 capture utility does not carry settings across restarts. This can be done with a startup script, or udev as outlined here: https://askubuntu.com/questions/295637/v4l2-change-default-setting. Raspbian works the same as Ubuntu in this case.

Obviously, this approach is not user friendly. If cam_overlay (or Crankshaft) could read the device options, and allow them to be set
once as persistent settings, this would simplify things greatly. Cam_overlay already has a number of settable options, so it would appear these could be added.

@meekys
Copy link
Owner

meekys commented Feb 2, 2019

Hi @hawkeyexp,
I've been keeping an eye on Crankshaft. The NG screenshots are looking awesome and I'm looking forward to giving it a try when I get some time to tear apart my current setup.

In regards to changing the shader from YUYV to YUVY, this should be relatively straight forwards, but I don't have the hardware to test this.
If I make copy the YUYV shader as you already have and modify the following lines, this may give what you're after.

maxfragp vec4 yuyv = texture2D( texture, uv );

    // Y1, U , V, Y2
    maxfragp vec4 yuyv = texture2D( texture, uv );

    maxfragp vec3 yuv;
    if( fOdd <= 0.5 )
        yuv = yuyv.rgb; // Y1, U, V
    else
        yuv = yuyv.agb; // Y2, U, V

Once it's tested against some real hardware I'm more than happy to commit the shader, or accept a pull request

@meekys
Copy link
Owner

meekys commented Feb 2, 2019

@jonlowe I've created a new issue for your report, as I believe it to be a different issue

@meekys meekys self-assigned this Feb 2, 2019
@meekys meekys added the enhancement New feature or request label Feb 2, 2019
@andreimoraru
Copy link

Hi @meekys ,

Could you please also add the shader for MJPG. My device only supports MJPG pixel format. I would also appreciate any guidance on how to create the shader. Thanks

pi@raspberrypi:~/cam_overlay $ ./cam_overlay.bin
Opened device '/dev/video0'
Dimensions: 640 x 480 Pixel Format: MJPG
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
Opened screen 0 @ 800 x 480
Cannot open 'shader-MJPG.frag': 2, No such file or directory
pi@raspberrypi:~/cam_overlay $ v4l2-ctl --all
Driver Info (not using libv4l2):
        Driver name   : uvcvideo
        Card type     : USB2.0 PC CAMERA
        Bus info      : usb-3f980000.usb-1.5
        Driver version: 4.14.79
        Capabilities  : 0x84200001
                Video Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 640/480
        Pixel Format      : 'MJPG'
        Field             : None
        Bytes per Line    : 0
        Size Image        : 614400
        Colorspace        : Default
        Transfer Function : Default
        YCbCr/HSV Encoding: Default
        Quantization      : Default
        Flags             :
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 640, Height 480
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 640, Height 480
Selection: crop_bounds, Left 0, Top 0, Width 640, Height 480
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 60.000 (60/1)
        Read buffers     : 0
                     brightness (int)    : min=0 max=255 step=1 default=-8193 value=128
                       contrast (int)    : min=0 max=255 step=1 default=57343 value=128
                     saturation (int)    : min=0 max=255 step=1 default=57343 value=70
                            hue (int)    : min=-127 max=127 step=1 default=-8193 value=0
                          gamma (int)    : min=1 max=8 step=1 default=57343 value=4
                           gain (int)    : min=0 max=65535 step=1 default=57343 value=16
           power_line_frequency (menu)   : min=0 max=2 default=1 value=1
                      sharpness (int)    : min=0 max=255 step=1 default=57343 value=3

@meekys meekys mentioned this issue Mar 2, 2019
@Revanas
Copy link

Revanas commented Apr 13, 2019

@hawkeyexp did you have any success on creating the correct shader-UYVY.frag file? I have an easycap with stk1160 so I would be able to test.

@hawkeyexp
Copy link
Author

sorry for late response - have not really tracked it and started a new job on feb which consumed most time...
i can't really test it cause i have no stk1160 currently or a webcam using same profile.

@meekys
Copy link
Owner

meekys commented Jun 8, 2019

Hi @hawkeyexp,
I've added this fix into a new branch (cpp) after a 'bit' of refactoring
https://github.com/meekys/cam_overlay/tree/cpp
Let me know how this goes, if you get a chance to.

@meekys
Copy link
Owner

meekys commented Jun 8, 2019

@Revanas UYVY as opposed to YUVY ? (Yet another variation of the same thing by the looks of it?)

I've added another (untested) shader to support this variation in the cpp branch. It would be much appreciated if you were able to test this just to confirm it's all good.

Cheers,
Meekys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants