mpv-player / mpv

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

Export track metadata to filters? #632

Closed ghedo closed 10 years ago

ghedo commented 10 years ago

This is probably a stupid idea, but I was looking into adding support for replaygain to af_volume. Basically it would read replaygain tags from the file during init, and automatically adjust the volume gain without the need to set it manually. The reverse could be interesting too: a filter that calculates the gain (or something like an Chromaprint/Acoustid ID) and then writes it to the file at the end.

AFAICT this is currently not possible, and I'm not quite sure how much work it'd require to export such information to the filters, or if it'd be actually worth the effort, so, any ideas?

ghost commented 10 years ago

Sounds interesting. This probably has to wait until parsing of replaygain tags lands in Libav (there are patches on the Libav mailing list, but not pushed yet).

Yes, you'll have to come up with a way to pass-through this information. Also, af_volume is not inserted by default (only when softvol is active and the volume is changed), so that might be a complication too. Maybe it's better to insert a separate af_volume filter for this. For passing through the data, you can look at AF_CONTROL_SET_VOLUME and af_stream etc.; the filter chain is created in dec_audio.c; volume control is in mixer.c. mixer.c has pretty complicated logic because it has to distinguish between softvol and audio device volume and all that.

ghedo commented 10 years ago

So, this was easier than expected. See #637.