Skip to content

Commit

Permalink
Tweak mpv workers & threads
Browse files Browse the repository at this point in the history
Unlike ffmpeg, mpv with the default setting of 3 workers and 8 threads
does not always 100% utilise the CPU, giving the impression that it is
slower. With further tweaking, it's possible for mpv to completely use
the CPU, so that it's fairer to compare to ffmpeg.

| Samples  |    Workers/Threads    |
| -------- | 4/8 | 8/4 | 8/2 | 6/2 |
| H.264    | 18s | 10s | 10s | 12s | - 8/2
| HEVC     | 45s | 37s | 29s | 31s | - 8/2
| VP9      | 69s | 60s | 57s | 60s | - 8/2
| AV1      | 24s | 17s | 16s | 16s | - 6/2 (???)

There we go, the thumbnail generation speed has increased considerably,
much more so than after tweaking ffmpeg. Due to the tendency of mpv
being less multi-threaded, it's advisable to set the max_workers to
the number of cores in your CPU.

Interestingly, mpv significantly outperforms ffmpeg in generating
thumbnails for AV1 videos. The reason is unknown, much like how ffmpeg
decodes the VP9 sample quicker than mpv can.
  • Loading branch information
dexeonify committed Sep 6, 2022
1 parent 02b6f6e commit c403b41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 0 additions & 5 deletions mpv.conf
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,3 @@ profile-desc=Fix abnormal stuttering when using auto-copy on >4K videos
profile-cond=width >= 3840 and height >= 2160
profile-restore=copy
hwdec=auto-safe

[fast-av1-thumbnails]
profile-desc=Use mpv to generate thumbnails for AV1 videos, as it is significantly faster than ffmpeg
profile-cond=p["video-format"] == "av1"
script-opts-append=Thumbnailer-use_ffmpeg=no
4 changes: 2 additions & 2 deletions script-opts/thumbnailer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ bitrate_delta_factor=1
#update_time=0.25

# Worker
max_workers=4
max_workers=8
worker_remote_factor=1
#worker_bitrate_factor=1
#worker_delay=1
#worker_timeout=5
#accurate_seek=yes
use_ffmpeg=yes
#use_ffmpeg=yes
#prefer_ffmpeg=yes
ffmpeg_threads=2
#ffmpeg_scaler=spline
Expand Down

0 comments on commit c403b41

Please sign in to comment.