mpv-player / mpv-player/mpv

During still frame of variable frame rate (VFR) video playback: OSD + Subtitles are not refreshed

Open
#11,936 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

os:mac
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Reproduction

  • Open a video with a variable framerate (see section "My Source Material & Use Case" below)
  • Start playback
    • ✅ Audio and video are in sync
    • ✅ Video speed is fine
  • As soon as playback is over a still frame (which can be held for a few frames or sometimes as long as 10secs easily)
    • ✅ Audio continues fine
    • ❌ But the timing / behavior of the following features is wrong then:

ON SCREEN DISPLAY (OSD): Playback-time stuck during still frame

In my ~/.config/mpv/mpv.conf I customized my OSD to display also frame numbers and FPS.

osd-status-msg=${playback-time/full} / ${duration} (${percent-pos}%)\nFrame: ${estimated-frame-number} / ${estimated-frame-count} — FPS: ${estimated-vf-fps} / ${container-fps}\n

  • ✅ The $estimated-frame-number remains still during the still frame. That's correct obviously.
  • ❌ The $duration and $percent-pos remain stuck.
    • That is conceptionally wrong, because the audio continues.
    • It seems the entire logic of this operates purely from the video (series of frames) and not from the audio.

SUBTITLES which start or end during still frame are not accounted for

  • If a subtitle's inpoint happens before the still frame, and its outpoint happens during the still frame, the subtitle is falsely shown longer than intended. It is shown until the still frame ends (=when the next frame comes).
  • If a subtitle's inpoint happens during a still frame, it is not shown from the inpoint as intended. Only as soon as the still frame ends (=the next frame comes), that subtitle starts to get shown.
  • Under the circumstance that a subtitle occurs solely during the time of a still frame, it is never shown at all!
    • Practical example: This can very easily happen during a screencast: You had some scene with visual dynamics. Then no visual change occurs on screen (=still frame) and you the narrator explain something of what has happened or what you will do next. The subtitle for this audio portion will never be shown!

My Source Material & Use Case

  • I often do screen recordings to which I talk (software demos, etc)
  • These screen recordings consist of
    • Dynamic scenes: Windows open/close, cursor moves, content scrolls/blinks, …
    • Static scenes: Nothing happening visually (= still frame), only talking/bg-music
  • I use the ffmpeg video filter -vf mpdecimate to create variable frame rate videos from this.
    • This reduces file size significantly (!) while maintaining the exact same quality (given the CRF you use)
    • Technical explanation: An I-frame is held for 10 seconds. This is significantly larger than 10 seconds long having, each second 1 I-frame plus 59 P-frames merely stating "nothing changed", so 10 I-frames + 590 P-frames.
    • ffmpeg -i screen-recording.mov -movflags faststart -c:a copy -c:v libx264 -preset veryslow -vf mpdecimate -vsync vfr -crf 18 screen-recording.mp4
    • To these videos I also add subtitle files.

Environment

  • mpv 0.35.0, installed via brew package manager
  • macOS 11.7.8

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied ffmpeg mpdecimate command and the custom OSD configuration, using a VFR video with subtitles. Trace how mpv updates playback-time, OSD values, and subtitle visibility while a frame is held. Done means audio-driven timing refreshes duration and percent-pos, and subtitles appear and disappear at their timestamps during still frames.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.