ekisu / mpv-webm

Simple WebM maker for mpv, with no external dependencies.
MIT License
571 stars 33 forks source link

Additional Flags: Add Metadata Title #12

Closed doubutunomorai closed 6 years ago

doubutunomorai commented 6 years ago

I'm trying to have the script add the filename of the source video to the metadata of the created webm as a "Title", so people don't have to ask for sources as often. I added an "--oset-metadata=title=" flag into the additional_flags line so that it reads additional_flags = "--oset-metadata=title=" .. mp.get_property("filename/no-ext"), but it doesn't seem to affect anything. Only using a text string as an argument for "--oset-metadata=title=" doesn't actually influence the metadata either. Is this not what the additional_flags line is for, or am I doing it incorrectly?

ekisu commented 6 years ago

Inside the options table? As this is evaluated when the script launches (which is probably before any video is loaded), mp.get_property("filename/no-ext") might be empty - checking the logs for the actual command line used to encode should confirm that. Also, no, that's not what additional_flags is intended for. You should probably add this to the encode function directly.

Only using a text string as an argument for "--oset-metadata=title=" doesn't actually influence the metadata either.

That's weird. I might look at this later, but AFAIK --ocopy-metadata (which is enabled by default) works, so there's no reason for --oset-metadata to not work as well.

Are you sure your mpv version is updated? --oset-metadata is a quite recent feature, merged only 5 days ago.

doubutunomorai commented 6 years ago

Thank you for your response, it's working now. Adding the "--oset-metadata=title=" .. mp.get_property("filename/no-ext") flag to command did the trick.

bveuille commented 6 years ago

Is there any reason that this isn't the default behavior ? It seems to me that this would be useful to many people and an issue for nobody.

ekisu commented 6 years ago

@bveuille At the time that the issue was opened, --oset-metadata was a pretty recent command, and adding it to the script would most certainly break for most users.

Now, I still think this is a pretty specific usecase, and, well, I don't think it's that useful. It embeds the filename on the metadata, but the filename of the original file is in the resulting encode. Also, it might override existing metadata (notice that metadata is copied by default by mpv).