Check if a file or extension is a video type, and iterate over 36 known video file formats including mp4, mov, avi, mkv, and more. Python port of video-extensions npm package.
Project description
Video Extensions
Check if a file or extension is a video type, and iterate over 36 known video file formats including mp4, mov, avi, mkv, and more. Python port of video-extensions npm package.
Features
- Immutable collection of 36 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)) # 36
"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)
Supported Extensions
The package includes support for 36 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, wmv
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file video_extensions-1.0.0.tar.gz.
File metadata
- Download URL: video_extensions-1.0.0.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b69c342600db0af88bcaad2dd6f6732d10b6bbde2b49f3161685870c95bea958
|
|
| MD5 |
3d6f48571db5024bc65d349bae16d4ef
|
|
| BLAKE2b-256 |
635fbd1b2325d16f35427bdc5b65727107688c5d8f26df3f93bcfd253d195539
|
File details
Details for the file video_extensions-1.0.0-py3-none-any.whl.
File metadata
- Download URL: video_extensions-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef25d25cfd1b749166988980f03d5e42db5acf5d973a197af347dab45f269aae
|
|
| MD5 |
e97a2f28889e9afe6234add5d007e896
|
|
| BLAKE2b-256 |
d907f00c95e780045cf517a82dcd4a8f4361d99b48e64df2bc1ff31b0ae6a189
|