Coder Social home page Coder Social logo

Comments (7)

kristopherjohnson avatar kristopherjohnson commented on July 17, 2024

It looks like this change might fix the problem with processing of yuvj420p:

- (BOOL) setupVideoFrameFormat: (KxVideoFrameFormat) format
{
    if (format == KxVideoFrameFormatYUV &&
        _videoCodecCtx &&
        (_videoCodecCtx->pix_fmt == AV_PIX_FMT_YUV420P || _videoCodecCtx->pix_fmt == AV_PIX_FMT_YUVJ420P)) {

        _videoFrameFormat = KxVideoFrameFormatYUV;
        return YES;
    }

    _videoFrameFormat = KxVideoFrameFormatRGB;
    return _videoFrameFormat == format;
}

Unfortunately, the sample still doesn't work with the Axis camera, but that is apparently due to a framerate issue. frame.duration gets set to zero (because av_frame_get_pkt_duration() always returns zero)), so the app thinks time does not pass and never renders a frame. If I hack it to force it to render a frame when a frame is available, then that frame is displayed properly, so I think the YUV frame decoding is working. Now I just have to figure out the framerate timing.

from kxmovie.

kolyvan avatar kolyvan commented on July 17, 2024

Hi,

Take a look at new branch juvj420p https://github.com/kolyvan/kxmovie/tree/yuvj420p
I added a fix for zero-length frames like you got from web-camera.
And also there is your fix for yuvj420p streams from comment above.

Best wishes.

from kxmovie.

kristopherjohnson avatar kristopherjohnson commented on July 17, 2024

Thanks! That's working pretty well.

My only complaint is that the video displays for a few seconds at a time, then the spinning wheel appears for a couple of seconds while the HUD says "buffering", and then the video displays again, and this cycle keeps going. I'll look at the code, and also check whether the camera is actually generating a continuous stream, but do you know an easy way to get a continuous display without the buffering pauses?

from kxmovie.

itkingdom avatar itkingdom commented on July 17, 2024

The buffering issues are also happened while I'm trying 1080p stream. I think we need a new way to handle buffer ^^

from kxmovie.

kolyvan avatar kolyvan commented on July 17, 2024

See commit bc398e2
I added ability to completely disable buffering via setting KxMovieParameterMinBufferedDuration parameter to zero.

parameters[KxMovieParameterMinBufferedDuration] = @(0.0f);

For testing, uncomment line 212 in KxMovieExample/MainViewController.m and play your rtsp stream.

from kxmovie.

kristopherjohnson avatar kristopherjohnson commented on July 17, 2024

That's working perfectly.

Thank you for all your assistance.

from kxmovie.

kolyvan avatar kolyvan commented on July 17, 2024

Thank you for your contribution in project.
I merged branch yuvj420p into master.

from kxmovie.

Related Issues (20)

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.