Skip to main content

Automatic Demuxer

Package to demux media-files into single file formats to be used elsewhere.

Video tracks are only supported currently

Developed by Jessie Wilson (2022)

Install

pip install AutomaticDemuxer

If using Linux you must also install MediaInfo

sudo apt install mediainfo

Uninstall

pip uninstall AutomaticDemuxer

Examples of How To Use

Video: Example with callback

from automatic_demuxer import AutoDemuxer


def callback_func(x):
    """
    AutoDemuxer will return a dictionary with keys 'output' and 'percent'
    "output" will always display the ffmpeg command line output
    "percent" will return None if there is no track duration OR when the job hasn't fully started/is finished
    "job_pid" will return a pathlike/string of the full path of the output filename
    """
    print(x["output"])
    print(x["percent"])
    print(x["job_pid"])

    # check if x["percent"] is not none before using output
    if x["percent"]:
        print(f"do something with {str(x['percent'])}")


demux = AutoDemuxer()
demux.video_demux(file_input=r"fileinput.mkv", callback=callback_func)


Video: Example without callback

When not using callback the FFMPEG output is automatically printed to console in the format of a string. This does not include percentage.

from automatic_demuxer import AutoDemuxer

demux = AutoDemuxer()
demux.video_demux(file_input=r"fileinput.mkv")


Video: Return status

from automatic_demuxer import AutoDemuxer

demux = AutoDemuxer()
demux.video_demux(file_input=r"fileinput.mkv")

# To print the return code
print(demux.status["return_code"])

# To print the output file name
print(demux.status["output_filename"])

# To print a completed status (completed internally by checking the output path name and getting a return code of 0)
# This will return "Ok" or "Error"
print(demux.status["status"])

Video Parameters

file_input String or Pathlike path to input file.

ffmpeg_path String or Pathlike path to ffmpeg.
Optional: Will raise an error if not found on path or defined

track_number Track number based off of ffmpeg stream selection or mediainfo's 'Stream identifier'.
Optional: Defaults to 0

suffix String to define the output ending suffix.
Optional: Defaults to "_out_"

insert_delay Bool to insert delay string into filename output if delay is detected.
Optional: Defaults to True

video_output_extension The output extension in the form of a string. e.g. "mkv" or ".mkv"
Optional: Defaults to "mkv"

callback Log callback progress to a variable instead of printing to console
Optional: Defaults to None

fallback_ext Extension in the form of a string. e.g. "mkv" or "mp4". Default is "mkv", if changed the program will fall back to what ever extension is selected
Optional: Defaults to "mkv"

Release files for AutomaticDemuxer 1.34

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

Source distribution (sdist)

Source distribution for AutomaticDemuxer 1.34
File Size Uploaded
AutomaticDemuxer-1.34.tar.gz 7.4 kB Details

Release files / AutomaticDemuxer-1.34.tar.gz

Download URL AutomaticDemuxer-1.34.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1c10a58f4baed14b8ab341af1b11acf2f956f85843f4f96ea1d5d143a16446d9
BLAKE2b-256 checksum
How to use checksums
0ffa417b8a161e636fde32b2de28b787071cf83252a2d56d8da8937dcd6aba27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.8

Release history Release notifications | RSS feed

This release

1.34 This release

1 release file

1.33

1 release file

1.32

1 release file

1.31

1 release file

1.3

1 release file

1.2

1 release file

1.1

1 release file

1.0

1 release file

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