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

adapting to live stream using LFLiveKit #1

Open
sgallo0692 opened this issue Nov 12, 2020 · 2 comments
Open

adapting to live stream using LFLiveKit #1

sgallo0692 opened this issue Nov 12, 2020 · 2 comments

Comments

@sgallo0692
Copy link

your project is the best I can find for implementing CVPixelBuffer and FPV extensions. I'm trying to use LFLiveKit to pass the CVPixelBuffer along to an RTMP destination. In your code, where would be the right place to pass the CVPixelBuffer frames to? I'm attempting this:

func videoProcessFrame(_ frame: UnsafeMutablePointer<VideoFrameYUV>!) {
//        let resolution = CGSize(width: CGFloat(frame.pointee.width), height: CGFloat(frame.pointee.height))
        
        if frame.pointee.cv_pixelbuffer_fastupload != nil {
            //  cv_pixelbuffer_fastupload to CVPixelBuffer
            let cvBuf = unsafeBitCast(frame.pointee.cv_pixelbuffer_fastupload, to: CVPixelBuffer.self)
            pixelBuffer = cvBuf
            print("pushed video1")

        } else {
            // create CVPixelBuffer by your own, createPixelBuffer() is an extension function for VideoFrameYUV
            pixelBuffer = createPixelBuffer(fromFrame: frame.pointee)
            guard let cvBuf = pixelBuffer else { return }
            print("pushed video2")
        }
        session?.pushVideo(pixelBuffer)
    }

The stream technically starts as I'm getting an error on my server, but I don't know if I'm calling pushVideo in the right spot to continuously push the CVPixelBuffer frames along.

@zyphs21
Copy link
Owner

zyphs21 commented Nov 13, 2020

@sgallo0692 It looks good to me🤔 . Can you post the error you got from your server ?

@sgallo0692
Copy link
Author

sgallo0692 commented Nov 13, 2020

not so much an error now - actually have the streaming working as I dropped LFLiveKit and used the built in DJIRTMPMuxer class, but I'm getting heavy intermittent distortion of the video (locally, too). I'm going to try testing some changes to videoFeed + videoProcessFrame functionality but not sure if you've seen this:

IMG_1951

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

No branches or pull requests

2 participants