bylee20 / bomi

bomi - a powerful and easy-to-use multimedia player
http://bomi-player.github.io
Other
426 stars 89 forks source link

Video output could be faster #354

Open ValdikSS opened 9 years ago

ValdikSS commented 9 years ago

Hi! I'm using quite low-end by nowadays standards Intel HD 3000 with 3840x2160 external display at 44Hz. Bomi plays 30 and higher fps videos jerky while mpv plays them fine. Both bomi and mpv use bilinear scaler and output to opengl surface. Please tell me what kind of debug information could be useful and how can I get it.

bylee20 commented 9 years ago

Have you tried Video > Quality Preset > Basic Quality?

ValdikSS commented 9 years ago

Yes. It's still a little bit jerky. Not much, but dropping frames here and there.

bylee20 commented 9 years ago

Does frame drop occur in small window, too? Or does it occur only when window is large?

bylee20 commented 9 years ago

Also, please turn off hardware acceleration, if it's turned on.

ValdikSS commented 9 years ago

Hardware acceleration is turned off. HD3000 can't decode 3840×2160 in hardware. And this is actually a youtube video so it doesn't require too much CPU power to decode.

If I run player windowed, it works better, so I suppose that's not a scaler issue but video output issue.

I have 1280×720 xvid 60 fps video. It outputs solid 44 fps in a 3000×1666 window (remember I have 44Hz monitor, not 60), but this is almost the maximum resolution. If continue to resize bomi window further, I can see how output FPS is decreasing in OSD. Fullscreen runs at 38 FPS.

ValdikSS commented 9 years ago

Another thing I noticed: bomi is not syncing sound to video correctly. This test video syncs in state "2 frames behind audio" for me, while it's prefectly synced in mpv and vlc. Normalizer and tempo scalers are disabled.

I suppose this regression was introduced with new audio normalizer, although I can be wrong.

bylee20 commented 9 years ago

I made some changes. Can you test latest source? Be sure that both of Interpolator and Interpolator (Downscale) are set Bilinear. Also, why do you use that video? Do you think the informations about delayed frames and A/V sync in playback information are incorrect?

ValdikSS commented 9 years ago

Still not smooth. 27 FPS in a panning scene. I'll encode this video with -tune fastdecode to make sure that's not a CPU power issue. Actually, this issue could be wider. If I try to play 50 FPS SD video in any video player with opengl output, it's jerky and drops 2 frames in a row. Even more, the scrolling in browser is also jerky in this exact way. I'm using KWin but I tried to turn compositing off and nothing changed. Xv output is smooth.

bylee20 commented 9 years ago

Can you make and try a source whose FPS is lower than your display refresh rate but high enough, that is 30 < FPS < 44?

ValdikSS commented 9 years ago

Yes, I'm always trying on 2 videos. The first is 3840×2160 COSTA RICA IN 4K 60fps (ULTRA HD) w/ Freefly Movi downloaded with youtube-dl -f 266+141 (3840×2160 30 FPS) and another one is W.I.T.C.H. ending (720×576 50 FPS)

ValdikSS commented 9 years ago

I'm not sure where can I get non-vfr video which is higher than 30 fps and less than 40.

ValdikSS commented 9 years ago

No, that's not a CPU power issue. Reencoded Costa Rica with fastdecode tune and it's still outputs 27 FPS in a panning scene (00:00:20-00:00:26)

ValdikSS commented 9 years ago

Is frame delaying is only in bomi or mpv also has this functionality? If mpv doesn't have this and drops frame if it gets delayed, that could be the answer. In bomi, 3 frames in a row are dropped and I notice this while mpv could be dropping 3 frames in a whole second and maybe I just doesn't notice this. Another interesting thing: without compositing there are video artifacts (black squares) sometimes. Only with bomi.

bylee20 commented 9 years ago

You can see dropped frame in mpv using next command:

mpv --term-status-msg="dropped frames: \${drop-frame-count}" --vo=opengl <your file>

This will print dropped frames in terminal.

ValdikSS commented 9 years ago

I suppose this is decoder dropped frames, not video output dropped frames. It's always 0 even with 50 FPS video (where status line already prints dropped frames).

bylee20 commented 9 years ago

Oops, sorry, try this:

mpv --term-status-msg="dropped frames: \${vo-drop-frame-count}" --vo=opengl 

By default, decoder never drops frames.

ValdikSS commented 9 years ago

Seems like mpv doesn't drop frames then.

bylee20 commented 9 years ago

That... is weird. You cannot see frames over than your display refersh rate. It should drop 6(=50-44) frames per second at least unless vsync doesn't work.

ValdikSS commented 9 years ago

Sorry, mpv doesn't drop frames on that Costa Rica 4K 30 FPS video, while bomi does. And of course mpv drops frames on 50 FPS video.

bylee20 commented 9 years ago

Just in case, when you saying 'dropped frame', it doesn't mean 'delayed frame', right?

ValdikSS commented 9 years ago

Right. Bomi delays 3 frames every second in Costa Rica panning scene (00:00:20-00:00:26) and then drops them. If I record a video with OSD opened, could this help you?

bylee20 commented 9 years ago

I've made a branch whose rendering shader is simplified a bit. Please try that. You can build it and execute by following next:

$ git clone https://github.com/xylosper/bomi bomi-test
$ cd bomi-test
$ git checkout test-simple
$ ./configure && make
$ ./build/bomi

Please let me know this shows any improvement or not.

ValdikSS commented 9 years ago

No real improvements. OSD now shows no drops and almost no delayed frames, but the video is still not as smooth as in mpv.

bylee20 commented 9 years ago

No drop but not smooth? That's akward. Doesn't it rendered ~30fps?

ValdikSS commented 9 years ago

Yes, it's rendered in 30 solid FPS with no frame drops according to OSD, but it's jerky.

bylee20 commented 9 years ago

Can you test original latest source? Next will do that in bomi-test which is clone in above comment:

$ git checkout master
$ git pull
$ make
$ ./build/bomi
ValdikSS commented 9 years ago

Hrmm. I suppose I can say it's as smooth as with mpv now. Thanks a lot!

bylee20 commented 9 years ago

Thanks.

ValdikSS commented 9 years ago

I'm afraid it's still no as fast as with mpv or vlc. I have the following 60 fps 3840×2160 video file: ftp://serv.valdikss.org.ru/Downloads/tara-4k.mkv

1) bomi renders to 30 fps if kwin is suspended 2) bomi renders to 45-46 fps if kwin is enabled

mpv and vlc render it with rare frame drops on opengl surface with both kwin enabled or suspended.