Get progress information for an ffmpeg process.
Project description
ffmpeg-progress
This script is based on the work of Rupert Plumridge.
Basic use
import subprocess as sp
import sys
from ffmpeg_progress import start
def ffmpeg_callback(infile: str, outfile: str, vstats_path: str):
p = sp.Popen(['ffmpeg',
'-y',
'-vstats_file', vstats_path,
'-i', infile,
outfile], stdout=sp.PIPE, stderr=sp.PIPE)
return p.pid
def on_message_handler(percent: float,
fr_cnt: int,
total_frames: int,
elapsed: float):
sys.stdout.write('\r{:.2f%}'.format(percent))
sys.stdout.flush()
def on_done_handler():
print('')
start('my input file.mov',
'some output file.mp4',
ffmpeg_callback,
on_message=on_message_handler,
on_done=on_done_handler,
wait_time=1) # seconds
start()
is the main function to use. If on_message
is not passed, a default function is used.
ffprobe
An ffprobe front-end function is included. Usage:
from ffmpeg_progress import ffprobe
ffprobe('my file.mp4') # returns a dict()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ffmpeg-progress-0.0.2.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for ffmpeg_progress-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be067d3b14cad3a0c5cbcbbdf37583f4804be3dd09041444dc84284285c064f6 |
|
MD5 | 57ce5351488c1fe732035c7b314e3b32 |
|
BLAKE2b-256 | fcfb158d27ddaeeb29cb7e0ec0ff3d95562ad8123e1be626c3da3043018ada5a |