Skip to content
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

Implement stdout message format argument for vmaf command #269

Open
stderr-to-devnull opened this issue Jan 11, 2025 · 2 comments
Open

Implement stdout message format argument for vmaf command #269

stderr-to-devnull opened this issue Jan 11, 2025 · 2 comments

Comments

@stderr-to-devnull
Copy link

When running ab-av1 vmaf, I want to keep the normal output (progress) but there should be an option for VMAF score to be printed to stdout. Basically the --stdout-format argument behavior for sample-encode command.

In Linux, I tried a workaround by attempting to store the normal output in a variable but also print it to terminal with:

vmaf_output=$(ab-av1 vmaf [...] |& tee /dev/tty)

[2025-01-11T03:41:39Z INFO  ab_av1::command::vmaf] 2%, 147 fps, eta 16 minutes
[2025-01-11T03:41:55Z INFO  ab_av1::command::vmaf] 3%, 145 fps, eta 15 minutes

Unfortunately this causes ab-av1 to change its output because it is now piped, as can be seen above. I do not find any usefulness to this behavior, especially because it prints data at a very slow interval - every 16 seconds - for whatever reason.

With an option like --stdout-format, I can at least redirect stdout to a file and read the score from there and also have the normal progress output in the terminal.

Alternatively, the --enc argument could be made available to the vmaf command and then I could use it to pass ffmpeg's -progress argument like this: --enc progress=/path/to/file.

@alexheretic
Copy link
Owner

  • The change in output behaviour is useful to me at least, it doesn't make sense to output bars when stderr is not a tty better to have logged progress. This is nice when using the tool with a backgroud task manager like pueue. So I think the default is ok, but we can make this behaviour configurable.
  • Yes vmaf command should support --stdout-format, it's just that no-one has asked for that before and I haven't needed it.
  • --enc is for encoding rather than vmaf, but yes it would be nice to be able to pass ffmpeg args to the vmaf call here and in other commands.

@stderr-to-devnull
Copy link
Author

TL;DR version: implementing an option to not change ab-av1 output when piped would pretty much resolve everything

Longer answer

  • I understand the current rationale, though in my scenario
    • I want to keep the visual progress feedback while still storing the resulting VMAF score; the tty output has the progress bar and also the elapsed, eta and fps stats which are quite useful to get a human sense of the progress
    • this is made difficult by the non-configurable behavior when output is piped / not to a tty
    • I found a wonky workaround of tricking ab-av1 to think it is outputting to tty via a function (faketty) which I call and provide the ab-av1 command as its argument: https://stackoverflow.com/a/20401674/3130850
  • implementing --stdout-format would fix the issue with storing the VMAF score separately from the captured output, though I would still need to use the faketty function to prevent ab-av1 from changing its output format and update frequency
  • the --enc proposal is to leverage the current implementation of ffmpeg's -progress option
    • to exemplify and elaborate, this is how I currently implemented a custom encoding progress bar with some stats around it, by running ffmpeg in background and in a detached state, using -progress /path/to/stats_file option, then reading the encoding progress from the stats file and displaying it in the form I want
    • hopefully, being able to pass -progress /path/to/stats_file to ffmpeg via --enc, would enable me to implement a custom progress bar in a similar manner (as described above with the encoding scenario) and also store the resulting VMAF score, without the need to trick ab-av1 so I can display its own progress bar
    • this ffmpeg feature would actually be very nice to implement for ab-av1 as well (progress stats to stdout or to a file) as it would make sense in the context of its mission statement and would resolve all issues with the output; currently ab-av1 does do this in a manner of speaking but the update interval is very slow at 16s, compared to ffmpeg's default 1s (which is configurable to be even shorter if desired)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants