The command does not save or even create a file:
ffmpeg -i "video.mp4" -f mp3 "audio.mp3" -vstats_file "log_file.log"
And if you convert to a video file, everything normally creates and writes:
ffmpeg -i "video.mp4" -f mp3 "video.avi" -vstats_file "log_file.log"
Goal: to pull out the time from the log file and bind it to the process bar.
There are no problems with video, everything works. But with the sound does not work.
I tried the command:
ffmpeg -i "video.mp4" -f mp3 "video.avi" >2 "log_file.txt"
But there are other problems popping out. Since I run it all from the Python using the subprocess
module.
ffmpegProc = subprocess.Popen(ffmpegCommand, startupinfo=startupinfo, shell=True)
, I can not kill the running process, because it is started with the attribute shell=True
, and only the shell is killed.
-vstats
is for video encoding statistics. When writing an audio file, there's no video encoding. Use the -progress
option.
ffmpeg -i "video.mp4" -f mp3 "audio.mp3" -progress "log_file.log"
You'll get blocks such as these:
bitrate= 126.2kbits/s
total_size=7695851
out_time_ms=487944127
out_time=00:08:07.944127
dup_frames=0
drop_frames=0
speed=19.5x
progress=continue
Search for the last out_time
and that's your progress status.