Get progress information for an ffmpeg process.
Project description
ffmpeg-progress
Get progress information for an ffmpeg process.
This script is based on the work of Rupert Plumridge.
Installation
Poetry
poetry add ffmpeg-progress
Pip
pip install ffmpeg-progress
Usage
Usage: ffmpeg-progress [OPTIONS] FILE
Entry point for shell use.
Options:
-h, --help Show this message and exit.
All unknown arguments passed to ffmpeg-progress
are passed on to ffmpeg
.
Library usage
import subprocess as sp
import sys
from ffmpeg_progress import start
def ffmpeg_callback(in_file: str, outfile: str, vstats_path: str):
return sp.Popen(['ffmpeg',
'-nostats',
'-loglevel', '0',
'-y',
'-vstats_file', vstats_path,
'-i', in_file,
outfile]).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()
start('my input file.mov',
'some output file.mp4',
ffmpeg_callback,
on_message=on_message_handler,
on_done=lambda: print(''),
wait_time=1) # seconds
start()
is the main function to use. If on_message
is not passed, a default function is used.
The on_done
argument is optional. The initial_wait_time
keyword argument can be used to specify
a time to wait before processing the log.
The ffmpeg callback must return a PID (int
). It is recommended to pass -nostats -loglevel 0
to your ffmpeg process. The ffmpeg callback also must pass -vstats_file
given the path from the
callback argument.
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
Built Distribution
File details
Details for the file ffmpeg_progress-0.0.5.tar.gz
.
File metadata
- Download URL: ffmpeg_progress-0.0.5.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.9 Linux/6.14.0-gentoo-limelight
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
a000aebe1e883d746da5d10d3a0d069bec640be2990356e195da470314634ef3
|
|
MD5 |
f220d8de67ecb51077de522018a4fda2
|
|
BLAKE2b-256 |
897f489981ed0dbcdca10d46e888db8a645eebf45df5b429bb3cd497e6742626
|
File details
Details for the file ffmpeg_progress-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: ffmpeg_progress-0.0.5-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.9 Linux/6.14.0-gentoo-limelight
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e36a834a6e61c0b91cb51ebf40a0267287314ee272b4cabc9f22c8def8d7d0df
|
|
MD5 |
345d076b2663f00577c6571abe756c48
|
|
BLAKE2b-256 |
d5d48cb8c411569ba27a9733da9febb45b33a3bd6a8e0a72d8980e73e28a09bb
|