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

Programmatic output? #241

Open
mjc opened this issue Nov 29, 2024 · 2 comments
Open

Programmatic output? #241

mjc opened this issue Nov 29, 2024 · 2 comments

Comments

@mjc
Copy link

mjc commented Nov 29, 2024

It would be fabulous if there was an easy way to spit out json or some other kind of easily parsed output.

Is this something you'd take a PR for?

@alexheretic
Copy link
Owner

This does exist for sample-encode with the --stdout-format option. The idea of this is you can use this in a script to do custom stuff like a different search approach to crf-search.

It should be fairly doable to add similar --stdout-format support to crf-search. We'd need to flesh out the motivation, requirements/desired behaviour of this.

@mjc
Copy link
Author

mjc commented Dec 12, 2024

I'm building a web ui in my off time. I hope to open source it by the end of the year, I am tired of using shell scripts. I really dislike the closed source solutions that exist, and the open ones are too complicated for my use case.

It's basically a replacement for fd [...] -x ab-av1 auto-encode [...] that will pick either the fastest file to encode or the biggest size reduction first.

It would be very helpful for the programmatic mode for crf-search to have the input file and target vmaf on every possible line, at a minimum.

Here's the regexes I'm using atm, with named captures for bits I'm using. I can put more comments in about usage next time I have time outside work hours, if you need:

 @encoding_sample_regex ~r/
    # I plan on making a chart for these. input file would be helpful, as well as target vmaf.
    encoding\ssample\s
    (?<sample_num>\d+)\/             # Capture sample number
    (?<total_samples>\d+)\s          # Capture total samples
    crf\s
    (?<crf>\d+(\.\d+)?)              # Capture CRF value
  /x

  @simple_vmaf_regex ~r/
    ^-\scrf\s
    (?<crf>\d+(\.\d+)?)\s            # Capture CRF value
    VMAF\s
    (?<score>\d+\.\d+)\s             # Capture VMAF score
    \((?<percent>\d+)%\)             # Capture percentage
  /x

  @sample_regex ~r/
    sample\s
    (?<sample_num>\d+)\/             # Capture sample number
    (?<total_samples>\d+)\s          # Capture total samples
    crf\s
    (?<crf>\d+(\.\d+)?)\s            # Capture CRF value
    VMAF\s
    (?<score>\d+\.\d+)\s             # Capture VMAF score
    \((?<percent>\d+)%\)             # Capture percentage
  /x

  @eta_vmaf_regex ~r/
    # It would be helpful to have the input path here
    crf\s
    (?<crf>\d+(\.\d+)?)\s            # Capture CRF value
    VMAF\s
    (?<score>\d+\.\d+)\s             # Capture VMAF score
    predicted\svideo\sstream\ssize\s
    (?<size>\d+\.\d+)\s              # Capture size
    (?<unit>\w+)\s                   # Capture unit
    \((?<percent>\d+)%\)\s           # Capture percentage
    taking\s
    (?<time>\d+)\s                   # Capture time
    (?<time_unit>seconds|minutes|hours) # Capture time unit
  /x

  @vmaf_regex ~r/
    # currently I parse a bunch of stuff out of the filenames here.
    vmaf\s
    (?<file1>.+?)\s                  # Capture first file name
    vs\sreference\s
    (?<file2>.+)                     # Capture second file name
  /x

  @progress_regex ~r/
    \[.*\]\s
    (?<progress>\d+%)?,\s            # Currently I dont display this but I will.
    (?<fps>\d+\sfps)?,\s             # Currently I dont display this but I will.
    eta\s
    (?<eta>\d+\sseconds)             # Knowing ETA more often would be helpful even if its less accurate
  /x

  @success_line_regex ~r/
    # It would be helpful to have the path, target vmaf, percentage, vmaf score, time taken, and path in here.
    \[.*\]\s
    crf\s
    (?<crf>\d+(\.\d+)?)\s            # Capture CRF value from this one to know which CRF was selected.
    successful
  /x

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