mpv-playlistmanager
mpv-playlistmanager copied to clipboard
Can resolve_titles also work on local file?
I have set prefer_titles = "all" resolve_titles = true
I have some mp3 with filename Track01 Track02....etc and they have titles. Now it seems only the playing file will show the title. Other file will show the filename until they are played. Is it possible to resolve title also for local file like for url?
Thanks for your reading.
I think this is currently not trivial since mpv doesn't load files before they are played. So the lua API doesn't have access to the titles, they are only cached once the file has been loaded.
It could be possible to run a subprocess to fetch the title metadata with some program but it easily gets messy. I'm not aware of a way to do it with the mpv binary. Perhaps ffmpeg could do it.
OK, i undestand, thanks for your reply ^^
Let's keep this open since it's a nice feature. Hopefully someone can come up with a good solution for this.
mediainfo
has a Movie name
field in its output.
ffmpeg seems to be able to do it with the following command: ffmpeg -f ffmetadata pipe:1 -hide_banner -loglevel warning -i [filename]
.
An example of the output to stdout:
;FFMETADATA1
album=Ghost Hound Original Soundtrack
artist=TENG
date=2007
genre=Soundtrack
title=Awake
track=1
encoder=Lavf58.45.100
The title should be easily extractable using string.match(stdout, "title=([^\n\r]+)")
Alternatively, it may be better to use ffprobe, which is bundled with ffmpeg and seems better designed for this.
ffprobe -show_format -show_entries format=tags -print_format ini -loglevel warning [filename]
provides a similarly parsable output with the added advantage of escaping newlines:
# ffprobe output
[format]
[format.tags]
album=Ghost Hound Original Soundtrack
artist=TENG
encoder=Lavf57.36.100
genre=Soundtrack
title=Awake
track=1
creation_time=reation_time
date=2007
This has been implemented by @2084x :+1: