Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Example usage

If you don’t need to keep the index, create a video source right away:

>>> import ffms
>>> source_file = "test/x264.mkv"
>>> vsource = ffms.VideoSource(source_file)

Or you can create an indexer:

>>> indexer = ffms.Indexer(source_file)
>>> indexer.format_name
'matroska'
>>> indexer.track_info_list
[TrackInfo(type=0, codec_name='h264')]

Then create the index for the video source:

>>> index = indexer.do_indexing(-1)
>>> track_number = index.get_first_indexed_track_of_type(ffms.FFMS_TYPE_VIDEO)
>>> vsource = ffms.VideoSource(source_file, track_number, index)

Extract information from the video source:

>>> vsource.properties.NumFrames
8
>>> vsource.track.keyframes
[0, 5]
>>> vsource.track.timecodes
[0.0, 1000.0, 2000.0, 3000.0, 4000.0, 5000.0, 6000.0, 7000.0]

Retrieve a video frame:

>>> frame = vsource.get_frame(0)
>>> frame.EncodedWidth, frame.EncodedHeight
(128, 72)
>>> frame.planes[0]
array([16, 16, 16, ..., 16, 16, 16], dtype=uint8)

ffmsinfo.py is a demo script showing how this package can be used.

Installation

You can use the setup.py script:

$ ./setup.py install

On Windows, you can use one of the MSI binary packages provided on the download page.

Requirements

The API was designed to be an object-oriented and Pythonic version of the original FFmpegSource API.

Metadata

Release history Release notifications | RSS feed

0.4

2 release files

This release

0.3a1 This release

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page