Coder Social home page Coder Social logo

videoprocesswithmetal's People

Contributors

tomisacat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

videoprocesswithmetal's Issues

[Need Help] BlurredMotion Filter Enhancement

I am using your code for motion blur effect via Metalkit, which works well, but now I want to create a filter as shown in the below video and I have modified a code also but it doesn't work as expected, so can you pls help?

How Filter I want?

https://drive.google.com/file/d/1oEcC0DMOfvuW9pkLBPZhJmgMrhaK_Jcp/view?usp=sharing

Code:

kernel void blurredMotion(texture2d<float, access::read> inTexture [[ texture(0) ]],
                          texture2d<float, access::write> outTexture [[ texture(1) ]],
                          texture2d<float, access::read> lastTexture [[ texture(2) ]],
                          device const float *time [[ buffer(0) ]],
                          uint2 gid [[ thread_position_in_grid ]])
{
    float width = inTexture.get_width();
    float height = inTexture.get_height();
    float2 uv = float2(gid) / float2(width, height);
    
    float4 buf = lastTexture.read(gid);
    float4 bri = inTexture.read(gid);

    float3 grayScaleColor = float3(1.0, 0.0, 0.0);
    float myGrayScale = dot(bri.rgb, grayScaleColor);

    float diff = ((bri.r - buf.r) + (bri.g - buf.g) + (bri.b - buf.b)) / 3;
    
    float colR = inTexture.read(uint2(uv.x + diff, uv.y)).r * (1.0 - diff);
    float colG = inTexture.read(uint2(uv.x - diff, uv.y)).r * (1.0 - diff);
    float colB = inTexture.read(uint2(uv.x - diff, uv.y)).r * (1.0 - diff);
    
    float scanline = abs(cos(uv.y * 500.));
    scanline = smoothstep(0.0, 2.0, scanline);
    float3 col = float3(1.0,0.0,0.0);
    col -= (0.1 * scanline);
    
    float3 blendColor = float3(colR, colG, colB) - (0.1 * scanline);
    
    outTexture.write(float4(blendColor, 1.0), gid);
}

Can you pls help what I am missing here to achieve that?

A problem in attributes for AVPlayerItemVideoOutput in LocalFileViewController

in this declaration
when I make this code as it is


   lazy var playerItemVideoOutput: AVPlayerItemVideoOutput = {
        let attributes = [kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_32BGRA)]
        return AVPlayerItemVideoOutput(pixelBufferAttributes: attributes)
    }()

nothing is showin on the screen
I think It doesn't know how to make a texture from the CVPixelbuffer

but when I pass nil to the constructor

   lazy var playerItemVideoOutput: AVPlayerItemVideoOutput = {
        let attributes = [kCVPixelBufferPixelFormatTypeKey as String: Int(kCVPixelFormatType_32BGRA)]
        return AVPlayerItemVideoOutput(pixelBufferAttributes: nil)
    }()

it show like this

https://i.imgur.com/iWqu592.png
alt text

any help
@tomisacat

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.