Filtering
Apply motion-based filtering to clips and aesthetic filtering to frames to prune low-quality assets during curation.
Motion filtering uses OpenCV for flow-field resizing. Install the optional dependency before enabling it:
The video_cpu or video_cuda12 extra is also required for motion-vector
decoding; it provides PyAV and its FFmpeg libraries. Stages that invoke the
ffmpeg executable still need the FFmpeg setup required by your video
pipeline. Installing cv2 does not provide that executable or its codecs.
How it Works
Filtering runs in two passes that balance speed and quality:
- Motion pass (fast): The pipeline decodes lightweight motion vectors and computes motion scores to drop static or near‑static clips at the first filtering stage. This step adds
decoded_motion_dataper clip, then writesmotion_score_global_meanandmotion_score_per_patch_min_256. Clips below thresholds move tovideo.filtered_clips, andvideo.clip_stats.num_filtered_by_motionincrements. - Aesthetic pass (model based): Upstream, the pipeline extracts frames using the
sequencepolicy at a chosentarget_fps. The aesthetic stage readsextracted_frames[sequence-<target_fps>], produces anaesthetic_score, and removes clips below the threshold. These clips move tovideo.filtered_clips, andvideo.clip_stats.num_filtered_by_aestheticincrements.
Before You Start
Motion decoding and aesthetic scoring operate on clip buffers. You must run clipping and encoding first so each clip has a valid buffer (bytes).
Quickstart
Use the pipeline stages or the example script flags to enable motion and aesthetic filtering.
Pipeline Stage
Script Flags
Filtering Options
Motion Filtering
Motion filtering is a two‑step process: first decode motion vectors, then filter clips based on motion scores.
-
Add
MotionVectorDecodeStageto sample motion vectors from each clip.This step adds
decoded_motion_datato each clip, or records an error inclip.errors. -
Add
MotionFilterStageto compute motion scores and filter out low‑motion clips.- Adds
motion_score_global_meanandmotion_score_per_patch_min_256to each clip. - Moves filtered clips to
video.filtered_clipsand incrementsvideo.clip_stats.num_filtered_by_motion.
- Adds
Parameters
MotionVectorDecodeStage
MotionFilterStage
Aesthetic Filtering
Aesthetic filtering works best when you prepare frames first, then score clips using a CLIP‑based aesthetic model.
-
Extract frames earlier in the pipeline. Use a frame extraction stage with a
sequencepolicy and set atarget_fpsthat matches the aesthetic stage. Refer to Frame Extraction for guidance.Frame Requirements:
- Use
sequenceframe extraction policy. - Match
target_fpshere and in the aesthetic stage. - Ensure
clip.extracted_framescontains frames for the signaturesequence-<target_fps>.
- Use
-
Add
ClipAestheticFilterStageto score each clip and drop clips below a threshold.- Adds
aesthetic_scoreto each clip. - Moves filtered clips to
video.filtered_clipsand incrementsvideo.clip_stats.num_filtered_by_aesthetic.
- Adds