mixing 0.0.78__tar.gz → 0.0.80__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mixing-0.0.78 → mixing-0.0.80}/.claude/CLAUDE.md +2 -1
- {mixing-0.0.78 → mixing-0.0.80}/.claude/skills/mixing-video/SKILL.md +35 -1
- {mixing-0.0.78 → mixing-0.0.80}/PKG-INFO +1 -1
- {mixing-0.0.78 → mixing-0.0.80}/mixing/__init__.py +3 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/leveling.py +7 -2
- mixing-0.0.80/mixing/edit.py +1417 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/loudness.py +120 -35
- mixing-0.0.80/mixing/tests/test_edit.py +868 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_leveling.py +16 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_loudness.py +112 -0
- {mixing-0.0.78 → mixing-0.0.80}/pyproject.toml +1 -1
- {mixing-0.0.78 → mixing-0.0.80}/.claude/agents/mixing-dev.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/.claude/agents/mixing-editor.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/.claude/skills/mixing/SKILL.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/.claude/skills/mixing-audio/SKILL.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/.claude/skills/mixing-dubbing/SKILL.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/.claude/skills/mixing-transcript/SKILL.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/.github/workflows/ci.yml +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/.gitignore +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/LICENSE +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/README.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/conftest.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/README_audio_widget.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/audio_widget_EXAMPLE_NOTEBOOK.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/discussion_media/video_editing/pair_bgremove_efficient.gif +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/discussion_media/video_editing/pair_bgremove_kodokan.gif +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/discussion_media/video_editing/pair_cartoon_C.gif +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/discussion_media/video_editing/pair_facexform_animegan.gif +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/discussion_media/video_editing/pair_facexform_sticker.gif +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/discussion_media/video_editing/pair_redact_blur.gif +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/discussion_media/video_editing/pair_stylize_B1.gif +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/examples/audio_offset_example.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/misc/examples/demo_audio_widget.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/_cache.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/_elevenlabs.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/__init__.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/_pcm.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/audio_ops.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/audio_util.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/audio_widget.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/beats.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/samples.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/segmentation.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/tagging.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/talk_edges.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/turns.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/audio/voice.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/chapters.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/decode.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/dubbing/__init__.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/dubbing/dub.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/dubbing/srt.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/dubbing/tts.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/egress.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/errors.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/filtergraph.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/srt.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/data/talk_edges_labels.json +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_adaptive_window.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_aligned_spans.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_alignment_features.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_alignment_ingest.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_alignment_margin.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_ambient_bed.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_audio_alignment.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_audio_ops.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_audio_widget.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_beats.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_chapters.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_collision_detection.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_cutaways.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_dubbing.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_egress.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_filtergraph.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_gif_and_crop_box.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_audio_class.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_audio_ops_more.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_base_install.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_chapters_more.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_no_print.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_srt_and_persist.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_thumbnail.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_video_class.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_video_ops_more.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_guard_video_util.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_ken_burns.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_overlay_mix.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_scribe_cache.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_segmentation.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_segmentation_audioset.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_shots.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_srt_vtt.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_support_statistic.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_talk_edges.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_transcript.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_tts_api_key.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_tts_cache_status.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_util.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_video_audio_integration.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_video_transitions.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/tests/test_voice.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/transcript/__init__.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/transcript/fillers.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/transcript/formats.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/transcript/media.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/transcript/persist.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/transcript/pipeline.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/transcript/scribe.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/util.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/README.md +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/__init__.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/_helpers.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/cutaways.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/genai.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/gif.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/shot_boundaries.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/thumbnail.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/video_concat.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/video_ops.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/video_subtitles.py +0 -0
- {mixing-0.0.78 → mixing-0.0.80}/mixing/video/video_util.py +0 -0
|
@@ -33,7 +33,7 @@ Focused subpackages, each with a clear dependency footprint:
|
|
|
33
33
|
|
|
34
34
|
| Module | Purpose | Heavy deps |
|
|
35
35
|
|---|---|---|
|
|
36
|
-
| `mixing.loudness` | array-only loudness: `integrated_lufs(meter=)` (numpy / ffmpeg_ebur128 / pyloudnorm / callable), `stream_loudness`/`file_loudness` (I + LRA in bounded memory), `level_group`, `limit_peaks` (sample or true peak), `true_peak_db
|
|
36
|
+
| `mixing.loudness` | array-only loudness: `integrated_lufs(meter=)` (numpy / ffmpeg_ebur128 / pyloudnorm / callable), `stream_loudness`/`file_loudness` (I + LRA in bounded memory), `level_group`, `limit_peaks` (sample or true peak), `true_peak_db` (true-peak interpolation `method="short"|"long"`); `mixing.audio.leveling` builds its `Audio` layer on it | `numpy`, `scipy` (extra `loudness`; no media stack) |
|
|
37
37
|
| `mixing.decode` | `decode_float_chunks`: a file's audio as float chunks at its own rate/channels, through ffmpeg (feeds `mixing.loudness.file_loudness`, bounded memory) | `numpy` + an ffmpeg |
|
|
38
38
|
| `mixing.audio` | `Audio`/`AudioSamples`, fades, crop, concat, overlay, `loop_audio`, `duck_audio`, `find_audio_offset`, segmentation | `pydub`, `numpy`, `scipy` |
|
|
39
39
|
| `mixing.audio.beats` | `beat_grid`/`BeatGrid` — beat/downbeat/onset analysis | `librosa` (extra `beats`, lazy-imported) |
|
|
@@ -41,6 +41,7 @@ Focused subpackages, each with a clear dependency footprint:
|
|
|
41
41
|
| `mixing.audio.talk_edges` | `find_talk_edges`/`TalkEdges`: the host's talk at the start/end of a carved song (talk over music counts), same classifier seam plus an optional word-timestamped transcript | default classifier needs extra `ml` |
|
|
42
42
|
| `mixing.video` | `Video`/`VideoFrames`, crop/loop/speed, `replace_audio`, `normalize_audio`, `overlay_ambient_bed`, `ken_burns_*`, `concatenate_videos`, thumbnails, subtitles | `moviepy`, `opencv`, `pillow`, `looks` (vocabulary only — stdlib) |
|
|
43
43
|
| `mixing.video.genai` | Google Vertex AI **Veo** generation | `google-genai` (extra `gen`) |
|
|
44
|
+
| `mixing.edit` | `render` a re-edit of a finished video from a sound edit list (`Span`/`Gap`) and picture clips (`Cam` punch-ins, `Still` moves, dissolves, overlays), frame-exact; `timeline` is the pure frame/sample arithmetic | stdlib + an ffmpeg (stills via `burns`, extra `media`, lazy) |
|
|
44
45
|
| `mixing.transcript` | ElevenLabs **Scribe** STT (stdlib HTTP, cached), filler removal, SRT/prose | stdlib only |
|
|
45
46
|
| `mixing.dubbing` | ElevenLabs **TTS** re-voice / translate (stdlib HTTP, cached) | stdlib (`dub_video_from_srt` needs `moviepy`) |
|
|
46
47
|
| `mixing.srt` | **canonical** SRT/timeline `Cue` + parse/format/shift | pure stdlib |
|
|
@@ -4,7 +4,8 @@ description: >
|
|
|
4
4
|
Use for VIDEO editing with the `mixing` Python package: trim/crop a clip,
|
|
5
5
|
loop it, speed it up or down, replace or mix in a new audio track, normalize
|
|
6
6
|
audio levels, pan/zoom a still image (Ken Burns), build a film from panels,
|
|
7
|
-
concatenate clips,
|
|
7
|
+
concatenate clips, re-edit a finished video from a sound edit list (punch-ins,
|
|
8
|
+
held stills with moves, dissolves, overlays, frame-exact), grab/extract frames, make a YouTube-style thumbnail, burn
|
|
8
9
|
in subtitles, or resize for shorts/tiktok/square. Trigger on phrasings like
|
|
9
10
|
"trim this video", "loop the intro", "speed up / slow down this clip",
|
|
10
11
|
"replace the audio with this music", "lay room tone / ambience under the cut", "add a pan-zoom over this photo", "make a
|
|
@@ -180,6 +181,39 @@ plan = plan_cutaways(
|
|
|
180
181
|
) # inspect first: plan.filter_complex, plan.command(out)
|
|
181
182
|
```
|
|
182
183
|
|
|
184
|
+
## Re-edit a finished video — sound and picture edit lists (`mixing.edit`)
|
|
185
|
+
|
|
186
|
+
`mixing.edit.render(segments, clips, *, source, overlays=(), fps=None, output=None, ...)` re-cuts a finished talking-head video, frame-exact. Two edit lists of the same length: the **sound** (`Span(src_in, src_out, clip)` source seconds, `Gap(duration, clip)` silence) and the **picture** each segment names by clip id (`Cam(zoom=1.0, cx=0.5, cy=0.5, dissolve_in=0.0)` the source, optionally punched in; `Still(image, path="hold", zoom=None, fit="fit", content_box=None, on_aspect_mismatch="raise", dissolve_in=0.0)` a held still with a slow move: `path` is a `burns` move name such as `"push_in"`/`"drift_left"`, a `BurnsPath` or its dict, resolved by `burns.resolve_move`; a still of another aspect is pillar/letterboxed (`fit="fit"`) unless you ask for `fit="fill"`; windows are slid inside `content_box`). Consecutive segments with the same clip id are ONE picture clip, so a still keeps its move across a sound cut (remove a pause invisibly) and a punch-in hides a jump cut. A `Gap` under a `Cam` holds the neighbouring frame (previous span's last frame; the next span's first when the gap opens the clip). `dissolve_in=D` renders the clip D/2 early and the outgoing one D/2 late (`xfade`), so the length is unchanged. `Overlay(image, start, end, x=0, y=0, fade=0.0)` composites a PNG/PIL image (e.g. a `tituli` render) in the final pass; `closing_fade=` fades picture and sound out. Stdlib-only import, ffmpeg subprocesses; stills need `burns` (extra `media`) unless you pass your own `still_renderer`.
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from mixing.edit import Span, Gap, Cam, Still, Overlay, render, timeline
|
|
190
|
+
|
|
191
|
+
segments = [
|
|
192
|
+
Span(0.0, 4.2, "a"),
|
|
193
|
+
Span(5.1, 9.0, "b"),
|
|
194
|
+
Gap(1.5, "card"),
|
|
195
|
+
Span(9.0, 12.0, "a"),
|
|
196
|
+
]
|
|
197
|
+
clips = {
|
|
198
|
+
"a": Cam(),
|
|
199
|
+
"b": Cam(zoom=1.3, cx=0.4),
|
|
200
|
+
"card": Still("card.png", dissolve_in=0.5),
|
|
201
|
+
}
|
|
202
|
+
render(
|
|
203
|
+
segments,
|
|
204
|
+
clips,
|
|
205
|
+
source="talk.mp4",
|
|
206
|
+
overlays=[Overlay("lower_third.png", 1.0, 5.0, fade=0.3)],
|
|
207
|
+
)
|
|
208
|
+
# -> talk_edit.mp4 beside the source. Inspect the arithmetic first (pure, no ffmpeg):
|
|
209
|
+
plan = timeline(segments, clips, fps="30000/1001", sample_rate=48000)
|
|
210
|
+
plan.frame_bounds, plan.sample_bounds, plan.picture
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
The timeline runs at the source's exact rate (a `Fraction`; `fps=` overrides); every sound boundary is `round(frame * sr / fps)` of the same frame boundary, so sound and picture never drift. Contiguous source spans play as one run; other sound joins get a 6 ms fade (`JOIN_FADE_S`). Memory is bounded: one small ffmpeg run per piece (lossless intermediates in a temp dir, so budget disk), at most two decoders per run, joined by the concat demuxer.
|
|
214
|
+
|
|
215
|
+
Source assumptions (refused or warned otherwise): a video AND a sound stream, even width/height; frame-exact identity needs a constant frame rate (a VFR source is resampled to its nominal rate by time, with a warning); a span past the source's end is refused; a sound stream starting late/early is re-synced; display rotation is honoured; overlays past the film's end are clipped (starting after it: refused). Without `ffprobe`, the rate comes from ffmpeg's banner and both streams are assumed to start together.
|
|
216
|
+
|
|
183
217
|
## Thumbnails
|
|
184
218
|
|
|
185
219
|
```python
|
|
@@ -13,6 +13,8 @@ footprint so you only pay for what you import:
|
|
|
13
13
|
- :mod:`mixing.dubbing` — text-to-speech re-voicing / translation from SRT.
|
|
14
14
|
- :mod:`mixing.srt` — canonical SRT/timeline parsing & formatting (pure).
|
|
15
15
|
- :mod:`mixing.chapters` — transcript → chapter markers (pure; LLM optional).
|
|
16
|
+
- :mod:`mixing.edit` — render a re-edit from sound and picture edit lists,
|
|
17
|
+
frame-exact (stdlib + ffmpeg; stills via ``burns``).
|
|
16
18
|
|
|
17
19
|
**Lazy by design.** Importing ``mixing`` (or a light submodule such as
|
|
18
20
|
``mixing.chapters`` / ``mixing.srt``) does **not** import ``moviepy`` or
|
|
@@ -127,6 +129,7 @@ _SUBMODULES = (
|
|
|
127
129
|
"transcript",
|
|
128
130
|
"dubbing",
|
|
129
131
|
"chapters",
|
|
132
|
+
"edit",
|
|
130
133
|
"srt",
|
|
131
134
|
"egress",
|
|
132
135
|
"errors",
|
|
@@ -42,6 +42,7 @@ from ..egress import Output, deliver
|
|
|
42
42
|
from .audio_ops import _MIX_SILENCE_FLOOR_DB, Audio
|
|
43
43
|
from ..loudness import (
|
|
44
44
|
ABSOLUTE_GATE_LUFS,
|
|
45
|
+
DEFAULT_TRUE_PEAK_METHOD,
|
|
45
46
|
MAX_GAIN_DB,
|
|
46
47
|
integrated_lufs,
|
|
47
48
|
limit_peaks,
|
|
@@ -111,10 +112,14 @@ def loudness_range(audio: Union[str, Path, Audio]) -> float:
|
|
|
111
112
|
|
|
112
113
|
|
|
113
114
|
def true_peak_db(
|
|
114
|
-
audio: Union[str, Path, Audio],
|
|
115
|
+
audio: Union[str, Path, Audio],
|
|
116
|
+
*,
|
|
117
|
+
oversampling: Optional[int] = None,
|
|
118
|
+
method: str = DEFAULT_TRUE_PEAK_METHOD,
|
|
115
119
|
) -> float:
|
|
116
120
|
"""True peak of ``audio`` in dBTP; see :func:`mixing.loudness.true_peak_db`."""
|
|
117
|
-
|
|
121
|
+
samples, fs = audio_samples(as_audio(audio))
|
|
122
|
+
return _true_peak_db(samples, fs, oversampling=oversampling, method=method)
|
|
118
123
|
|
|
119
124
|
|
|
120
125
|
def _noise_floor(
|