master-of-zen / Av1an

Cross-platform command-line AV1 / VP9 / HEVC / H264 encoding framework with per scene quality encoding
GNU General Public License v3.0
1.51k stars 155 forks source link

Print progress when running without a terminal window #366

Open n00mkrad opened 3 years ago

n00mkrad commented 3 years ago

Is it possible to print the progress (encoded frame count) when av1an is running without a graphical shell?

Right now, making a wrapper is tricky because it's not possible to read av1an's progress, apart from the amount of finished chunks which can be read from the log file.

ffmpeg, for example, does print the progress no matter the shell.

master-of-zen commented 3 years ago

@n00mkrad you can make output more verbose,and showing it per worker with --verbose

n00mkrad commented 3 years ago

Verbose doesn't seem to get logged either - Running av1an (using Process.Start) in my C# .NET environment, I only get these lines, even with --verbose:

Creating lwi index file 98%
Creating lwi index file 99%
Creating lwi index file 100%
Found 3 scenes
Queue: 5 Workers: 4 Passes: 2
Applying extra splits every 240 frames
Params: --end-usage=q --cpu-used=5 --cq-level=20 --kf-max-dist=240 --threads=4
Now at 5 scenes

No kind of progress indicator.

shssoichiro commented 3 years ago

The progress is logged to stderr, so whatever you're calling av1an from will need to capture stderr to read the progress indicator.

n00mkrad commented 3 years ago

The progress is logged to stderr, so whatever you're calling av1an from will need to capture stderr to read the progress indicator.

It does not log any progress to stderr. Tested in C# .NET and CMD.

It only logs this:

Scene detection
Queue: 1 Workers: 1 Passes: 2
Params: --end-usage=q --cpu-used=5 --cq-level=26 --kf-max-dist=240 --threads=4 --enable-dnl-denoising=0 --denoise-noise-level=8
shssoichiro commented 3 years ago

Ah, I see. Then this does seem like an actual issue requiring a code change.

It probably does not make sense to log the progress bar the way it looks on a terminal if there's no terminal, but we can log something at least (probably something more parseable than a big line of blocks).

n00mkrad commented 3 years ago

It would suffice to do it like ffmpeg - Print the percentage, relative speed, and ETA either once a second or every time it changes (e.g. don't log 1% twice) in plain text, obviously no need to have ascii graphics here.

d3xMachina commented 1 year ago

I have the same exact issue here on the latest version. Any news about this ?

gianni-rosato commented 1 year ago

https://github.com/natesales/Av1an

This is what I used to develop rAV1Ator which prints the frames continuously to the shell. This may be what you're looking for

FreezyLemon commented 1 year ago

This is normal behaviour for indicatif - they don't want to output a progress bar into a file or pipe, which is understandable.

This would need extra code to output to stdout/stderr in case there's no terminal - the atty crate might be helpful.

d3xMachina commented 1 year ago

I understanding not having the rust progressbar but i expected something like ffmpeg : image image

Only one line is printed to the stderr and it indicates a simple progress without progress bars.

For now what I did was to use a terminal emulator (winpty) but it was impracticable because it makes it hard to output my own messages to the console while it's processing.

Looks like @gianni-rosato linked fork is doing exactly what I would expect so I will check it out. Edit : The fork only gives a simple progress without fps/frame/time/speed. I will see if I can cook something but I'm not familiar with Rust...

gianni-rosato commented 1 year ago

Update: currently kept up-to-date at https://github.com/gianni-rosato/av1an-progbar

I'm only going to be updating this when I'm also updating rAV1ator, but if someone wants to maintain an up-to-date fork or make a PR for a flag for this functionality, feel free to do so.