ffmpeg-progress¶
Commands¶
ffmpeg-progress¶
Entry point for shell use.
ffmpeg-progress [OPTIONS] FILE
Arguments
- FILE¶
Required argument
Library¶
ffmpeg-progress library.
-
ffmpeg_progress.lib.start(in_file: str | Path, outfile: str | Path, ffmpeg_func: FFMPEGCallingFunction, on_message: OnMessageCallback | None =
None, on_done: collections.abc.Callable[[], None] | None =None, index: int =0, wait_time: float =1.0, initial_wait_time: float =2.0) None¶ Start the process.
Pass an input file path, an output file path, and a callable.
The callable
(signature: (in_file, outfile, vstats_file) -> Any)passed in is expected to start the ffmpeg process and pass the given stats path to the process (last argument):ffmpeg -y -vstats_file ... -i ...The on_message argument may be used to override the messaging, which by default writes to
sys.stdoutwith basic information on the progress. It receives 4 arguments: percentage, frame count, total_frames, elapsed time in seconds (float).If the FPS or the total number of frames cannot be calculated from the input file with ffprobe, an
FFMPEGProgressErrorwill be raised.The
wait_time(seconds) argument may be used to slow down the number of messages. A higher wait time will mean fewer messages. Very small values may not work.The
initial_wait_time(seconds) argument may be used to set an initial interval to wait before processing the log file.Only Linux is supported at this time.
- Parameters:¶
- in_file : str | Path¶
Input file.
- outfile : str | Path¶
Output file.
- ffmpeg_func : FFMPEGCallingFunction¶
The function running ffmpeg.
- on_message : OnMessageCallback | None¶
The on-message callback.
- on_done : Callable[[], None] | None¶
Completion callback.
- index : int¶
Stream index.
- wait_time : float¶
Wait time between messages. Seconds.
- initial_wait_time : float¶
Wait time before processing log file. Seconds.
- Raises:¶
Utility functions.
- ffmpeg_progress.utils.default_on_message(percent: float, fr_cnt: int, total_frames: int, elapsed: float) None¶
Write a simple progress report to standard output.
Default callback for
display().
Constants.
Exceptions.
- exception ffmpeg_progress.exceptions.FFMPEGProgressError¶
General error.
- exception ffmpeg_progress.exceptions.InvalidFPS¶
Raised when the FPS string is invalid.
- exception ffmpeg_progress.exceptions.InvalidPID¶
Raised when the ffmpeg callback does not return a valid PID.
- exception ffmpeg_progress.exceptions.NoDuration¶
Raised when duration cannot be determined.
- exception ffmpeg_progress.exceptions.ProbeFailed¶
Raised when ffprobe fails.
- exception ffmpeg_progress.exceptions.TotalFramesLTEZero¶
Raised when total frames is calculated to be less than or equal to zero.
- exception ffmpeg_progress.exceptions.UnexpectedZeroFPS¶
Raised when the FPS is calculated to be zero.
Typing¶
Typing helpers.
- class ffmpeg_progress.typing.ProbeDict¶
Minimal representation of what ffprobe returns in its JSON output.
- class ffmpeg_progress.typing.ProbeFormatDict¶
Used only to get the duration.
- class ffmpeg_progress.typing.ProbeStreamDict¶
Used only to get the average frame rate string.