-
Notifications
You must be signed in to change notification settings - Fork 54
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
progress event support #23
Comments
@astroza is there any way to get progress of remaining time or something like that ? or like 50% complete |
Hi thanks |
Any news on this? |
Hi @Benny739, I have had no response from the repo owner. Nevertheless, you can find an working branch (it's used on a company) here https://github.com/astroza/ffmpy/tree/progress_support_v2 movie_description = ....
def on_progress(state):
progress = (float(state.time or state.start_time) / movie_description.duration) * 100
print(progress)
ff = ffmpy.FFmpeg(
global_options="-hide_banner -nostdin -y -stats",
inputs={local_input_path: None},
outputs={local_output_path: None}
)
print(ff.run(on_progress=on_progress)[1]) state object has all what you need |
Thanks a lot, this is exactly what I was looking for. @Ch00k merging this into the package would be wonderful. |
Hi @astroza,
I'm basically using your code. |
Sorry I can’t help you, it seems unrelated to the library (according you stack trace) and I can’t see your code |
I found the bug, it's caused by piping and not closing stdin and stderr. In the wait function after the while loop I close stdin and stderr now, and the warning is gone.
|
Hi,
I was working on a transcoding platform and I found your module to wrapping ffmpeg. I'm interested to make improvements that would be useful to everyone involved in this niche.
I'm planning to replace Popen.communicate call to achieve the goals:
Popen.communicate() is inefficient because of stdout and stderr buffering. Let's see some cases:
Use case 1:
you want to send transcoded data over network as fast as available. If communicate() is used, you must to accumulate the entire transcoded movie on a memory buffer to send it.
Use case 2:
you want to know the transcoding state (output size, time, bitrate) in real time. If communicate() is used, you can't do it because this method is consuming the stderr pipe
I have a experimental branch with a on_progress callback implemented here:
https://github.com/astroza/ffmpy/tree/progress_support
An usage example is:
Now I'm working to make it backwards compatible. The branch break your API
UPDATE
https://github.com/astroza/ffmpy/tree/progress_support_v2 keeps backward compatibility
Usage:
The text was updated successfully, but these errors were encountered: