Skip to main content

Convenience facilities for using FFmpeg (ffmpeg.org), with invocation via ffmpeg-python.

Latest release 20241122: Honour the $FFMPEG_DOCKER_IMAGE environment variable.

Class ConversionSource(builtins.tuple)

ConversionSource(src, srcfmt, start_s, end_s)

ConversionSource.end_s: Alias for field number 3

ConversionSource.src: Alias for field number 0

ConversionSource.srcfmt: Alias for field number 1

ConversionSource.start_s: Alias for field number 2

convert(*srcs, dstpath: str, doit=True, dstfmt=None, ffmpeg_exe=None, fstags: Optional[cs.fstags.FSTags] = <function <lambda> at 0x10a3b6950>, conversions=None, metadata: Optional[dict] = None, timespans=(), overwrite=False, acodec=None, vcodec=None, extra_opts=None) -> List[str]

Transcode video to dstpath in FFMPEG compatible dstfmt.

ffmpeg_docker(*ffmpeg_args: Iterable[str], docker_run_opts: Union[List[str], Mapping, NoneType] = None, doit: Optional[bool] = None, quiet: Optional[bool] = None, ffmpeg_exe: Optional[str] = None, docker_exe: Optional[str] = None, image: Optional[str] = None, output_hostdir: Optional[str] = None) -> Optional[subprocess.CompletedProcess]

Invoke ffmpeg using docker.

Class FFmpegSource

A representation of an ffmpeg input source.

FFmpegSource.add_as_input(self, ff): Add as an input to ff. Return None if self.source is a pathname, otherwise return the file descriptor of the data source.

Note: because we rely on ff.input('pipe:') for nonpathnames, you can only use a nonpathname FFmpegSource for one of the inputs. This is not checked.

FFmpegSource.promote(source): Promote source to an FFmpegSource.

ffprobe(input_file, *, doit=True, ffprobe_exe='ffprobe', quiet=False)

Run ffprobe -print_format json on input_file, return format, stream, program and chapter information as an AttrableMapping (a dict subclass).

main_ffmpeg_docker(argv=None)

The ffm[peg-docker command line implementation.

Class MetaData(cs.tagset.TagSet)

Object containing fields which may be supplied to ffmpeg's -metadata option.

MetaData.__init__(self, format, **kw): pylint: disable=redefined-builtin

MetaData.options(self): Compute the FFmpeg -metadata option strings and return as a list.

Release Log

Release 20241122: Honour the $FFMPEG_DOCKER_IMAGE environment variable.

Release 20240519: ffmpeg_docker: set DockerRun.output_hostdir from the output file dirname.

Release 20240316.1: DISTINFO fix.

Release 20240316: Fixed release upload artifacts.

Release 20240201:

  • New $FFMPEG_EXE envvar.
  • convert: use $FFMPEG_EXE, return the ffmpeg argv.
  • convert: include the media type in DEFAULT_CONVERSIONS, refactor the choice of codec conversion.
  • convert: supply dummy results if doit is false - could do with some finesse.
  • ffmpeg_docker: use DockerRun.{add_input,add_output}.
  • New main_ffmpeg_docker to support the ffmpeg-docker command, add ffmpeg-docker to DISTINFO scripts.

Release 20231202: Initial PyPI release.

Release files for cs-ffmpegutils 20241122

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

Source distribution (sdist)

Source distribution for cs-ffmpegutils 20241122
File Size Uploaded
cs_ffmpegutils-20241122.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cs-ffmpegutils 20241122
File Interpreter ABI Platform
cs_ffmpegutils-20241122-py3-none-any.whl Python 3 none any Details

Total release size: 15.0 kB

Release files / cs_ffmpegutils-20241122.tar.gz

Download URL cs_ffmpegutils-20241122.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
61d801383c762b0dbf5d15fb2be420e94d6a32b3991b05da91b6f272c451b8c8
BLAKE2b-256 checksum
How to use checksums
2dd1b1455d0564032fe9d32c892f396776a2e95b31cead1096beb608ca082bc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.6

Release files / cs_ffmpegutils-20241122-py3-none-any.whl

Download URL cs_ffmpegutils-20241122-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f2eef25788e6cfdbfd7333e4b0e68d6e8010141de0a92bef3368fd0684f4436
BLAKE2b-256 checksum
How to use checksums
e481b2a589b9213f3d4817f3f1954adc43686154ee1327fc25d9ea101d211e2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.6

Release history Release notifications | RSS feed

This release

20241122 This release

2 release files

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