Open Bug 1902047 Opened 1 year ago Updated 1 year ago

Video freezes momentarily, sometimes audio de-sync when playing >1080p30 video fast (>2x speed) on Apple M1 Pro

Categories

(Core :: Audio/Video: Playback, defect, P3)

Firefox 127
defect

Tracking

()

UNCONFIRMED

People

(Reporter: playitlouder, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:127.0) Gecko/20100101 Firefox/127.0

Steps to reproduce:

Play a video on youtube on a Apple M1 Pro Macbook. Select 1080p50 (or higher) quality. Issue happens more often on higher resolutions. Switch to full-screen.
Speed it up using the "Video Speed Controller" add-on to 2.5x speed or more.

This is on a new Profile, and is not a recent regression. This issue exists since I own the computer (almost 2 years).

Actual results:

Video freezes randomly then recovers then freezes again a few seconds later.
Sometimes audio de-sync happens when doing this also.
Depends on the video how fast this happens (maybe bitrate dependent?).

Expected results:

Video playback should work and ideally not drop frames.

I don't quite know which type of trace/report file I should attach, if you need a specific one, let me know.

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Would you mind to follow this instruction to capture a profiled result? This allows us to capture debug logs. Thanks!

Flags: needinfo?(playitlouder)

(In reply to Alastor Wu [:alwu] from comment #3)

Would you mind to follow this instruction to capture a profiled result? This allows us to capture debug logs. Thanks!

Sure. https://share.firefox.dev/3VGupGD
I played https://www.youtube.com/watch?v=Mw1MWfilz_k in 1440p60 and sped it up to 2.9x. This breaks playback after a few seconds.
Hope I haven't doxed myself by uploading the log, let me know if I have lol.

Flags: needinfo?(playitlouder)

Thanks! I would like to confirm with you if this issue only happens when you change the playback rate? also, would this happen on other browsers?

Flags: needinfo?(playitlouder)

Yes, it only happens if the "rate" is above 2x.
It works fine in Safari even at 4x speed, Chrome has issues over ~3.5x for me.
And it's not limited to youtube either, also happens when I try streaming the Native render size (4000x2250) 60 fps Big Buck Bunny file and speed it up.

Flags: needinfo?(playitlouder)

I just tried again and the issue also happens without video speed controller when just selecting 4k60 and 2x speed on a yt video.
This drops most of the frames but the audio plays normally.
Hadn't tried that since I'm using Video Speed Controller for so long :D

Sorry for the tripple-post.

This might be a bit of an broader issue than just a Firefox problem (Apple Video Toolbox issue?). Because I went ahead and just downloaded a VP9 4k60 video from Youtube and tried playing it on vlc. VLC also can't play the video at 2x speed with HW decoding and starts artifacting when dropping frames. Another media player IINA skips a lot of frames but doesn't freeze the playback like Firefox. But if i open the file in Safari it plays fine at 2x. Safari can even play a 8k60 VP9 file on 2x speed without dropping frames. QuickTime doesn't support .webm files.

Other projects also seem to have issues with the decoder, see ffmpeg https://trac.ffmpeg.org/ticket/10963. The linked Peru 8K HDR 60FPS (FUHD)._original.webm is a good test, VLC and IINA struggle to play the file at 1x, Safari does fine even at 2x.

For what I could find so far from the profile in the comment4, the issue is due to video toolbar decoder couldn't decode fast enough to catch up that high playback rate. But I'm surprising that Safari can still work well on 4x, it seems there must be some improvement we could do for that. In addition, video frozen is the special behavior Firefox has, when video decoding is too slow, we would at least keep audio playing and seek video to another advance position to catch up with video.

There is one thing you could try on your side, adding new prefs media.video-queue.default-size=20 and media.video-queue.hw-accel-size=20 to see if this helps the problem.

Severity: -- → S3
Priority: -- → P3

Doesn't seem to change much, if anything.
Is Firefox using ffmpeg to play the video or is it accessing Apple Video Toolbox directly?
Because if I benchmark the Video Toolbox decoder with the webm file from comment4 i get this: "frame= 2754 fps=124 q=-0.0 size=N/A time=00:00:45.90 bitrate=N/A speed=2.07x". That's probably the reason Firefox has issues above 2x speed if it uses the same decoder.

Safari doesn't decode webm/vp9 with video toolbox (evident by no VPDecoderXPCServer log entries when playing the same video in Safari) and that's probably the reason it has no issues with playback. I think it might be using "Core Media" but I'm not sure.

The decoder performance doesn't seem acceptable to me, but reporting to Apple that the decoder performance is terrible without having a concrete simple testcase probably isn't very successful.

You need to log in before you can comment on or make changes to this bug.