Skip to main content

Get progress information for an ffmpeg process.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

ffmpeg-progress

Python versions PyPI - Version GitHub tag (with filter) License GitHub commits since latest release (by SemVer including pre-releases) CodeQL QA Tests Coverage Status Documentation Status mypy pre-commit pydocstyle pytest Ruff Downloads Stargazers

@Tatsh Mastodon Follow

Deprecated

I am no longer maintaining this project. Please seek alternatives:

Overview

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

ffmpeg_progress-0.0.6.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ffmpeg_progress-0.0.6-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file ffmpeg_progress-0.0.6.tar.gz.

File metadata

  • Download URL: ffmpeg_progress-0.0.6.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ffmpeg_progress-0.0.6.tar.gz
Algorithm Hash digest
SHA256 28bf201086df4d59ab8875604ea98369701c7028239f0556dbd08944c61d2617
MD5 a51c74bcd6bc8fc8619b85b96d1860f4
BLAKE2b-256 d638101c84779d1898fb5759cd3de46416d7c4908e2fb51e33ee8617eba0b97b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmpeg_progress-0.0.6.tar.gz:

Publisher: publish.yml on Tatsh/ffmpeg-progress

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ffmpeg_progress-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for ffmpeg_progress-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 68745a4167b6a9a6d682f343679cda538178a0c705f977b21419d16df69836c6
MD5 47de272129efa4fd6c697fd1a4732c1c
BLAKE2b-256 ae263993391c296155905616a285225113503a2ed9969226375ca2a82819ac66

See more details on using hashes here.

Provenance

The following attestation bundles were made for ffmpeg_progress-0.0.6-py3-none-any.whl:

Publisher: publish.yml on Tatsh/ffmpeg-progress

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page