bvibber / ogv.js

JavaScript media player using Ogg/Vorbis/Theora/Opus/WebM libs compiled with Emscripten
https://brooke.vibber.net/misc/ogv.js/demo/
Other
1.19k stars 99 forks source link

1080p > videos are choppy, hiccup every 5 secs #552

Open Schizo opened 4 years ago

Schizo commented 4 years ago

Some videos (given in the example) seem to be choppy, every 4-5 seconds there is a little hiccup. To rule out network IO, I've run it on a local server but still the same effect. How can we figure out where the bottle neck is? Is there a profiling doc?

bvibber commented 4 years ago

Could be related to the 1 MiB read chunk size; at higher resolutions you might be running through that data sooner and it's not providing enough of a buffer. Can you repro this with files from the demo page, or else do you have a publicly-available file to test with?

Schizo commented 4 years ago

Yes, I've first reproduced it on the demo-page and then served that file locally and had the same issue. Is there a way to raze the 1 MiB read chunk size? I could see if that would solve the issue.

image

Schizo commented 4 years ago

Any updates on this? Or a hint were I could change the cache size?

yafesdev commented 4 years ago

@brion I'm experiencing similar issues, I've tried to change OGVPlayer.js:2467, adding chunkSize: 16 * 1024 * 1024, (default is 1 1024 1024). However, that didn't seem to affect the streamed chunk size. Any Ideas?

yafesdev commented 4 years ago

Not sure how the Example VP8 Video files were encoded but after re-encoding Tears_of_Steel_in_4k_-_Official_Blender_Foundation_release.webm.1440p.webm my cpu load wen't down a lot and no more lagging on my notebook.

ffmpeg -i ~/Downloads/Tears_of_Steel_in_4k_-_Official_Blender_Foundation_release.webm.1440p.webm  -c:v libvpx -qmin 0 -qmax 50 -b:v 9M  -slices 4 -g 1  ./demo/media/RED1440pReencoded9M.vp8.webm 

I just added a b:v 9M for high quality and -g 1 to have a keyframe on every frame (for quick seeking purposes), I've tested it both in threaded: true/false, and the playback normalized, without drop frames. hosted from a local server.

However:

On my Iphone 11 Pro and Ubuntu Desktop (i7) it was very choppy, so I've played around with a greater chunk size (16MB, 32MB). 32 Seemed better, but at some point it started dropping frames again. I event wen't higher to 512MB to see if the streamed data is the bottleneck and that actually proofed to be the case.

However for some reason the sound was getting more off by modifying the chunkSize.

Cheers