mpv-player / mpv-player/mpv

Making a still image play with a constant framerate with lavfi-complex in encoding mode not working (regression)

Open
#13,365 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

down-upstream:ffmpeg
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Important Information

Difficult one to describe but I'll do my best.

On an old version of mpv I've been using (built in late 2021) I could run the following command and I would see a 1280x720 window with a frame rate of 30fps, displaying a still image (image.png) for 10 seconds before ending:

mpv --lavfi-complex="color=c=#000000:s=1280x720:r=30[bg1];[bg1][vid1]scale2ref=w=oh*mdar:h=ih[bg2][img1];[bg2][img1]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2[vo];anullsrc=cl=stereo:r=48000[ao]" --end=10 "image.png"

On a build from the latest source however, when I ran the same command I see nothing, it just hangs and apparently no frames are generated.
Interestingly, if I omit anullsrc=cl=stereo:r=48000[ao] from the command I see a single frame of the still image flash before closing, and the warning:

[lavfi] Filter is stuck. This is a FFmpeg bug. Treating as EOF.

The idea behind the lavfi-complex filter is to create a dummy base frame rate and background, on which a still image can be layered ontop. The anullsrc is necessary so an audio track is generated.

This is so I can generate an item in a playlist that consists of an image (and optionally audio) that outputs a video and audio track in encoding mode (using the --o parameter), and I can have it display for a set amount of time before moving onto the next playlist item, and the encoding will run seamlessly.

So it appears something has changed (probably in ffmpeg as the warning suggests) that makes this method no longer work.

Any ideas how to get the old behaviour back?

  • mpv version: latest build
  • Platform and Version: Windows 11 and Ubuntu 22

EDIT:
After simplifying the command further, I'm noticing it's all going wrong due to the scale2ref filter... Not sure why... a bug? If I remove the scale2ref I can get it working but then the image is not scaled to fit the window.

Log file

log.txt

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 exact mpv command from the issue and inspect the attached log.txt. Compare the full filter graph with versions omitting anullsrc and scale2ref, focusing on the reported “Filter is stuck” warning. Done means still-image encoding with video and optional audio resumes for the requested duration without hanging.

Written by the indexing model from the issue text.

Assessment

Domain
cli
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.