Commit Graph

2194 Commits

Author SHA1 Message Date
Jonathan Thomas 70ec155627 Add JUCE audio recorder and fix FFmpegWriter FLAC duration
- Add AudioRecorder with input device capture, monitoring, recording, stats, level snapshots, and waveform snapshots
- Add AudioRecorder settings, level data, waveform chunk data, and frame factory helpers
- Expose AudioRecorder and related APIs to Python/SWIG
- Add AudioDevices input device listing support
- Register AudioRecorder in CMake and OpenShot public headers
- Write recorded audio through FFmpegWriter using configured codec, sample rate, channels, layout, and bitrate
- Finalize recorder writers cleanly on stop/close, including prepared recordings that never start
- Update FFmpegWriter audio timestamps, packet durations, encoder flush behavior, and stream duration metadata
- Fix FLAC outputs so FFmpegReader reports valid duration and video length after recording
- Improve AudioWaveformer extraction for audio files with missing/unknown duration metadata
- Add AudioRecorder unit tests for validation, monitoring, waveform, levels, and synthetic recording behavior
- Add AudioWaveformer/FFmpegWriter regression coverage for FLAC duration and waveform extraction
2026-05-28 06:47:37 -05:00
Jonathan Thomas e3151d577b Clean-up and modernization of our cmake build system
- Modernized SWIG policy handling for Python, Ruby, and Java without raising the project-wide CMake policy version.
- Switched Python discovery to Python3 on CMake 3.12+, with legacy PythonInterp/PythonLibs fallback for older CMake.
- Removed dead pre-CMake-3.8 SWIG branches.
- Quieted optional babl pkg-config probing.
- Changed FFmpeg probing so avresample is only checked if swresample is unavailable.
- Cleaned Java binding debug configure messages.
- Addressed the SWIG build warnings:
  - Added SWIG-only juce::Thread declaration for Python/Ruby/Java.
  - Added Python QWidget typecheck precedence.
  - Filtered known Ruby binding limitations for multiple inheritance and unexposed Profile operators.
  - Suppressed Java-only SWIG categories for unsupported operators/proxy limitations via Java SWIG flags.
2026-05-24 17:31:52 -05:00
Jonathan Thomas 0a68c884e2 Merge pull request #1078 from OpenShot/object-mask-effect
New "Object Mask" Effect: Segment Anything / Track Anything
2026-05-22 14:50:34 -05:00
Jonathan Thomas 8d9b8c22bf Improve Cutie object mask memory and aspect handling
- Preserve the first seeded Cutie memory frame as a permanent memory slot and
  use the remaining slots as rolling working memory. This keeps the initial
  prompted mask available during later propagation instead of evicting it from
  the FIFO window.
- Also letterbox frames and masks into the fixed Cutie ONNX input size instead
  of stretching them, unletterbox propagated masks back to source dimensions,
  and mark padded memory regions invalid for memory readout.
2026-05-21 14:43:55 -05:00
Jonathan Thomas d01ffe1ea8 Merge pull request #1077 from OpenShot/black-frames
Avoid Black Frames (Adding a new clip - and it does not appear)
2026-05-20 23:15:32 -05:00
Jonathan Thomas da35707966 Merge branch 'object-detection-v2' into object-mask-effect 2026-05-20 21:42:07 -05:00
Jonathan Thomas 5dc3724bba Fixing Codacy nitpicks
- Reordered the bounds check before indexing predictedBoxes in sort.cpp
- Marked SortTracker constructor explicit
- Removed TrackingBox::classScores from the public result struct and moved it into a private DetectionBox helper in sort.cpp
- Replaced the raw prototype scan loop with std::find_if
2026-05-20 21:41:45 -05:00
Jonathan Thomas 9f228c923b Improve Object Mask prompts and conservative GPU selection
- Supports multiple positive rect prompts instead of only the first rect.
- Preserves negative rects as ranking filters instead of collapsing them to center points.
- Ranks EfficientSAM candidates with soft penalties for negative point hits and negative rect overlap.
- Unions separate EfficientSAM passes for multiple positive rects so multiple target objects can remain selected.
- Makes GPU_AUTO conservative:
    - CUDA if available
    - otherwise CPU
    - OpenCL only when explicitly requested with GPU_OPENCL
- Adds simple requested/selected DNN device logging for Object Detection, EfficientSAM, and Cutie.
2026-05-20 18:45:57 -05:00
Jonathan Thomas 395f66253c Improve Object Mask model compatibility
- Removing XMem as a backend for Object Mask effect (replacing with Cutie model)
- Detect Cutie model dimensions from selected model filenames instead of relying on a fixed propagation size.
- Support multiple Cutie quality tiers with matching encode/decode/readout dimensions.
- Add fallback mask threshold behavior for EfficientSAM when the default threshold produces an empty mask.
- Reduce Object Mask preview/export failures with larger Cutie model variants.
2026-05-20 14:22:28 -05:00
Jonathan Thomas 8bd98a592b Replace ObjectMask EdgeSAM seed masks with EfficientSAM ONNX
- Use a single EfficientSAM ONNX model for ObjectMask seed mask generation
- Add EfficientSAM prompt preprocessing and mask candidate selection
- Keep seed-frame output as the raw EfficientSAM mask while still seeding XMem
- Add ClipProcessingJobs::PreviewObjectMask for single-frame interactive previews
- Accept EfficientSAM model JSON keys while preserving legacy encoder_model aliases
- Remove ObjectMask protobuf shutdown call that could destabilize Python teardown
- Add ObjectMask ONNX validation coverage
2026-05-18 19:18:56 -05:00
Jonathan Thomas 1f0b1b9698 Add Object Mask effect with EdgeSAM and XMem propagation
- Add ObjectMask effect for rendering and exposing generated object masks
- Add EdgeSAM preprocessing path for prompt-based seed and reseed masks
- Add XMem ONNX propagation between seed frames for single-object tracking
- Support positive/negative points, positive rect prompts, and prompt keyframes
- Store generated masks in protobuf data for playback and downstream effects
- Add mask color/alpha plus stroke color/alpha/width effect controls
- Register ObjectMask with effect discovery and clip preprocessing jobs
- Add focused ObjectMask effect tests
2026-05-18 16:28:13 -05:00
Jonathan Thomas ec370404d9 Add YOLO segmentation mask support to Object Detection
- Support YOLO segmentation ONNX outputs, persist sparse RLE masks in object-detection protobuf data, and render configurable mask overlays in the Object Detection effect.
- Also normalize tracked object classes at save time, smooth short mask gaps, and expose Draw Mask / Mask Color / Mask Alpha only when mask data is available.
2026-05-15 17:51:16 -05:00
Jonathan Thomas 9fbe600244 Updated compatibility for CVObjectDetection to support:
- YOLOv5: [1, num_boxes, 5 + classes]
- YOLO26 no-end2end export: [1, attributes, candidates], e.g. [1,116,8400]
-Also kept the YOLOv5-seg safety fix: when a classes file exists, mask coefficients are not treated as extra classes.
2026-05-15 09:15:09 -05:00
Jonathan Thomas f7586af1be Fallback to CPU backend for OpenCV when CUDA backend not available. 2026-05-13 23:20:31 -05:00
Jonathan Thomas 47d1784b1c Validate YOLO ONNX models in libopenshot
- Add libopenshot-side ONNX model validation for object detection
- Return user-displayable error text instead of throwing through callers
- Share ONNX load/error handling between validation and object detection processing
- Fail early for YOLOv5 on OpenCV older than 4.3
- Expose validation through ClipProcessingJobs for Python bindings
2026-05-13 14:30:40 -05:00
Jonathan Thomas 4f6cb7c50f Updating gitlab builder for Linux to use new /opt installed OpenCV 4.5.5 folder, and return error message on < 4.3.0 OpenCV versions for Object Detection effect. 2026-05-13 00:00:29 -05:00
Jonathan Thomas 195632ac86 Fix persistent black frames after clip open failure
- Only mark timeline clips as open after Clip::Open() succeeds
- Allow later GetFrame() calls to retry opening clips after transient failures
- Prevent cache rebuilds from repeatedly generating blank frames for closed clips
- Add regression coverage for a failed first open followed by a successful retry
2026-05-12 22:31:12 -05:00
Jonathan Thomas ae3d769f0a Fix stale timeline cache after adding clips
- Invalidate affected final_cache frames in AddClip()
- Remove duplicate JSON insert invalidation
- Add regression test for stale black frames
2026-05-12 18:38:45 -05:00
Jonathan Thomas 14c63f3714 Fix margin-bounded effects to avoid invalid image access
- Clamp and validate Blur, Bars, and Pixelate margin-derived regions
- Add regression coverage for collapsed/out-of-range margin cases
- Verify focused Bars, Blur, and Pixelate tests pass
2026-05-12 15:15:15 -05:00
Jonathan Thomas 4f289bc442 Fix saturation stride and parent effect updates
- Respect QImage::bytesPerLine() in saturation and mask blending
- Preserve child effect IDs when inheriting parent effect changes
- Propagate parent updates correctly through nested child effects
- Add regression tests for padded image stride and parent effect inheritance
2026-05-12 14:22:06 -05:00
Jonathan Thomas eae93e1ebf Protecting crash when reading ONNX model with wrong format (Object Detection effect) 2026-05-10 22:26:18 -05:00
Jonathan Thomas be99ec02c6 Migrate object detection to YOLOv5 ONNX
- Replace YOLOv3 Darknet loading with YOLOv5 ONNX model loading and validation.
- Parse YOLOv5 outputs with top class candidates for smoother labels.
- Improve SORT tracking with class-score smoothing and stricter geometry gates.
- Prevent active tracks from hopping to adjacent objects or tiny nested detections.
- Keep object ids stable through protobuf load/save and add an object-detection debug example.
- Add class-based default colors and matching border/background defaults.
- Add All Objects pseudo-selection support for tracked-object properties.
- Honor tracked-object corner radius when using tracker/object detector masks.
- Add regression tests for tracking stability, all-object styling, masks, and keyframes.
2026-05-10 21:48:24 -05:00
Jonathan Thomas d274163314 Improve tracked object rendering controls
- Remove unused tracked-object rotation property from JSON, properties, and box values
- Add per-object Draw Text support alongside Draw Box
- Use deterministic class colors for Object Detector instead of random seeded colors
- Scale tracked-object stroke widths based on preview raster size
- Keep Object Detector text rendering gated by both global and per-object text settings
2026-05-10 14:34:38 -05:00
Jonathan Thomas 0751153d5a Merge pull request #1074 from OpenShot/tracked-mask-source
Use TrackedObjectMask as "Mask: Source" for any Effect
2026-05-09 20:40:18 -05:00
Jonathan Thomas 07e60a8a60 Improve Caption margins and default visibility
- Add Bottom margin support to Caption JSON, properties, rendering, and tests
- Rename Caption margin property labels to "Margin: Top/Left/Bottom/Right"
- Clip Caption rendering to the configured margin rectangle
- Default Caption fade in/out to 0.0 so newly inserted captions render immediately
- Avoid divide-by-zero fade calculations when Caption fade durations are disabled
2026-05-09 16:27:10 -05:00