ffmpeg-python icon indicating copy to clipboard operation
ffmpeg-python copied to clipboard

How to wait until operation is completed

Open kamrapooja opened this issue 3 years ago • 1 comments

We are using ffmpeg python binding to extract audio from given video file. Code sample - try: out, err = (ffmpeg .input(in_filename) .output(out_file, format='s16le', acodec='pcm_s16le', ac=1, ar='16k', ab='160k') .run(capture_stdout=True, capture_stderr=True) ) except ffmpeg.Error as e: print(e.stderr, file=sys.stderr) sys.exit(1) print("hello")

Here hello gets printed before generating the audio file. Is there any way to wait until audio file generation is completed? Please help.

kamrapooja avatar Oct 03 '22 07:10 kamrapooja

Please assist.

kamrapooja avatar Oct 07 '22 05:10 kamrapooja

try: ''' ffmpeg -i 7.mkv -map 0:a -acodec copy audio.mp4 ffmpeg -i audio.mp4 -ac 2 -af "volume=15dB" a3.mp4 ffmpeg -i 7.mkv -i a3.mp4 -map 0:v -map 0:s:1 -map 1:a -c copy 7ren.mkv ''' audioInputPath = outputAudioPath outputAudioPath = mediaFileDir + "/audioDownMixed.mp4" downMixedAudioPath = outputAudioPath process = ( ffmpeg.input(audioInputPath).output(outputAudioPath, **{"ac": "2", "af": "volume=15dB"}).run( capture_stdout=True, capture_stderr=True, quiet=False, overwrite_output=True) ) print("Audio DownMix Process Finished") out = process[0] err = process[1] print("out " + str(out)) print("err " + str(err)) except subprocess.CompletedProcess: print("Audio Down MIx process completed") except subprocess.TimeoutExpired: print("Proc expired") except: print("Except in using fffmpeg libstep One ") traceback.print_exc()

Audio Down mixed info is printed

Murali1981 avatar Mar 02 '23 10:03 Murali1981