SuRGeoNix / Flyleaf

Media Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
GNU Lesser General Public License v3.0
687 stars 92 forks source link

Specify maximum output framerate #453

Closed benwilkinson closed 2 months ago

benwilkinson commented 3 months ago

Addresses issue I brought up here: Overriding output frame rate

SuRGeoNix commented 2 months ago

Sorry for the delay @benwilkinson I will try to review this in the next update

benwilkinson commented 2 months ago

@SuRGeoNix Cool, it was pretty straight forward thanks to how you had things laid out. The thing I was hesitant about was default max 30fps.

SuRGeoNix commented 2 months ago

@benwilkinson There are issues with this solution. Changing the output frame rate ideally should be done with transcoding before playback. This can cause issues with variable frame rate videos and I'm not sure what we are trying to achieve with this. You still have to decode the frames so there no much gain for performance as you only avoid the "FillPlanes" which is not the "heavy" process. By transcoding you will actually prevent decoding more frames and have a better performance.

If the plan is to resolve this https://github.com/SuRGeoNix/Flyleaf/issues/323 then I could just add an option to not "drop" frames during the speed change.

benwilkinson commented 2 months ago

I found a bug where ad specific framerate and speed combinations it would ignore all frames so I went back to the simple frame dropping.

I tried not dropping frames in the decoder and it worked but was definitely heavier, which is expected. Seems like we could cut that down a bit though. 10fps video, 12x speed, 6 players Drop frames: 15% gpu No drop: 40% gpu My current changes: 22% gpu

My use case is up to 8 players synced, playing 1-30fps clips at .25-16x speed. Average case is 4 players, 5fps, 4-8x speed. Dropping as few noticeable frames as possible.

SuRGeoNix commented 2 months ago

Nice, this feels more stable and I will include it. The default for max fps will be 'not set/auto (-1 or 0)' and it will max to Max(25, initial input fps without speed).. something like that. I will review this when I will merge it.

SuRGeoNix commented 2 months ago

@benwilkinson Have a look and let me know if that's ok with you