How skeskinen/smartcut works
Video Smartcut is a command-line tool for keeping or removing time ranges from media files, preserving compressed video where possible and recoding around cutpoints. The workflow starts with CLI arguments, opens and analyzes the input, resolves requested times into GOP-aware cut segments, then writes video, audio, and subtitle streams to an output file. The README documents broad format support and passthrough audio. Source excerpts show the main orchestration and cutter responsibilities; some internal calls are supported only by the SOURCE INDEX, so the graph stays at those documented module boundaries.
Main entry points: media_container.py Media inspection · smart_cut.py Cut segment planning · __main__.py CLI and time parsing · video_cutter.py Video stream cutter
Components 12
CLI
- CLI and time parsing
smartcut/__main__.py
Media planning
- Media inspection
smartcut/media_container.py - Cut segment planning
smartcut/smart_cut.py
Stream cutting
- Video stream cutter
smartcut/video_cutter.py - Audio and subtitle cutters
smartcut/track_cutters.py
Media support
- Segment data
smartcut/misc_data.py - Media format rules
smartcut/media_utils.py - NAL keyframe analysis
smartcut/nal_tools.py
Other components
- CLI user
- Input media
- Output media
- PyAV / FFmpeg
Connections 16
- CLI user → CLI and time parsing: provides arguments
README.md - CLI and time parsing → Media inspection: opens input
smartcut/__main__.py - Input media → Media inspection: reads media
smartcut/media_container.py - CLI and time parsing → Cut segment planning: requests cut
smartcut/__main__.py - Media inspection → Cut segment planning: supplies GOP data
smartcut/smart_cut.py - Cut segment planning → Segment data: creates segments
smartcut/smart_cut.py - Cut segment planning → Video stream cutter: dispatches segments
smartcut/smart_cut.py - Cut segment planning → Audio and subtitle cutters: dispatches segments
smartcut/smart_cut.py - Video stream cutter → Output media: writes video
- Audio and subtitle cutters → Output media: writes tracks
- Media inspection → NAL keyframe analysis: checks keyframes
smartcut/media_container.py - Video stream cutter → NAL keyframe analysis: uses NAL helpers
smartcut/video_cutter.py - CLI and time parsing → Media format rules: uses media settings
smartcut/__main__.py - Media inspection → PyAV / FFmpeg: opens and demuxes
smartcut/media_container.py - Video stream cutter → PyAV / FFmpeg: decodes and encodes
smartcut/video_cutter.py - Audio and subtitle cutters → PyAV / FFmpeg: creates output streams
smartcut/track_cutters.py