Open Bug 1336810 Opened 3 years ago Updated 4 months ago

Linux VP9 drops a lot of frames, but h264 does not.

Categories

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

Unspecified
Linux
defect

Tracking

()

REOPENED

People

(Reporter: kristian, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170125210226

Steps to reproduce:

I visited https://www.youtube.com/watch?v=17DRblYX2Z4 and YouTube automatic selected "1080p60" (60 fps). The video was "frozen" (dropped frames) most of the time, I then opened "Stats for nerds" which show it is using the vp9 decoder and a lot of dropped frames. One thing I noticed was that it played fine in "burst", ie. 

After that I used youtube-dl to download both the 60 fps webm and 60 fps mp4 file.
youtube-dl -F 'https://www.youtube.com/watch?v=17DRblYX2Z4'
[...]
303          webm       1920x1080  DASH video 5122k , vp9, 60fps, video only, 162.66MiB
299          mp4        1920x1080  DASH video 5611k , avc1.64002a, 60fps, video only, 193.47MiB
[...]
youtube-dl -f 303 https://www.youtube.com/watch?v=17DRblYX2Z4
youtube-dl -f 299 https://www.youtube.com/watch?v=17DRblYX2Z4

and both videos was playing smoothly in mpv (without any hardware decoding).
I then opened both files in Firefox, and the mp4 files was playing without any issue both the webm files was playing with a lot of dropped frames.
I also had installed the about:media extensions, so here some stats:
file:///home/kristian/Hentninger/Rise%20of%20the%20Tomb%20Raider%20Review-17DRblYX2Z4.mp4
	file:///home/kristian/Hentninger/Rise%20of%20the%20Tomb%20Raider%20Review-17DRblYX2Z4.mp4
	currentTime: 41.710695 readyState: 4
	Quality: 100% (total:2502 dropped:0 corrupted:0)
	Buffered ranges: [(0, 314.664344)]
	Internal Data:
	audio decoder: unavailable
	audio frames decoded: 0
	video decoder: shutdown
	hardware video decoding: disabled
	video frames decoded: 2513 (skipped:0)
	video state: ni=0 no=0 ie=0 demuxr:0 demuxq:0 tt:-1,000000 tths:-1 in:0 out:0 qs=0 pending:0 waiting:0 wfk:0, sid:4294967295
	
file:///home/kristian/Hentninger/Rise%20of%20the%20Tomb%20Raider%20Review-17DRblYX2Z4.webm
	file:///home/kristian/Hentninger/Rise%20of%20the%20Tomb%20Raider%20Review-17DRblYX2Z4.webm
	currentTime: 29.095 readyState: 4
	Quality: 1% (total:1747 dropped:1730 corrupted:0)
	Buffered ranges: [(0, 314.647)]
	Internal Data:
	audio decoder: unavailable
	audio frames decoded: 0
	video decoder: ffvpx video decoder
	hardware video decoding: disabled
	video frames decoded: 1758 (skipped:0)
	video state: ni=0 no=0 ie=0 demuxr:0 demuxq:0 tt:-1,000000 tths:-1 in:1760 out:1758 qs=2 pending:0 waiting:0 wfk:0, sid:4294967295

Info:
OS: ArchLinux
Firefox Nightly 54.01 (2017-01-25) (64-bit)
CPU: A6-3410MX
RAM: 6GB
256 Samsung SSD


Actual results:

The mp4 files was playing without any issue, but the webm files was playing with a lot of frame drops.


Expected results:

Both mp4 and webm should play smoothly.
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
OS: Unspecified → Linux
about:media shows that no frames were dropped.

In any case, very slow machine, unreasonable to expect it can keep up decoding 1080p at 60fps.

What's your screen resolution?

Don't force the resolution in YouTube, leave it on auto.

Should be closed as either Invalid or WFM
(In reply to Jean-Yves Avenard [:jya] from comment #1)
> about:media shows that no frames were dropped.
> 
Did you look a both entries? The first one shows no drops (mp4), and the second at lot of drops (webm).
Or is you looking at the line "video frames decoded: 1758 (skipped:0)"? I am looking at the line "Quality: 1% (total:1747 dropped:1730 corrupted:0)", shouldn't they be the same?

> In any case, very slow machine, unreasonable to expect it can keep up
> decoding 1080p at 60fps.

mpv plays both video without hardware accelerating without any issues, they use the same decoder (ffvp9) from what I understand. How much "overhead" does Firefox add?
 
> What's your screen resolution?

1366x768 right now, but most of the time my laptop is connected to a external monitor (1920x1080).

> Don't force the resolution in YouTube, leave it on auto.
I didn't, YouTube choose 1080p60 automatic (although that is a bit weird)..

> Should be closed as either Invalid or WFM
Maybe..
(In reply to Kristian Klausen from comment #2)
> (In reply to Jean-Yves Avenard [:jya] from comment #1)
> > about:media shows that no frames were dropped.
> > 
> Did you look a both entries? The first one shows no drops (mp4), and the
> second at lot of drops (webm).
> Or is you looking at the line "video frames decoded: 1758 (skipped:0)"? I am
> looking at the line "Quality: 1% (total:1747 dropped:1730 corrupted:0)",
> shouldn't they be the same?

frames can be dropped by many various level.
About:media shows the frames as dropped by the decoder alone, those decoded frames are then painted. 
about:media shows that no frames were dropped by the decoder, but the stats reported by youtube includes all frames dropped, so that frames no painted by the compositor because they were late.

This indicates that your machine is fast enough to decode, but not fast enough to also paint them.

Make sure hardware layers are enabled.
That is
layers.acceleration.disabled=false
it's possible your AMD, is blacklisted (like many AMD) due to common crashes and this got disabled by default.
If so, then set:
layers.acceleration.force-enabled=true



> 
> > In any case, very slow machine, unreasonable to expect it can keep up
> > decoding 1080p at 60fps.
> 
> mpv plays both video without hardware accelerating without any issues, they
> use the same decoder (ffvp9) from what I understand. How much "overhead"
> does Firefox add?

it depends if you're playing full screen or not.
mpv only worries about playing a video in a single window which is a trivial task.

it doesn't have to worry about painting hundreds of other elements at the same time like what a typical youtube page would be made of.
> 1366x768 right now, but most of the time my laptop is connected to a
> external monitor (1920x1080).
> 
> > Don't force the resolution in YouTube, leave it on auto.
> I didn't, YouTube choose 1080p60 automatic (although that is a bit weird)..

are you playing full screen
(In reply to Jean-Yves Avenard [:jya] from comment #3)
> (In reply to Kristian Klausen from comment #2)
> > (In reply to Jean-Yves Avenard [:jya] from comment #1)
> > > about:media shows that no frames were dropped.
> > > 
> > Did you look a both entries? The first one shows no drops (mp4), and the
> > second at lot of drops (webm).
> > Or is you looking at the line "video frames decoded: 1758 (skipped:0)"? I am
> > looking at the line "Quality: 1% (total:1747 dropped:1730 corrupted:0)",
> > shouldn't they be the same?
> 
> frames can be dropped by many various level.
> About:media shows the frames as dropped by the decoder alone, those decoded
> frames are then painted. 
> about:media shows that no frames were dropped by the decoder, but the stats
> reported by youtube includes all frames dropped, so that frames no painted
> by the compositor because they were late.
> 
> 
> This indicates that your machine is fast enough to decode, but not fast
> enough to also paint them.
Hmm, I just through the Firefox compositor was faster or should be improved. I didn't expected it to be 2-3x times slower than mpv.

> Make sure hardware layers are enabled.
> That is
> layers.acceleration.disabled=false
> it's possible your AMD, is blacklisted (like many AMD) due to common crashes
> and this got disabled by default.
> If so, then set:
> layers.acceleration.force-enabled=true
Already done..

> > 
> > > In any case, very slow machine, unreasonable to expect it can keep up
> > > decoding 1080p at 60fps.
> > 
> > mpv plays both video without hardware accelerating without any issues, they
> > use the same decoder (ffvp9) from what I understand. How much "overhead"
> > does Firefox add?
> 
> it depends if you're playing full screen or not.
> mpv only worries about playing a video in a single window which is a trivial
> task.
Fullscreen or not mpv plays the file without any issues, it can even play the video two times side by side without any issue (as long as I close Firefox it is 60 fps most of the time).
In Firefox fullscreen or not it drops a lot of frames.

> it doesn't have to worry about painting hundreds of other elements at the
> same time like what a typical youtube page would be made of.
As I said in the initial bug report:
I downloaded the video from YouTube (both mp4 and webm), and opened both directly in Firefox. So Firefox was only playing the video directly (without all the html and javascript stuff around it).
To be sure it wasn't a extension or one of the other tabs, I just created a clean profile and opened the webm files, and again a lot of dropped frames.

> > 1366x768 right now, but most of the time my laptop is connected to a
> > external monitor (1920x1080).
> > 
> > > Don't force the resolution in YouTube, leave it on auto.
> > I didn't, YouTube choose 1080p60 automatic (although that is a bit weird)..
> 
> are you playing full screen
Nope, when I click on the "gear" it says "Auto 1080p60", but that could be a Youtube bug or something else.
Status: UNCONFIRMED → RESOLVED
Closed: 5 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1210726
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: DUPLICATE → ---
You need to log in before you can comment on or make changes to this bug.