I want to convert mp4 file to mp3 file using write_audiofile function from moviepy library and display the progress in PyQT5 app using progressbar.
when I use:
mp4audio.write_audiofile(filename, logger="bar")
it shows a progress bar in console, so can I somehow access that progress variable and use it to update my progress bar in PyQt5 app?
I also tried this:
from proglog import ProgressBarLogger
from my_library import my_routine
class MyBarLogger(ProgressBarLogger):
def callback(self, **changes):
# Every time the logger is updated, this function is called with
# the `changes` dictionnary of the form `parameter: new value`.
for (parameter, new_value) in changes.items():
print ('Parameter %s is now %s' % (parameter, value))
logger = MyBarLogger()
my_routine(logger=logger)
but it only writes down messages when starts and when ends. Not the progress.
Parameter message is now MoviePy - Writing audio in C:/Users/.../file.mp3
Parameter message is now MoviePy - Done.
Does anyone knows the solution, please?
Doesn't seem to be well documented by
proglog
butcallback
ofProgressBarLogger
gains access to one time messages, butbars_callback
is required for the progress itself: