Added
- Segment set operations feature for combining silence and motion detection
- New utility functions for segment set operations:
_union_segments() - Union of two segment sets (A OR B)
_intersect_segments() - Intersection of two segment sets (A AND B)
_difference_segments() - Difference of two segment sets (A - B)
_xor_segments() - Symmetric difference (XOR) of two segment sets
_complement_segments() - Complement of a segment set
- New
SegmentOperation enum with operations: UNION, INTERSECTION, SOUND_ONLY, MOTION_ONLY, XOR, COMPLEMENT
- New
CutByDetection task class for combined silence and motion detection with set operations
- New
PARTIAL_TASKS.cut_by_detection() factory method
- Export
SegmentOperation from package __init__.py
- Updated documentation:
ARCHITECTURE.md - Added CutByDetection section and segment set operations algorithms
PORTING_GUIDE.md - Added segment set operations implementation guide
Usage Example
from ffmpeg_toolkit import FF_TASKS, SegmentOperation
# Keep segments with sound OR motion (union - keeps most content)
FF_TASKS.CutByDetection(
input_file="input.mp4",
operation=SegmentOperation.UNION
).render()
# Keep only segments with sound AND motion (intersection - highlights)
FF_TASKS.CutByDetection(
input_file="input.mp4",
operation=SegmentOperation.INTERSECTION
).render()