I've seen some people achieving to scrape out live progress data from ffmpeg subprocess. But for non-command line execution, how could this be accomplished?
For example I want to store this real-time information on the command line output line by line or get the progress percentage to the completion.
import ffmpeg
import threading
def ffmpeg_func(path1, path2, path3):
global out, err
video_part = ffmpeg.input(path1)
audio_part = ffmpeg.input(path2)
ffm = ffmpeg.output(audio_part, video_part, path3).overwrite_output().run_async(pipe_stdout=True)
out, err = ffm.communicate()
threading.Thread(target=ffmpeg_func, args=(<<vid_part_path>>, <<audio_part_path>>, <<output_path>>)).start()
I used threading.Thread
because I'm intending to execute multiple ffmpeg process at the same time.