mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.9k stars 2.87k forks source link

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

Open twilson90 opened 7 months ago

twilson90 commented 7 months ago

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?

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

llyyr commented 7 months ago

Bisected to https://github.com/ffmpeg/ffmpeg/commit/d9e41ead82263e96ebd14d4d88d6e7f858dd944c

You'll probably need to report this to ffmpeg