Tools for video and audio editing
Project description
mixing
Tools for video and audio editing
To install: pip install mixing
Examples
mixing.video
VideoFrames: Dictionary-like access to video frames
VideoFrames provides a Mapping interface to access individual frames from a video file by index. Frames are returned as numpy arrays (BGR format).
from mv.util import VideoFrames
# Create frame accessor
frames = VideoFrames("my_video.mp4")
# Access frames by index
first_frame = frames[0]
last_frame = frames[-1] # Negative indexing supported
middle_frame = frames[len(frames) // 2]
# Slice to get multiple frames (returns an iterator, not a list)
for frame in frames[10:50]:
# Process frames 10 through 49
pass
# Get every 5th frame
for frame in frames[::5]:
# Process every 5th frame
pass
save_frame: Extract and save video frames as images
Convenience function to extract a single frame from a video and save it as an image.
from mv.util import save_frame
# Save first frame with auto-generated filename (video_0.png)
save_frame("my_video.mp4")
# Save frame 100 as JPEG
save_frame("my_video.mp4", 100, saveas=".jpg") # Saves as my_video_000100.jpg
# Save last frame to specific path
save_frame("my_video.mp4", -1, saveas="output/last_frame.png")
The saveas parameter accepts:
None(default): Auto-generate filename in video's directory.ext: Use this extension with auto-generated filename- Full path: Save to this specific location
write_subtitles_in_video
Write subtitles in a video.
Example usage:
>>> from mixing import write_subtitles_in_video
>>> output_path = write_subtitles_in_video("~/Downloads/some_video.mp4")
Which is syntactic sugar for the more explicit:
>>> output_path = write_subtitles_in_video(
... "~/Downloads/some_video.mp4",
... subtitles="~/Downloads/some_video.srt",
... output_video="~/Downloads/some_video.mp4"
... )
Further requirements
FFmpeg
Many of the tools also require ffmeg.
To install FFmpeg on your system, follow the instructions for your operating system below.
macOS
- Using Homebrew:
- Open Terminal.
- Run the following command:
brew install ffmpeg
For more details, visit the FFmpeg installation page for macOS.
Linux
- Using the package manager:
- For Debian/Ubuntu-based distributions, run:
sudo apt update sudo apt install ffmpeg
- For Fedora, run:
sudo dnf install ffmpeg
- For Arch Linux, run:
sudo pacman -S ffmpeg
- For Debian/Ubuntu-based distributions, run:
For more details, visit the FFmpeg installation page for Linux.
Windows
- Using Windows builds:
- Download the executable from FFmpeg for Windows.
- Extract the downloaded files and add the
bindirectory to your system's PATH.
For more details, visit the FFmpeg installation page for Windows.
Project details
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 mixing-0.0.3.tar.gz.
File metadata
- Download URL: mixing-0.0.3.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eadad292e426e67b919555d5f669cde4a7df58063596d7e6a4a7ff8d1ee2ed1e
|
|
| MD5 |
0dfd19154fd1d8f1076fdd62ad38da48
|
|
| BLAKE2b-256 |
7caaccfcc25758984947d8fbaa0e9d6652cadcce571020559c0c09a24bf6e5a1
|
File details
Details for the file mixing-0.0.3-py3-none-any.whl.
File metadata
- Download URL: mixing-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a66b99d865a9ac2c66448dc900cbb0bee9dae701b08e5a5f1d4022c7e8b0edb0
|
|
| MD5 |
31cfbcff167cc04358036bf6e4693cd3
|
|
| BLAKE2b-256 |
76e343ee00165a8ce413518486d477de6bd92439b75c3569861e1439ace58aca
|