Skip to content

cli.output: remove VLC stream metadata variables #6251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

bastimeyer
Copy link
Member

VLC allows having custom variables in its --input-title-format parameter value for displaying certain stream metadata, for example $a for the stream author metadata or $t for the stream title metadata.

To avoid unintended variable substitution, $ characters need to be escaped by replacing $ with $$.

https://wiki.videolan.org/Documentation:Format_String/

When Streamlink's --title argument was implemented in 5c3cf57, a workaround was added for VLC, so users could escape a dollar sign with a leading backslash in the --title value, so the resulting \$$ sequence would be turned back into a regular $, allowing VLC to interpret stream metadata variables.

However, the title value that's passed to PlayerOutput is already formatted by the CLI's Formatter instance, which means that it can include arbitrary plugin metadata, like stream IDs, author names, category names, stream titles, etc.

This means that if the user has for example set --title to {title} and the plugin's title metadata includes the \$ sequence, then this will be turned into a single $ character, making VLC interpret it and its following character as a stream metadata variable.

Fix this by removing the flawed dollar sign escape logic.


resolves #4205

VLC allows having custom variables in its --input-title-format parameter
value for displaying certain **stream metadata**, for example `$a` for
the stream author metadata or `$t` for the stream title metadata.

To avoid unintended variable substitution, `$` characters need to be
escaped by replacing `$` with `$$`.

https://wiki.videolan.org/Documentation:Format_String/

When Streamlink's --title argument was implemented in 5c3cf57,
a workaround was added for VLC, so users could escape a dollar sign
with a leading backslash in the --title value, so the resulting `\$$`
sequence would be turned back into a regular `$`, allowing VLC
to interpret stream metadata variables.

However, the title value that's passed to `PlayerOutput` is already
formatted by the CLI's `Formatter` instance, which means
that it can include arbitrary **plugin metadata**, like stream IDs,
author names, category names, stream titles, etc.

This means that if the user has for example set `--title` to `{title}`
and the plugin's `title` metadata includes the `\$` sequence, then
this will be turned into a single `$` character, making VLC interpret
it and its following character as a stream metadata variable.

Fix this by removing the flawed dollar sign escape logic.
Copy link
Member

@gravyboat gravyboat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change!

@bastimeyer bastimeyer merged commit 14eb46a into streamlink:master Oct 17, 2024
23 checks passed
@bastimeyer bastimeyer deleted the cli/output/remove-vlc-title-variables branch October 17, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Player variables in --title
2 participants