patch-torchcodec
Patch TorchCodec to use PyAV's bundled FFmpeg — one command, no system FFmpeg needed.
Problem
TorchCodec requires FFmpeg shared libraries (libavcodec.so.62, etc.), but installing FFmpeg system-wide can be complex and may cause version conflicts.
Solution
PyAV already bundles FFmpeg. patch-torchcodec patches TorchCodec's RPATH to find them — no environment variables needed!
Quick Start
pip install torchcodec # install torchcodec (with PyTorch)
pip install patch-torchcodec # install patcher (av & patchelf included)
patch-torchcodec # patches RPATH — done!
That's it. TorchCodec now works:
from torchcodec.decoders import VideoDecoder # ✓ just works
Command Line Options
patch-torchcodec # Patch RPATH (default, recommended)
patch-torchcodec --env-only # Symlinks only (requires LD_LIBRARY_PATH)
patch-torchcodec --status # Check current setup status
patch-torchcodec --verify # Verify TorchCodec works
patch-torchcodec --quiet # Silent mode
Python API
from patch_torchcodec import setup_with_patchelf, verify_torchcodec, is_rpath_patched
# Patch RPATH (recommended) — persists across sessions
setup_with_patchelf(verbose=True)
# Verify
assert verify_torchcodec(require_env=False)
How It Works
- Finds PyAV's bundled FFmpeg in
site-packages/av.libs/ - Creates symbolic links with standard names (e.g.,
libavcodec.so.62) - Patches TorchCodec's
.sofiles withpatchelfto include PyAV's library path in RPATH
Limitations
- Linux only (RPATH is Linux-specific)
- Same virtualenv: PyAV and TorchCodec must be in the same environment
- Re-run after reinstall: If you reinstall TorchCodec, run
patch-torchcodecagain
License
MIT
Metadata
Release files for patch-torchcodec 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| patch_torchcodec-0.1.4.tar.gz | 8.4 kB | Without provenance | Details for patch_torchcodec-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| patch_torchcodec-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for patch_torchcodec-0.1.4-py3-none-any.whl |
Total release size: 16.9 kB
Release files / patch_torchcodec-0.1.4.tar.gz
| Download URL | patch_torchcodec-0.1.4.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
30e835096a5492357c492ead81a6227ce519626be7696e8ef8689b0e3d113850
|
|
BLAKE2b-256 checksum How to use checksums |
297f3d84b9ea3966e93b6bb5b231455cbfdf0a41a620b392dd12b47bbc4a05ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / patch_torchcodec-0.1.4-py3-none-any.whl
| Download URL | patch_torchcodec-0.1.4-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fa0dff6ed2fd7ba1a009b44529f2bb0bdea26665541c5f34a99f5f12c288e24
|
|
BLAKE2b-256 checksum How to use checksums |
7becc7b11a8c38d44a5183bbb87ba528822c5bad0cb5cb8ac2449a517027edaa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for patch-torchcodec 0.1.4
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.