Video Extensions
Check if a file or extension is a video type, and iterate over 34 known video file formats including mp4, mov, avi, mkv, and more. Python port of video-extensions npm package.
Features
- Immutable collection of 34 known video file extensions
- Fast membership checks using
frozenset - Case-insensitive and dot-aware checks
- Works for both extensions and full file paths
- Supports dotfiles (e.g.,
.mov) - Zero dependencies, minimal overhead
Installation
pip install video-extensions
Or using uv:
uv add video-extensions
Usage
Check if an extension is a video type
from video_extensions import is_video_extension
is_video_extension("mp4") # True
is_video_extension(".mov") # True (dot-aware)
is_video_extension("AVI") # True (case-insensitive)
is_video_extension("txt") # False
Check if a file path has a video extension
from video_extensions import is_video_path
is_video_path("movie.mp4") # True
is_video_path("/path/to/video.MOV") # True (case-insensitive)
is_video_path("presentation.avi") # True
is_video_path("document.txt") # False
is_video_path(".mov") # True (dotfile support)
Access the list of video extensions
from video_extensions import VIDEO_EXTENSIONS, VIDEO_EXTENSIONS_LOWER
# VIDEO_EXTENSIONS is a frozenset of all known video extensions
print(len(VIDEO_EXTENSIONS)) # 34
"mp4" in VIDEO_EXTENSIONS # True
"txt" in VIDEO_EXTENSIONS # False
# VIDEO_EXTENSIONS_LOWER contains all extensions in lowercase
# Useful for case-insensitive lookups without calling .lower() repeatedly
"MP4" in VIDEO_EXTENSIONS_LOWER # True (case-insensitive)
# Iterate over all extensions
for ext in sorted(VIDEO_EXTENSIONS):
print(ext)
API Reference
Install with pip install video-extensions and import from video_extensions. Signatures and descriptions below match the source code of video_extensions.
VIDEO_EXTENSIONS
Constant: frozenset with 34 entries.
VIDEO_EXTENSIONS_LOWER
Constant: frozenset with 34 entries.
is_video_extension(ext: str) -> bool
Return True if the given file extension is known to be a video type.
Example
from video_extensions import is_video_extension
is_video_extension("mp4") # True
is_video_extension(".txt") # False
is_video_path(file_path: str) -> bool
Return True if the file path has a video file extension.
Example
from video_extensions import is_video_path
is_video_path("movie.mp4") # True
is_video_path("document.txt") # False
is_video_path("/path/to/video.MOV") # True
Supported Extensions
The package includes support for 34 video file extensions:
- Common formats: mp4, mov, avi, mkv, webm, flv, wmv, mpg, mpeg
- Streaming: m3u8, m4v, m4p, ogv, ogg
- Professional: mxf, drc, aaf, roq
- Legacy: 3gp, 3g2, asf, vob, rm, rmvb, qt
- Specialized: avchd, m2v, mp2, mpe, mpv, mng, nsv, svi, yuv
Contributing
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct, development setup, and the process for submitting pull requests.
Support
If you find this library helpful:
- ⭐ Star the repository
- 🐛 Report issues
- 🔀 Submit pull requests
- 💝 Sponsor on GitHub
Credits
This package is a Python port of the video-extensions npm package by Sindre Sorhus.
License
MIT © Y. Siva Sai Krishna - see LICENSE for details.
Author's GitHub • Author's LinkedIn • Package on PyPI • GitHub Repository • Report Issues • Changelog • Release History
Metadata
Release files for video-extensions 1.0.1
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 |
|---|---|---|---|---|
| video_extensions-1.0.1.tar.gz | 17.9 kB | Without provenance | Details for video_extensions-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| video_extensions-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for video_extensions-1.0.1-py3-none-any.whl |
Total release size: 23.0 kB
Release files / video_extensions-1.0.1.tar.gz
| Download URL | video_extensions-1.0.1.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
544c3e255e5389e57249fbc1cd0bf529fc6137cdecd74c3d34b6b0c57ac735b1
|
|
BLAKE2b-256 checksum How to use checksums |
af48333b486de71553b5ecd8f053624775322e4c9c299a7061596bfcc14f9de6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / video_extensions-1.0.1-py3-none-any.whl
| Download URL | video_extensions-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
822e955962954fbaf106e01de4b8e93177feb792ba2318399e7c235e4425dfb0
|
|
BLAKE2b-256 checksum How to use checksums |
2ba6348995e9527588b007715e3dc9d78564adc7af13e47fe68dcf5c133d7618
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for video-extensions 1.0.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.