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 not fluid when 25fps video output format description criteria #586

Closed
matteogobbi opened this issue Oct 15, 2023 · 10 comments
Closed

Comments

@matteogobbi
Copy link
Contributor

Every time I switch to 25fps video output format description, the video is not fluid..it's jerk.
These are a couple of logs I have:

🟢: [AVDisplayCriteria] Video has been updated - refreshRate: 25.0, formatDescription: Optional(<CMVideoFormatDescription 0x2888dfea0 [0x21d7a20e8]> {
	mediaType:'vide' 
	mediaSubType:'420v' 
	mediaSpecific: {
		codecType: '420v'		dimensions: 1280 x 720 
	} 
	extensions: {{
    CVBytesPerRow = 1924;
    CVImageBufferChromaLocationTopField = Left;
    CVImageBufferColorPrimaries = "ITU_R_709_2";
    CVImageBufferTransferFunction = "ITU_R_709_2";
    CVImageBufferYCbCrMatrix = "ITU_R_709_2";
    CVPixelAspectRatio =     {
        HorizontalSpacing = 1;
        VerticalSpacing = 1;
    };
    Version = 2;
}}
}).
🟢: [AVDisplayCriteria] Criteria was switched to video output refreshRate: 25.0 and DR: SDR
@kingslay
Copy link
Owner

是在播放同一个视频的时候,会一直发生Video has been updated 吗?这个是不合理的

@matteogobbi
Copy link
Contributor Author

matteogobbi commented Oct 15, 2023 via email

@kingslay
Copy link
Owner

你是重载updateVideo(refreshRate: Float, formatDescription: CMFormatDescription?) 这个方法吗?

@kingslay
Copy link
Owner

试着用AVDisplayCriteria(refreshRate: refreshRate, videoDynamicRange: videoDynamicRange.rawValue) 这给初始化方法,不要用 AVDisplayCriteria(refreshRate: refreshRate, formatDescription: formatDescription) 这个初始化方法

@matteogobbi
Copy link
Contributor Author

matteogobbi commented Oct 15, 2023 via email

@kingslay
Copy link
Owner

你试着这样重载。看行不行


    override func updateVideo(refreshRate: Float, formatDescription: CMFormatDescription?) {
        #if os(tvOS) || os(xrOS)
        guard let displayManager = UIApplication.shared.windows.first?.avDisplayManager,
              displayManager.isDisplayCriteriaMatchingEnabled,
              !displayManager.isDisplayModeSwitchInProgress
        else {
            return
        }
        if let formatDescription {
            displayManager.preferredDisplayCriteria = AVDisplayCriteria(refreshRate: refreshRate, videoDynamicRange: formatDescription.dynamicRange.rawValue)
        }
        #endif
    }

@matteogobbi
Copy link
Contributor Author

matteogobbi commented Oct 15, 2023 via email

@matteogobbi
Copy link
Contributor Author

I tried even using

displayManager.preferredDisplayCriteria = AVDisplayCriteria(refreshRate: refreshRate, videoDynamicRange: formatDescription.dynamicRange.rawValue)

with the video output, with no success.

@matteogobbi
Copy link
Contributor Author

matteogobbi commented Oct 15, 2023

I have the impression that live refresh rate less than 50, works with:

AVDisplayCriteria(refreshRate: track.nominalFrameRate, videoDynamicRange: videoDynamicRange)

and that for 50 or more, works with the new tvOS17 API.

UPDATE:

nope, it's mixed behavior even in this case

@matteogobbi
Copy link
Contributor Author

So for 50 fps I use this:

displayManager.preferredDisplayCriteria = AVDisplayCriteria(refreshRate: videoOutputRefreshRate, formatDescription: videoOutputFormatDescription)

and it works.

For 25 fps most of the time doesn't work well with any approach.

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