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

[Error] float division by zero #7

Closed
janciev opened this issue Oct 15, 2022 · 3 comments
Closed

[Error] float division by zero #7

janciev opened this issue Oct 15, 2022 · 3 comments
Assignees

Comments

@janciev
Copy link

janciev commented Oct 15, 2022

Hi,

when I run the script with the progress_handler I see the error message:

(env) [xxxx]$ /Users/[xxxx]/env/bin/python [xxxx]test_runner.py
Running: ffmpeg -y -i [xxxx] -c:a libmp3lame -y output.mp3 -loglevel verbose -progress pipe:1 -nostats
0%| | 0/384.304 [00:00<?, ?s/s]
[Error] float division by zero
Exiting Better FFmpeg Progress.

The code below:

from better_ffmpeg_progress import FfmpegProcess

def handle_progress_info(percentage):
print(f"The FFmpeg process is {percentage}% complete. ETA is / seconds.")

process = FfmpegProcess(["ffmpeg", "-i", "[xxxx]", "-c:a", "libmp3lame", "-y", "output.mp3"], )
process.run(progress_handler=handle_progress_info)

@janciev
Copy link
Author

janciev commented Oct 15, 2022

better-ffmpeg-progress==2.0.5
ffmpeg-python==0.2.0
future==0.18.2
tqdm==4.64.1

@CrypticSignal
Copy link
Owner

What might be the issue is that the duration of your file was incorrectly determined to be 0, in which case division by 0 will occur on this line.

I'll add a conditional to only run (seconds_processed / self._duration_secs) * 100 if self._can_get_duration is True. I'll let you know when I have added this change, after which please upgrade to the latest version of better-ffmpeg-progress and let me know if this fixes the issue.

@CrypticSignal CrypticSignal self-assigned this Oct 16, 2022
@CrypticSignal
Copy link
Owner

Can you upgrade to version 2.0.6 with pip3 install better-ffmpeg-progress --upgrade and let me know if this fixes the issue?

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