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.1.tar.gz
(3.5 kB
view hashes)
Built Distribution
Close
Hashes for ffmpeg_progress-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfeb2c84970b701144b9fbe35a0081fe3bff01c2dc620f1179f30b396b7d8e6a |
|
MD5 | e938d258cc5747469682c0e76aec0cb6 |
|
BLAKE2b-256 | 6106c1c62754aed6b53b39c64cfe09a6fe81ad33a99ce5ea3147aaec80604575 |