mpv 0.28.0-638-g08a6827b3d Copyright Ā© 2000-2018 mpv/MPlayer/mplayer2 projects
built on Fri Jul 20 19:07:42 CEST 2018
ffmpeg library versions:
libavutil 56.18.102
libavcodec 58.21.105
libavformat 58.17.101
libswscale 5.2.100
libavfilter 7.26.100
libswresample 3.2.100
ffmpeg version: N-91498-g9888a19db4
Arch Linux x86_64
mpv --no-config https://fratti.ch/tmp/wanderers.webmDon't drop frames, like vlc, Chromium and ffplay do.
Severe VO framedrops
So why does the main website where your sample is show as being seized by the nsa?
With which Chromium versions is this supposed to work?
@Hrxn ones which have a devendored ffmpeg that supports AV1, like the one Arch Linux ships.
I only get one frame drop in the very beginning (nothing unusual) and video plays fine otherwise for me on Windows and Linux.
Odd thing: I'm getting lots of delayed frames with lachs0r's build, but not with shinchiro's.
@aufkrawall: Try the latest one.
@CounterPillow: Well. Consider the following:
I was able to reproduce the judder on my system with my own Windows builds until I changed the build options. For the record, see this spec file:
https://build.opensuse.org/package/view_file/multimedia:libs/libaom/libaom.spec?expand=1
Yep, fine now.
@lachs0r
Small nit, don't want to open an issue for this:
PS F:\Tools> mpv --V
mpv 0.29.0 Copyright Ā© 2000-2018 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
libavutil 56.18.102
libavcodec 58.22.100
libavformat 58.17.101
libswscale 5.2.100
libavfilter 7.26.100
libswresample 3.2.100
ffmpeg version: 4.1+809.g269daf5985
PS F:\Tools> mpv
mpv 0.29.0 Copyright Ā© 2000-2018 mpv/MPlayer/mplayer2 projects
built on UNKNOWN
ffmpeg library versions:
[...]
[...]
built on UNKNOWN
Not sure, but probably not intentional? Older builds definitely had their date in that place..
@Hrxn that's to make the builds reproducible, AFAIU.
Good to know, thanks.
Then please disregard.. or maybe scrap the built on UNKNOWN line entirely?
@lachs0r I've built aom with optimisations now and that didn't change a thing about mpv's framedrops.
Since this didn't go through last night when I tried to post it:
--disable-build-date is what results in 'built on UNKNOWN'. I think it was one of the Debian maintainers that wanted to be able to disable it for determinism reasons or something. Point releases may or may not default to using that option, hence that output. Git builds show the date.
Some years back there was a bug report that wanted it to be more comprehensive and if the --disable-build-date option was used, for the 'built on' line to be omitted completely. I didn't particularly care to open a pull request just for that, but I did whip up a patch to do it.
EDIT: I went ahead and opened a pull request.
Seems rather finicky about dropped frames. The linked vid was pretty short so did some local encodes of a bit longer. Seems minor changes to encoding options can create more or less dropped frames in mpv, don't have any other player to compare.
As ex. these 2 vids - the 30 sec one I get no dropped, the 45 sec. I get 11. If I encode diffently the dropped can increase for both.
Both done thru ffmpeg, multithreaded encoding, about 30% of orig. bitrate/file size, 2 pass. 2nd pass options for 30 sec, -
ffmpeg -hide_banner -nostdin -y -i "file:/home/doug/Videos/Special Edition Trailer-avatar-specialeditiontrailer.mov" -map 0:v:0 -map 0:a:0 -threads 8 -c:v libaom-av1 -cpu-used 4 -strict experimental -tile-columns 3 -tile-rows 3 -b:v 3814k -auto-alt-ref 1 -lag-in-frames 25 -g 128 -pix_fmt yuv420p -c:a libopus -b:a 128k -f webm -pass 2 -passlogfile /tmp/boram-198764pEX5Nbjj2ik -metadata title=Avatar "file:/home/doug/Desktop/Special Edition Trailer-avatar-specialeditiontrailer.webm"
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:/home/doug/Videos/Special Edition Trailer-avatar-specialeditiontrailer.mov'
https://0x0.st/sxjk.tar
(- both files in a .tar folder, if uploaded & then downloaded as .webm files then both showed increased frame drops when played, from the downloaded/extracted .tar they behave as the local ones, ..no idea why that
I have the same issue with AV1 1080p of this video from AV1 Beta Launch Playlist.
$ mpv --version
mpv 0.29.0-30-g6eb59fea2f-dirty Copyright Ā© 2000-2018 mpv/MPlayer/mplayer2 projects
built on Sun Sep 16 23:58:12 MSK 2018
ffmpeg library versions:
libavutil 56.19.101
libavcodec 58.30.100
libavformat 58.18.101
libswscale 5.2.100
libavfilter 7.32.100
libswresample 3.2.100
ffmpeg version: N-91961-g5109c38162
$ aomdec --help | grep av1
av1 - AOMedia Project AV1 Decoder 1.0.0-590-g6fa400604
$ youtube-dl -f 399 -o dua.mp4 k2qgadSvNyU
$ time ffmpeg -v warning -i dua.mp4 -frames:v 250 -f null -
269% cpu 4.216 total
As you can see, it takes only 4.2 seconds to decode 10 seconds of video (25 fps) on my machine but when I'm trying to play it with mpv I get a lot of VO frame drops.
This issue is still present with latest ffmpeg + mpv builds (both Windows & Linux).
Open
mpv https://www.youtube.com/watch?v=2nXYbGmF3_Q
with
ytdl-format="((bestvideo[vcodec=av01.0.05M.08]/)+bestaudio)/best"
and notice stutter and frames reported as mistimed.
I have a theory that AV1 decoding is limited to a single thread since FFmpeg doesn't support multithreaded encoding for AV1 either. So there's a precedent there.
To test it, download a 1080p AV1 video from Youtube:
youtube-dl -f 399 https://www.youtube.com/watch?v=mIAfxj7nd9k -o av1test.1080p.mp4
Then play it with mpv and record the CPU use of the process with time:
ThinkPad-T420:~/Videos/av1_yt$ /usr/bin/time -f "\ntime\t%E,\nCPU\t%P,\nRAM\t%Mk" mpv av1test.1080p.mp4
Playing: av1test.1080p.mp4
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: Unknown AV1 Codec Configuration Box version 129
(+) Video --vid=1 (*) (av1 1920x1080 23.976fps)
VO: [gpu] 1920x1080 yuv420p
V: 00:00:22 / 00:02:38 (14%) Dropped: 149 Cache: 136s+24MB
[input] No key binding found for key 'Ctrl+Alt+SPACE'.
V: 00:02:38 / 00:02:38 (99%) Dropped: 905 Cache: 0s
Exiting... (End of file)
time 3:20.06,
CPU 89%,
RAM 313636k
Playback was stuttery with a large number of dropped frames and took 3 minutes 20 seconds to complete for a 2 minute 38 second video. And as you can see, CPU usage was only 89% of the 400% maximum on a 2-core 4-thread CPU. While observing with htop I saw only 2 mpv processes, one with CPU usage below 100% and another that fluctuated from about 2% to 6.6%. Normally you'd see many more processes, when decoding 1080p VP9 for example I see at least 6 processes.
Now that the latest version of Firefox (v. 63) also supports AV1 decoding we can test that too. The media.av1.enabled flag needs to be set to true in about:config for it to work. From playing back the video in a new tab and observing the CPU usage from htop, it seems Firefox is using about 4 threads/processes for playback and their combined CPU usage is 200%+. Playback is smooth with no apparent frame drops, though there seems to be a bug where the rendering of the video playback can stop in a specific frame but according to htop's CPU usage the video is still being decoded in the background.
If you can't replicate the test result, then you probably aren't using a dual-core laptop CPU from 7 years ago (mine is an i3-2520M) and can just brute-force through the threading issue. In that case you can try one of Elecard's Holi festival AV1 test files. I'd imagine even the beefiest CPU will run into issues when trying to play the 2160p version on one thread. I can't even play the 720p 3.9 mbps file without dropped frames on mpv, while Firefox is again able to play it just fine.
At least here mpv & ffplay are ok with av1 files encoded with libaom0, particularly if done thru ffmpeg, higher rez's can have some dropped frames (I'm ok to 1080p. )
The elecard files 1080p or less play back ok.
However the youtube ones don't, neither in mpv or ffplay. They do in vlc but vlc does not use use ffmpeg libs for decoding av1. What's the difference between local, elecard & youtube I've no idea..
As far as mt encoding in ffmpeg, that is quite possible, ie. with -tile-columns & -tile-rows , ffmpeg needs to be patched for -tile-rows.
Additionally here for any locally encoded av1 or the elecard samples mpv & ffplay decoding is multithreaded. Again not so for the youtube samples..
Maybe by next year there will be a better decoder & mpv/ffmpeg will perform better. (dav1d
Why this is still open, mpv does not have own decoders any more...
Because ffmpeg decodes video faster than realtime but there are frame drops in mpv?
@richardpl maybe you should actually try to reproduce this before making a stupid comment; other applications using the same decoder work fine, and mpv drops frames at vo.
Issue disappears when using libdav1d instead of libaom.
Off course.... I told you so.
Closing this, since it's probably a combination of the following:
With dav1d I still get stutters but they're less severe, so I guess it is just the decoder after all.
Do you get any anomalies reported? If I'm not mistaken, libdav1d is entirely free of stutter for me. Would have to test this more thoroughly though.
I still get delayed frames, but that's likely because this is a 2 core 4 thread laptop.
mpv 0.32.0-515-g685bd6a5f5
https://x0.at/HKo.mp4 AV1, 720p, 5.5 MiB
gpu-hq, deband=no
getting frame drops⦠aggrrrhhh
Plays fine on Windows here. Open a new ticket and don't ignore the issue template, thanks.
Is suspect using a higher value for --vd-lavc-threads=N has the same or better effect.
Most helpful comment
Because ffmpeg decodes video faster than realtime but there are frame drops in mpv?