Skip to content

Improve handling of ffmpeg output #87

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

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

gingerbreadassassin
Copy link

@BotBlake
Copy link
Owner

Hi there @gingerbreadassassin .
First of all I want to thank you for using and contributing to jellybench!

Now regarding the topic about the speed value not being reported by ffmpeg in some cases.
In my personal oppinion, there is no point in continuing the benchmark, or at least the run, when ffmpeg is not delivering usefull output.
Just "faking" output with the speed or zero seems like a hacky approach.
How would you like the idea of marking the run as failed when any ffmpeg process doesnt report its speed.
Also I would suggest to add a warning in the logger whenever the output cannot be parsed properly.

In general the script heavily relies on ffmpeg reporting the speed to calculate results and scale up the worker count accordingly.
Therefore overwriting that value with anything might have unexpected consequences.

I look forward to your thoughts on these suggestions.
Kind regards.

@gingerbreadassassin
Copy link
Author

gingerbreadassassin commented Mar 19, 2025

seems like a hacky approach

💯 it is

marking the run as failed when any ffmpeg process doesnt report its speed

Agree the proper way to handle this would be a try/except clause. I almost started working on that, but my main objective was just to get the benchmark to complete, not to read through the whole script to figure out where best to put the error handling.

In general the script heavily relies on ffmpeg reporting the speed to calculate results and scale up the worker count accordingly.
Therefore overwriting that value with anything might have unexpected consequences.

This is the understanding of the benchmarking tool that I lacked, and why I opened the PR with what I had "working" for discussion. I wasn't sure how much this would affect the outcome of the benchmark. If I have time between work tomorrow, I'll give the more appropriate approach a shot.

Copy link
Owner

@BotBlake BotBlake left a comment

Choose a reason for hiding this comment

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

I understand the need for a fix, however its not an option to just "ignore" that REQUIRED VALUES are sometimes straight up missing.

Additionaly this implementation is not ideal, as it introduces redundant value checking.
Also if the speed value is missing entirely, the issue will just continue to show up!

@@ -356,8 +356,8 @@ def benchmark(ffmpeg_cmd: str, debug_flag: bool, prog_bar, limit=0) -> tuple:
result = {
"max_streams": max_pass,
"failure_reasons": failure_reason,
"single_worker_speed": max_pass_run_data["speed"],
"single_worker_rss_kb": max_pass_run_data["rss_kb"],
"single_worker_speed": max_pass_run_data.get("speed", 0),
Copy link
Owner

Choose a reason for hiding this comment

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

Sets speed to zero - The Client may try to downscale the ammount of workers, or not mark this run instantly as failed.
Additionaly, why is this access protected in core.py? Shouldn't it be ALWAYS written to in worker.py in the first place?

In fact, this PR already introduces the handling of this value in worker.py - this is just duplicated code.

This should not be done this way.
Specifically the lack of this value indicates a greater issue.
The run should be marked as failed.

"single_worker_speed": max_pass_run_data["speed"],
"single_worker_rss_kb": max_pass_run_data["rss_kb"],
"single_worker_speed": max_pass_run_data.get("speed", 0),
"single_worker_rss_kb": max_pass_run_data.get("rss_kb", 0),
Copy link
Owner

Choose a reason for hiding this comment

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

Sets lasts run rss_kb to zero if not available - This has no effect on the runtime, but on the results.
Its just FALSE that the single worker_rss was zero.
Additionaly, why is this access protected in core.py? Shouldn't it be ALWAYS written to in worker.py in the first place?

Even though this does not introduce greater issues, the lack of this value indicates there are other issues to be solved.

@@ -122,6 +122,8 @@ def workMan(worker_count: int, ffmpeg_cmd: str, passed_logger: Logger) -> tuple:
workrss = float(
rssline[1].split("=")[-1].replace("kB", "").replace("KiB", "")
) # maxrss
else:
workrss = 0
Copy link
Owner

Choose a reason for hiding this comment

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

Sets lasts run rss_kb to zero if not available - This has no effect on the runtime, but on the results.
Its just FALSE that the single worker_rss was zero - sure, WE know it, but the server does not when it tries to interpret the data.

Even though this does not introduce greater issues, the lack of this value indicates there are other issues to be solved.

speed = new_line[6].split("=")[-1].replace("x", "")
if speed == "N/A":
speed = 0
speeds.append(float(speed))
Copy link
Owner

Choose a reason for hiding this comment

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

What if the speed value doesnt exist at all instead of being written to with "N/A"?
Then converting to a float would not be possible.
Thats specifically the issue here.

Also its not clear what causes ffmpeg to not report this value.
Imo it points to other issues!

Anyways_
The results of ANY run that wasnt abled to gather valid result data from ffmpeg should NEVER be marked as healthy!
Having valid result data would indicate this!

Instead the run should be marked as unhealthy, by returning the failure.

@gingerbreadassassin gingerbreadassassin marked this pull request as draft April 1, 2025 20:34
@gingerbreadassassin
Copy link
Author

I understand the need for a fix, however[...]

My sincerest apologies if my last commit re-submitted a request for review; I should've marked this PR as a draft after our previous discussion

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

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy