spdl.io.demux_config

demux_config(**kwargs) DemuxConfig[source]

Customize demuxing behavior.

Parameters:
  • format (str) – Optional Overwrite format. Can be used if the source file does not have a header.

  • format_options (dict[str, str]) – Optional Provide demuxer options

  • buffer_size (int) – Opitonal Override the size of internal buffer used for demuxing.

Returns:

Config object.

Example: Loading headeless audio file (raw PCM)

>>> import asyncio
>>> import spdl.io
>>>
>>> # Say, this file contains raw PCM samples.
>>> # One way to generate such a file is,
>>> # ffmpeg -f lavfi -i 'sine=duration=3' -f s16le -c:a pcm_s16le sample.raw
>>> src = "sample.raw"
>>>
>>> # This won't work
>>> # packets = asyncio.run(spdl.io.async_demux_media("audio", src))
>>>
>>> # This works.
>>> cfg = demux_config(format="s16le")
>>> packets = asyncio.run(spdl.io.async_demux_audio(src, demux_config=cfg))
>>>