Skip to main content

gstreasy

A re-imagining of gstreamer-python.

Some of the new features:

  • Auto setup/teardown of main loop thread
  • Auto detect caps if in gst-launch command
  • Auto detect and configure appsink and appsrc if in command
  • Support for appsink and appsrc in same pipeline
  • Support for multiple sinks in the same pipeline
  • Faster Gst.Sample -> np.ndarray by caching caps

Example Usage

Install with: python -m pip install gstreasy

Also check out the user_code.py script for an appsrc example. As I write more examples they will appear in the examples/ folder.

Simple pipeline without an appsink element:
simple_cmd = "videotestsrc num-buffers=60 ! autovideosink"
with GstPipeline(simple_cmd) as pipeline:
    print("Running simple pipeline")
Pipeline with an appsink element:
appsink_cmd = "videotestsrc num-buffers=60 ! appsink emit-signals=true sync=false"
with GstPipeline(appsink_cmd) as pipeline:
    while pipeline:
        buffer = pipeline.pop()
        if buffer:
            type(buffer.data)  # np.ndarray
Pipeline using tee element and multiple sinks:
tee_cmd = '''
    videotestsrc num-buffers=60 ! tee name=t
    t. ! queue ! video/x-raw,format=RGB,framerate=60/1
       ! appsink emit-signals=true sync=false
    t. ! queue ! video/x-raw,format=RGB,framerate=60/1
       ! jpegenc ! avimux
       ! filesink location=recording.mp4
'''
with GstPipeline(tee_cmd) as pipeline:
    while pipeline:
        buffer = pipeline.pop()
        # do whatever you want with the buffer's ndarray
    # Meanwhile recording.mp4 is being written

Develop

All dev tasks can be handled with the run.sh script but it just wraps standard tools if you can't/don't want use it.

  • python -m pip install -e .[dev,doc] to install deps
  • tox to run tests for py3.7, py3.10, and py3.11.
  • flake8 and mypy for linting
  • pdoc -d google src/gstreasy for online docs

To help debugging, you can breakpoint inside functions that run on a separate thread, if you insert the following lines just before your breakpoint. Tested on PyCharm but should work with most IDEs. Please remove them before opening your pull request.

import pydevd
pydevd.settrace(suspend=False, trace_only_current_thread=True)

Metadata

Release files for gstreasy 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gstreasy 0.3.1
File Size Uploaded Provenance
gstreasy-0.3.1.tar.gz 15.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for gstreasy 0.3.1
File Interpreter ABI Platform
gstreasy-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / gstreasy-0.3.1.tar.gz

Download URL gstreasy-0.3.1.tar.gz
Size 15.7 kB
Tags Source
SHA-256 checksum
How to use checksums
290185698730ee1f131f225cb6e1f719568e2467ee389d4d686842d7931e0970
BLAKE2b-256 checksum
How to use checksums
9bfe322bc721cda5f1a5e0e0f94473b17dee13b9634b00e248d536c8400ecaf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Release files / gstreasy-0.3.1-py3-none-any.whl

Download URL gstreasy-0.3.1-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca7cc90938fe6e2c93085db06e36688026335568e22691b4b5b3c80b40819a33
BLAKE2b-256 checksum
How to use checksums
d224fd3c4513f76b737e93f895736c930e7e69540be41a04c4d0f446112f14c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.11.3

Security for gstreasy 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

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