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

Limit playback to video FPS speed? #80

Open
markg85 opened this issue Jun 20, 2024 · 6 comments
Open

Limit playback to video FPS speed? #80

markg85 opened this issue Jun 20, 2024 · 6 comments

Comments

@markg85
Copy link

markg85 commented Jun 20, 2024

Hi,

Great project you have here! It actually works :)

My video file (big buck bunny) has these specifics:

Video Input Information
        Codec        : AVC/H.264
        Frame rate   : 60/1 = 60 fps
        Sequence     : Progressive
        Coded size   : [3840, 2160]
        Display area : [0, 0, 3840, 2160]
        Chroma       : YCbCr 420
        Bit depth    : 8

But it's playing at a much higher fps then the video wants:

                Frame 135, FPS: 133.806
                Frame 338, FPS: 201.12
                Frame 538, FPS: 198.628
                Frame 737, FPS: 197.117
                Frame 929, FPS: 190.964
                Frame 1132, FPS: 200.835
                Frame 1342, FPS: 208.882
                Frame 1552, FPS: 208.937
                Frame 1752, FPS: 197.126
                Frame 1940, FPS: 186.471
                Frame 2130, FPS: 188.872
                Frame 2322, FPS: 189.204
                Frame 2521, FPS: 197.919
                Frame 2720, FPS: 196.622
                Frame 2929, FPS: 205.075
                Frame 3135, FPS: 204.338
                Frame 3325, FPS: 188.116
                Frame 3538, FPS: 211.291
                Frame 3750, FPS: 210.683
                Frame 3961, FPS: 208.87

The command i use to play a video:

RADV_PERFTEST=video_decode ./vk-video-dec-test -i ~/Downloads/BigBuckBunny/bbb_sunflower_2160p_60fps_normal.mp4

Is there an option to limit it to 60 fps (in this case)? I can't find it.

Sidenote, this is on AMD hardware.

@zlatinski
Copy link
Contributor

Hi markg85,
We're waiting for Khronos to finish the display timing extensions before using them for video. I had code to artificially wait on frame submits to limit the FPS based on the video frame rate, but this did not work (precisely) well. It was also affecting the benchmarks. Please see the code in Shell::AcquireBackBuffer() using the std::this_thread::sleep_for() functions. That's currently disabled with if (false).

@BattleAxeVR
Copy link

Tony, however you guys manage to implement it when you finally do, I hope you'll keep the frame index available because my app needs those to sync multiple video files decoding in parallel and get exact results.

It would also be useful if you could make the video sample here have a play/pause/stop/rewind buttons, even if it's just from the keyboard. And an example how to play back the audio synced to the video perfectly, which is another big issue that I have no interest in delving into, in other media players for how they do it. The sample should be feature complete for its intended use case and currently it's far from that. I already implemented seek(timestamp) so I have play/pause/rewind etc but it's a bit glitchy.

What is taking a significant amount of time for me maintaining my branch of vulkan video for my engine is all the refactoring (which is great) to simplify the class structure etc, forces me to redo the work by hand quite often.

@zlatinski
Copy link
Contributor

however you guys manage to implement it when you finally do, I hope you'll keep the frame index available because my app needs those to sync multiple video files decoding in parallel and get exact results.

Sure, NP. Please note that this will only affect the display timing, based on the video content's rate.

@zlatinski
Copy link
Contributor

The last restructuring is focused on the framebuffer which is a preparation for the the AV1 branch integration. It is primarily internal, so there are no bublic API changes. I hope it is not too bad this time around.

@zlatinski
Copy link
Contributor

It would also be useful if you could make the video sample here have a play/pause/stop/rewind buttons, even if it's just from the keyboard.

Since this is a sample specificly targeting Vulkan video APIs, we don't have the resources to implement such features. However, we accept contributions 😀.

@BattleAxeVR
Copy link

BattleAxeVR commented Jul 5, 2024

Challenge accepted!

I'll make a PR but I'll start from a fresh branch and focus on just using spacebar to play/pause, backspace to rewind to 0, and maybe left/right to seek a few seconds forward/back.

Audio is out of scope for me too, at least for now, I have a separate audio engine and SFX in my game. But still, I can see it being useful eventually (for cutscenes / trailers) to have audio/video sync. I guess I'll have to look at how other real vulkan video media players hook up the decoded output audio

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

3 participants