mpv-player / mpv

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

--screenshot-template='%{title}' only half expanded (to `${?media-title: ….jpg` #14829

Open eMPee584 opened 1 month ago

eMPee584 commented 1 month ago

mpv Information

mpv 021c5de Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on May 26 2024 16:07:27
libplacebo version: v7.349.0
FFmpeg version: git-2024-05-26-63697d3
FFmpeg library versions:
   libavutil       59.20.100
   libavcodec      61.5.104
   libavformat     61.3.104
   libswscale      8.2.100
   libavfilter     10.2.102
   libswresample   5.2.100

and

mpv 0.37.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
libplacebo version: v6.338.2
FFmpeg version: 6.1.1-3ubuntu5
FFmpeg library versions:
   libavutil       58.29.100
   libavcodec      60.31.102
   libavformat     60.16.100
   libswscale      7.5.100
   libavfilter     9.12.100
   libswresample   4.12.100

Other Information

- Linux version: Ubuntu 24.04.1 LTS
- Kernel Version: 6.8.0-41-generic #41-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug  2 20:41:06 UTC 2024
- GPU Model: Intel Corporation Haswell-ULT Integrated Graphics Controller [8086:0a16] (rev 0b)
- Mesa/GPU Driver Version: OpenGL version string: 4.6 (Compatibility Profile) Mesa 24.0.9-0ubuntu0.1
- Window Manager and Version: xfce 4.18
- Source mpv: ubuntu & fruit repo
- Introduced in version: unknown

Reproduction Steps

Trying to find a suitable screenshot template, i stumbled over this glitch that %{title} is only being half expanded. To reproduce, play any file with mpv -v --screenshot-template='%{title}' and press s to take a snap than check the name.

example: mpv --no-config -v --screenshot-template='%{title}' --gpu-debug --log-file=output.mpv.txt https://www.youtube.com/watch?v=3cdt-aECOCg

Expected Behavior

That the title is filled into the filename.

Actual Behavior

Actual file name created is ${?media-title:${media-title}}${!media-title:No file} - mpv.jpg

Log File

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

llyyr commented 1 month ago

You're only allowed to use these specifiers, title is not expected to work. https://mpv.io/manual/master/#options-screenshot-template

--screenshot-template='%F - mpv' should be what you're looking for though

eMPee584 commented 2 weeks ago

You're only allowed to use these specifiers, title is not expected to work.

But it does not say anything like that in the documentation?

%{prop[:fallback text]}
  Insert the value of the input property 'prop'. E.g. %{filename} is the same
  as %f. If the property does not exist or is not available, an error text is
  inserted, unless a fallback is specified.
llyyr commented 2 weeks ago

But it does not say anything like that in the documentation?

I went back to the beginning of time (v0.28.0) and %title specifically has always been broken this way, because for some reason this property resolves to the wintitle string. I'll look into why it's broken. Other properties work fine with the screenshot-template command.

edit:

I think this is working as intended. The title property is "${?media-title:${media-title}}${!media-title:No file} - mpv" by default. If you want the title, then set that as your screenshot-template.