This is a viewer only at the moment see the article on how this works.
To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk
This is a preview from the server running through my markdig pipeline
Thursday, 15 January 2026
Lo stato: In fase di sviluppo come parte del lucidRAG. Source: github.comM SK1scottgal/lucidrag
Dove questo va bene?: VideoSummarizer è il orchestratore Non si tratta di una questione di breve termine. lucidRAG famiglia, che combina tre pipelines in un motore di analisi video unificato:
Tutti segueno la stessa cosa. Esempio RAG ridotto: estrarre i segnali una volta , immagazzinare le prove, sintetizzare con un input LLM limitatoM SK3
Il processo di un fotogramma da due ore con inserzioni CLIP richiederebbe ore e centinaia di dollari di calcolo.
VideoSummarizer lo risolve con tre ottimizzazioni chiave:
Il risultato: un M SK1processi di video per ore in ~10-15 minuti, non oreMSC4 Gli stessi principi dell'architettura come ImageSummarizer e AudioSummarizer, ma formato in un tubo di analisi video unificatoM SK1
Percezione fondamentale: Video sono riprese + audio + testoM SK2 Progettare ogni dominio con strumenti specializzati, fondere i risultati in scene coerenti
- Structure del processo prima (cutsM SK1 I-frames , segmenti audioMSC4
- Estratto una volta i segnali multimodali cross-. (inserzioni,transcrizioni ,entitàM SK3
Terminologia:
(start_time, end_time) I segnali + i puntatori + la provenienzaKey ML models used:
Questo articolo riguarda:
Article connessi:
I punti di riferimento: Numeri sotto misurati sull'AMD 9950X (16-coreM SK3 SSK4 NVIDIA A4000 (16GBMSC7 | | / ♫96GB RAM |
Un tipico film contiene:
L'approccio strawman ( Nessuno lo faM SK1 ma stabilisce la scala):
Anche con l'estrazione di frammenti chiave ( direM SK1 500-1000 frammenti), cheMSC4 è ancora CSK5 secondi di deduzione seriale CLIPMST6
Appoggio tradizionale: "Escludere frammenti chiave, mandare a Vision LLMM SK3 sperare nel meglioMSC4
Il problema.: Questo brucia la computazione su frammenti ridondanti ( molti frammenti di chiavi sono visibilmente simili ), li processa in serie
Soluzione: MultiM SK1Filtura in fase,Processo di lottiMNK3 e composizione dei tubiMRK4
VideoSummarizer implements RAG ridotto per video con una riduzione di tre gradi
flowchart TB
subgraph Input["Video File (.mp4, .mkv, etc.)"]
V[Video Stream]
A[Audio Stream]
end
subgraph Stage1["Stage 1: Structural Analysis"]
N[NormalizeWave<br/>FFprobe metadata]
SD[ShotDetectionWave<br/>Scene cuts via FFmpeg]
KE[KeyframeExtractionWave<br/>I-frame + dedup]
end
subgraph Stage2["Stage 2: Content Extraction"]
IS[ImageSummarizer<br/>CLIP, OCR, Vision]
AS[AudioSummarizer<br/>Whisper, Diarization]
NER[NER Service<br/>Entity extraction]
end
subgraph Stage3["Stage 3: Scene Assembly"]
SC[SceneClusteringWave<br/>CLIP similarity]
EV[EvidenceGenerationWave<br/>RAG chunks]
end
V --> N --> SD --> KE
KE --> IS
A --> AS
AS --> NER
IS --> SC
NER --> SC
SC --> EV
style Stage1 stroke:#22c55e,stroke-width:2px
style Stage2 stroke:#3b82f6,stroke-width:2px
style Stage3 stroke:#8b5cf6,stroke-width:2px
Prima di cominciare la implementazione, qui' è quello che si ottieneM SK2il schema di output :
| Artefatto | campi chiave | Source S |
|---|---|---|
| La scena. | id, start_time, end_time, key_terms[], speaker_ids[], embedding[512] |
SceneClusteringWave |
| Shot | id, start_time, end_time, cut_type, keyframe_path |
ShotDetectionWave |
| L'espressione | id, text, start_time, end_time, speaker_id, confidence |
TranscriptionWave |
| TextTrack | id, text, start_time, text_type (titleM SK1credito/subtitle /ocrMSC4 |
SubtitleExtractionWave SSK6 |
| Keyframe | id, timestamp, frame_path, dhash, clip_embedding[512] |
KeyframeExtractionWave |
Ogni manufatto include provenienza: onda sorgente, tasso di tempo di traitementM SK2 punteggio di fiduciaMSC3 Questo è il " ledger di proveMST5 su cui operano le queries RAG in avalito.
VideoSummarizer usa un L'architettura delle onde basata sul segnale- dove ogni onda dichiara esplicitamente i suoi contratti di segnale:
public interface ISignalAwareVideoWave
{
/// <summary>Signals this wave requires before it can run.</summary>
IReadOnlyList<string> RequiredSignals { get; }
/// <summary>Signals this wave can optionally use if available.</summary>
IReadOnlyList<string> OptionalSignals { get; }
/// <summary>Signals this wave emits on successful completion.</summary>
IReadOnlyList<string> EmittedSignals { get; }
/// <summary>Cache keys this wave produces for downstream waves.</summary>
IReadOnlyList<string> CacheEmits { get; }
/// <summary>Cache keys this wave consumes from upstream waves.</summary>
IReadOnlyList<string> CacheUses { get; }
}
Questo permette Coordinazione delle onde dinamiche:
L'estrazione dei frammenti chiave è implementata come 7 onde granulare per un migliore parallelismo e efficienza del cache:
| Wave | Priorità | Richiede M | Emiti m | Tempo D |
|---|---|---|---|---|
| Normalizzare l'onda | 1000 | - | video.duration, video.fps, video.normalized |
~2s |
| FFmpegShotDetectionWave | 900 | video.normalized |
shots.detected, shots.count |
~5-10s |
| La Wave di Detezione di IFrame | 850 | video.normalized |
keyframes.iframes_detected, keyframes.iframes_count |
~3s |
| La curva di selezione del Keyframe | 840 | shots.detected, keyframes.iframes_detected |
keyframes.selected, keyframes.selected_count |
~1s |
| La Wave di Extrazione delle Immagini | 830 | keyframes.selected |
keyframes.thumbnails_extracted |
~5s |
| KeyframeDeduplicationWave | 820 | keyframes.thumbnails_extracted |
keyframes.deduplicated, keyframes.duplicates_skipped |
~1s |
| KeyframeFullResExtractionWave | 810 | keyframes.deduplicated |
keyframes.extracted, keyframes.count |
~10s |
| ClipEmbeddingWave | 800 | keyframes.extracted |
clip.embeddings_ready, clip.embeddings_count |
~30s |
| Wave di analisi dell'immagine | 790 | keyframes.deduplicated |
keyframes.analyzed, ocr.extracted |
~60s |
| TitleCreditsDetectionWave | 750 | shots.detected |
title.detected, credits.detected |
~5s |
| AudioExtractionWave | 650 | video.normalized |
audio.extracted, audio.path |
~30s |
| TranscriptionWave | 600 | audio.extracted |
transcription.complete, transcription.utterance_count |
~120s |
| SubtitleExtractionWave | 550 | video.normalized |
subtitles.extracted |
~2s |
| ChapterExtractionWave | 500 | video.normalized |
chapters.extracted |
~1s |
| SceneClusteringWave | 400 | shots.detected |
scenes.detected, scene.count |
~5s |
| EvidenceGenerationWave | 100 | scenes.detected |
evidence.generated |
~2s |
Notes:
keyframes.deduplicated (non interoM SK1res): L'OCR funziona su immagini miniature ; il sottoscritto della visione usa interiMSC4res quando è disponibile tramite il routing delle capacitàMST5Totale per 2-ora di filmato: ~10-15 minuti (vsM SK3 ore senza ottimizzazione)
I segnali sono definiti come konstante per la coerenza:
public static class VideoSignals
{
// NormalizeWave signals
public const string VideoDuration = "video.duration";
public const string VideoFps = "video.fps";
public const string VideoNormalized = "video.normalized";
// Shot detection signals
public const string ShotsDetected = "shots.detected";
public const string ShotsCount = "shots.count";
// Keyframe signals
public const string IframesDetected = "keyframes.iframes_detected";
public const string KeyframesSelected = "keyframes.selected";
public const string KeyframesDeduplicated = "keyframes.deduplicated";
public const string KeyframesExtracted = "keyframes.extracted";
// CLIP embedding signals
public const string ClipEmbeddingsReady = "clip.embeddings_ready";
// Scene clustering signals
public const string ScenesDetected = "scenes.detected";
public const string SceneCount = "scene.count";
// Transcription signals
public const string TranscriptionComplete = "transcription.complete";
}
VideoSummarizer usa un capacità-architettura basata: individuare GPU una volta al startup, scaricare i modelli lentamenteM SK2 lavorare con la strada per i componenti disponibili .
I modelli sono definiti in models.yaml-no stringi magici in codice:
# models.yaml (excerpt)
models:
clip-vit-b32:
name: "CLIP ViT-B/32"
download_url: "https://huggingface.co/openai/clip-vit-base-patch32/resolve/main/onnx/visual_model.onnx"
preferred_providers: [CUDAExecutionProvider, DmlExecutionProvider, CPUExecutionProvider]
components:
ClipEmbeddingWave:
models: [clip-vit-b32]
fallback_chain: [ImageAnalysisWave]
// Type-safe constants (no raw strings)
await coordinator.EnsureModelAsync(ModelIds.ClipVitB32);
await coordinator.ActivateWaveAsync(ComponentIds.TranscriptionWave);
// Route with fallback
var route = await coordinator.RouteWorkAsync(new[]
{
ComponentIds.ClipEmbeddingWave, // Primary (GPU)
ComponentIds.ImageAnalysisWave // Fallback (CPU)
});
Limitazione del tasso, stima del tempo, e pressione posteriore adattativa mantengono l'interfaccia reattiva while maximizing throughput
// Time estimation from actual data
var estimator = CapabilityAtoms.CreateTimeEstimator();
using (estimator.Time("clip_embedding")) { await ProcessAsync(); }
var eta = estimator.GetEstimate("clip_embedding", remaining: 50);
// eta.Estimated, eta.Optimistic, eta.Pessimistic, eta.Confidence
Documenti del sistema completo di capacità.: Vedete
Mostlylucid.Summarizer.Core/Capabilities/per la rilevazione del GPU, pub di segnaliM SK1sub, controlli di pressione posteriore , e progettazione della topologia mesh
Prima di fare expensive CLIP embeddings, VideoSummarizer filtra frammenti visibilmente simili usando La differenza hah (dHash).
public class KeyframeDeduplicationService
{
// dHash parameters: 9x8 grayscale = 64 bits
private const int HashWidth = 9;
private const int HashHeight = 8;
private const int DefaultHammingThreshold = 10;
public async Task<ulong> ComputeDHashAsync(string imagePath, CancellationToken ct)
{
using var image = Image.Load<Rgba32>(imagePath);
// Resize to 9x8 (one extra column for gradient comparison)
image.Mutate(x => x
.Resize(HashWidth, HashHeight)
.Grayscale());
ulong hash = 0;
int bit = 0;
// Compare adjacent pixels horizontally
for (int y = 0; y < HashHeight; y++)
{
for (int x = 0; x < HashWidth - 1; x++)
{
var left = image[x, y].R;
var right = image[x + 1, y].R;
// Set bit if left pixel is brighter than right
if (left > right)
{
hash |= (1UL << bit);
}
bit++;
}
}
return hash;
}
public static int HammingDistance(ulong a, ulong b) =>
BitOperations.PopCount(a ^ b);
}
Esempio output:
Input: 50 keyframe candidates (from codec I-frames)
Deduplication (Hamming threshold 10):
Frame 0: hash=0x8f3a2c1d → KEEP (first frame)
Frame 1: hash=0x8f3a2c1e → SKIP (distance=1 from frame 0)
Frame 2: hash=0x8f3a2c1f → SKIP (distance=2 from frame 0)
Frame 3: hash=0xc7e1b4a2 → KEEP (distance=28 from frame 0)
...
Result: 50 → 30 frames (40% reduction)
Processing saved: ~8 seconds of CLIP inference
Perché questo conta:
Invece di elaborare un'immagine alla volta, VideoSummarizer batchi M SK1 immagini per passaggio GPU.
public class BatchClipEmbeddingService
{
private const int ClipImageSize = 224;
private const int DefaultBatchSize = 8; // 8 images per GPU pass
public async Task<Dictionary<int, float[]>> GenerateBatchEmbeddingsAsync(
Dictionary<int, string> framePaths,
int batchSize = DefaultBatchSize,
CancellationToken ct = default)
{
var session = await GetOrLoadClipModelAsync(ct);
var results = new Dictionary<int, float[]>();
// Pre-index batch for O(1) lookup (not batch.IndexOf!)
var batches = framePaths
.Select((kvp, idx) => (idx, kvp.Key, kvp.Value))
.Chunk(batchSize);
foreach (var batch in batches)
{
// Create batch tensor [batchSize, 3, 224, 224]
var tensor = new DenseTensor<float>(new[] { batch.Length, 3, ClipImageSize, ClipImageSize });
// Preprocess images in parallel (simplified; production uses vectorised span copy)
Parallel.ForEach(batch, item =>
{
var (batchIdx, frameIndex, path) = item;
var localIdx = batchIdx % batchSize;
PreprocessImageToTensor(path, tensor, localIdx); // ImageSharp pixel buffers
});
// Single GPU pass for entire batch
var inputs = new List<NamedOnnxValue>
{
NamedOnnxValue.CreateFromTensor("input", tensor)
};
using var outputResults = session.Run(inputs);
// Extract embeddings from batch output...
}
return results;
}
}
Paragonazione di performance:
Input: 30 keyframes (after deduplication)
Serial processing (1 frame at a time):
30 × 200ms = 6,000ms (6.0 seconds)
Batch processing (8 frames per pass):
4 batches × 350ms = 1,400ms (1.4 seconds)
Speedup: 4.3x
Perché funziona il processo di lotto:
[8, 3, 224, 224] usa la stessa memoria GPU dell'immagine unica (almost)VideoSummarizer non reinventa ImageSum marizer o AudioSommarizer. Le catene. them.
L'estrazione del frammento chiave è divisa in 7 onde granulare ( vedete il grafico delle onde sopraM SK2 Qui' c'è un modello di coordinazione che mostra come si collegano insieme
// IFrameDetectionWave → KeyframeSelectionWave → ThumbnailExtractionWave
// → KeyframeDeduplicationWave → KeyframeFullResExtractionWave → ClipEmbeddingWave
// ClipEmbeddingWave coordinates with ImageSummarizer
public class ClipEmbeddingWave : IVideoWave, ISignalAwareVideoWave
{
public IReadOnlyList<string> RequiredSignals => [VideoSignals.KeyframesExtracted];
public IReadOnlyList<string> EmittedSignals => [VideoSignals.ClipEmbeddingsReady];
public async Task ProcessAsync(VideoContext context, CancellationToken ct)
{
var keyframes = context.GetCached<Dictionary<int, string>>("keyframes.paths");
// Batch CLIP embedding (3-5x faster than serial)
var embeddings = await _batchClipService.GenerateBatchEmbeddingsAsync(
keyframes, batchSize: 8, ct);
foreach (var (frameIndex, embedding) in embeddings)
context.KeyframeEmbeddings[frameIndex] = embedding;
}
}
// ImageAnalysisWave runs ImageSummarizer on deduplicated frames
public class ImageAnalysisWave : IVideoWave, ISignalAwareVideoWave
{
public IReadOnlyList<string> RequiredSignals => [VideoSignals.KeyframesDeduplicated];
public async Task ProcessAsync(VideoContext context, CancellationToken ct)
{
var keyframePaths = context.GetCached<List<string>>("keyframes.deduplicated_paths");
foreach (var path in keyframePaths)
{
// Run ImageSummarizer for OCR, vision, captions
var result = await _imageOrchestrator.AnalyzeAsync(path, ct);
context.SetCached($"image_analysis.{Path.GetFileName(path)}", result);
}
}
}
L'estrazione audio e la trascrizione sono ora segnali separati-onde di consapevolezza:
// AudioExtractionWave runs first (extracts audio track from video)
public class AudioExtractionWave : IVideoWave, ISignalAwareVideoWave
{
public IReadOnlyList<string> RequiredSignals => [VideoSignals.VideoNormalized];
public IReadOnlyList<string> EmittedSignals => ["audio.extracted", "audio.path"];
public async Task ProcessAsync(VideoContext context, CancellationToken ct)
{
var audioPath = await _ffmpegService.ExtractAudioAsync(
context.VideoPath, context.WorkingDirectory, ct);
context.SetCached("audio.path", audioPath);
}
}
// TranscriptionWave depends on audio.extracted signal
public class TranscriptionWave : IVideoWave, ISignalAwareVideoWave
{
public IReadOnlyList<string> RequiredSignals => ["audio.extracted"];
public IReadOnlyList<string> EmittedSignals => [
VideoSignals.TranscriptionComplete,
"transcription.utterance_count"
];
public async Task ProcessAsync(VideoContext context, CancellationToken ct)
{
var audioPath = context.GetCached<string>("audio.path");
// Run AudioSummarizer pipeline (Whisper + diarization)
var audioProfile = await _audioOrchestrator.AnalyzeAsync(audioPath, ct);
// Extract utterances with speaker info
var turns = audioProfile.GetValue<List<SpeakerTurn>>("speaker.turns");
foreach (var turn in turns ?? [])
{
context.Utterances.Add(new Utterance
{
Id = Guid.NewGuid(),
Text = turn.Text,
StartTime = turn.StartSeconds,
EndTime = turn.EndSeconds,
SpeakerId = turn.SpeakerId,
Confidence = turn.Confidence
});
}
// Run NER on full transcript for entity extraction
var transcript = audioProfile.GetValue<string>("transcription.full_text");
if (!string.IsNullOrEmpty(transcript))
{
var entities = await _nerService.ExtractEntitiesAsync(transcript, ct);
context.SetCached("transcript_entities", entities);
// Emit entity signals by type (PER, ORG, LOC, MISC)
foreach (var group in entities.GroupBy(e => e.Type))
{
context.AddSignal($"transcript.entities.{group.Key.ToLowerInvariant()}",
group.Select(e => e.Text).Distinct().ToList());
}
}
}
}
VideoSummarizer extrae entità chiamate dalle trascrizioni usando BERT-based NER M SK1ONNX).
public class OnnxNerService
{
// Model: dslim/bert-base-NER (ONNX exported)
// Entities: PER (Person), ORG (Organization), LOC (Location), MISC (Miscellaneous)
public async Task<List<EntitySpan>> ExtractEntitiesAsync(string text, CancellationToken ct)
{
var entities = new List<EntitySpan>();
// Chunk long text (BERT max 512 tokens)
foreach (var chunk in ChunkText(text, maxTokens: 400, overlap: 50))
{
// Tokenize with WordPiece
var tokens = _tokenizer.Tokenize(chunk);
// Run ONNX inference
var inputs = PrepareInputs(tokens);
using var results = _session.Run(inputs);
// Decode BIO tags
var predictions = DecodePredictions(results);
var chunkEntities = ExtractEntitySpans(tokens, predictions);
entities.AddRange(chunkEntities);
}
// Deduplicate entities
return entities
.GroupBy(e => (e.Text.ToLowerInvariant(), e.Type))
.Select(g => g.First())
.ToList();
}
}
Esempio output:
Transcript: "Today we're speaking with John Smith from Microsoft about
their new AI lab in Seattle. The project, codenamed Phoenix, builds
on research from Stanford University."
Entities extracted:
PER: John Smith
ORG: Microsoft, Stanford University
LOC: Seattle
MISC: Phoenix
Signals emitted:
transcript.entities.per = ["John Smith"]
transcript.entities.org = ["Microsoft", "Stanford University"]
transcript.entities.loc = ["Seattle"]
transcript.entities.misc = ["Phoenix"]
Perché il NER è importante per i video:
L'uso di inserzioni CLIP da sola per la rilevazione delle scene non funziona bene'keyframe sono sparsi dal design M SK2un cambio per ripresa), ma le riprese sono denseMSC4 Con 39 inserzioni per 1881 riprese (~2% coperturaMST8 l'insieme puro dell'inserzione produce solo una scena per un film d'oraMSSK9
VideoSummarizer usa un approccio multi-signale che combina segnali pesanti 4 per la rilevazione robusta dei confini della scena:
public class SceneClusteringWave : IVideoWave, ISignalAwareVideoWave
{
// Signal weights for boundary scoring
private const double EmbeddingWeight = 0.4; // CLIP embedding dissimilarity
private const double TranscriptWeight = 0.3; // Semantic shift in transcript
private const double CutTypeWeight = 0.2; // Fade/dissolve detection
private const double TemporalWeight = 0.1; // Time since last scene
// Temporal constraints
private const double MinSceneDuration = 15.0; // Don't split scenes < 15s
private const double MaxSceneDuration = 300.0; // Force split at 5 minutes
private const double TargetSceneDuration = 90.0; // Prefer ~90s scenes
public IReadOnlyList<string> RequiredSignals => [VideoSignals.ShotsDetected];
public IReadOnlyList<string> OptionalSignals => [
VideoSignals.ClipEmbeddingsReady,
VideoSignals.TranscriptionComplete,
VideoSignals.KeyframesDeduplicated
];
public IReadOnlyList<string> EmittedSignals => [
VideoSignals.ScenesDetected,
"scene.count",
"scene.avg_duration",
"scene.clustering_method"
];
private List<(int shotIndex, double score)> ComputeBoundaryScores(VideoContext context)
{
var shots = context.Shots.OrderBy(s => s.StartTime).ToList();
var scores = new List<(int, double)>();
// Build embedding map with nearest-neighbor interpolation
var shotEmbeddings = PropagateEmbeddingsToNearbyShots(context, shots);
// Build transcript windows for semantic shift detection
var transcriptWindows = BuildTranscriptWindows(context, shots, windowSeconds: 10);
for (int i = 0; i < shots.Count - 1; i++)
{
double score = 0;
var currentShot = shots[i];
var nextShot = shots[i + 1];
// 1. Embedding dissimilarity (40%)
if (shotEmbeddings.TryGetValue(i, out var currentEmbed) &&
shotEmbeddings.TryGetValue(i + 1, out var nextEmbed))
{
var similarity = CosineSimilarity(currentEmbed, nextEmbed);
score += (1.0 - similarity) * EmbeddingWeight;
}
// 2. Transcript semantic shift (30%)
if (transcriptWindows.TryGetValue(i, out var currentWords) &&
transcriptWindows.TryGetValue(i + 1, out var nextWords))
{
var overlap = currentWords.Intersect(nextWords).Count();
var union = currentWords.Union(nextWords).Count();
var jaccard = union > 0 ? (double)overlap / union : 0;
score += (1.0 - jaccard) * TranscriptWeight;
}
// 3. Cut type signal (20%) - fades/dissolves suggest scene boundaries
if (currentShot.CutType is "fade" or "dissolve")
{
score += CutTypeWeight;
}
// 4. Temporal pressure (10%) - encourage splits near target duration
var timeSinceLastScene = currentShot.EndTime - GetLastSceneBoundary();
if (timeSinceLastScene > TargetSceneDuration)
{
var pressure = Math.Min(1.0, (timeSinceLastScene - TargetSceneDuration) / 60);
score += pressure * TemporalWeight;
}
scores.Add((i, score));
}
return scores;
}
}
Avvicinamento-Propagazione dell'imbarcazione vicino: Solo ~2% di scatto hanno inserzioni CLIP directeM SK2 La nuova approccio propaga le inserzioni ai scattos vicini in pochi secondi usando il weighting temporale della vicinanza.
Windows Semantici di Transcrizione: Costruisce 10-secondi di finestre su parole intorno a ogni scatto e rileva i cambiamenti semantici attraverso la distanza di Jaccard-un proxy di spostamento semantice economico (la sovrapposizione bassa S= cambiamento di temaM SK5 BMMSC6 si può usare la sovrapposta o l'inserzione di un spostamento se disponibile
La consapevolezza del tipo di taglio: FadeM SK1to-Le transizioni di nero e di dissolvimento indicano fortemente i confini della scena , stimolando il punteggio dei confiniMSC4
Limiti adattivi: Invece di una soglia fissaM SK1 seleziona i limiti dalla parte superiore 25% dei punteggi ( adatta al contenuto).
Contrattivi Temporali: Fa rispettare il minimo 15 le scene e imposce i limiti a
Esempio:
Input: 1881 shots from a 2-hour movie
39 keyframes with CLIP embeddings
2302 utterances from transcript
Boundary scoring per shot:
Shot 45-46: embedding=0.15, transcript=0.32, cut=0.0, temporal=0.0 → score=0.156
Shot 46-47: embedding=0.08, transcript=0.12, cut=0.0, temporal=0.0 → score=0.068
Shot 47-48: embedding=0.35, transcript=0.41, cut=0.2, temporal=0.05 → score=0.388 ← BOUNDARY
...
Adaptive threshold (top 25%): 0.25
Natural boundaries found: 45
Output: 47 scenes (avg 2.6 minutes per scene)
- Min scene: 15.2s
- Max scene: 298.4s
- Total coverage: 100%
Signals:
scenes.detected = true
scene.count = 47
scene.avg_duration = 156.3
scene.clustering_method = "multi_signal_weighted"
VideoSummarizer estende il contratto di segnale da ImageSommarizer e AudioSum marizer:
public record VideoSignal
{
public required string Key { get; init; } // "scene.count", "transcript.entities.per"
public object? Value { get; init; }
public double Confidence { get; init; } = 1.0;
public required string Source { get; init; } // "SceneClusteringWave"
// Video-specific: time range
public double? StartTime { get; init; }
public double? EndTime { get; init; }
public DateTime Timestamp { get; init; }
public Dictionary<string, object>? Metadata { get; init; }
public List<string>? Tags { get; init; } // ["visual", "scene"]
}
public static class VideoSignalTags
{
public const string Visual = "visual";
public const string Audio = "audio";
public const string Speech = "speech";
public const string Ocr = "ocr";
public const string Motion = "motion";
public const string Scene = "scene";
public const string Shot = "shot";
public const string Metadata = "metadata";
}
I segnali chiave emetti:
| Signale | Source | Description S |
|---|---|---|
video.duration |
NormalizzareWave | Duration totale in secondi |
video.resolution |
NormalizzareWave | larghezzaM SK2altezza |
video.fps |
NormalizzareWave | Tasso di riferimento |
shots.count |
ShotDetectionWave | |
keyframes.count |
KeyframeExtractionWave | Frami chiave unici dopo la dedupzione |
keyframes.duplicates_skipped |
KeyframeExtractionWave | |
scene.count |
SceneClusteringWave | |
transcript.entities.per |
TranscriptionWave | I nomi delle persone del NER |
transcript.entities.org |
TranscriptionWave | I nomi dell'organizzazione |
transcript.word_count |
TranscriptionWave | Totale parole in trascrizione |
L'informazione figura nella parte dispositiva. VideoPipeline converte i segnali video in ContentChunk per l'indexazione RAG:
public class VideoPipeline : PipelineBase
{
public override string PipelineId => "video";
public override IReadOnlySet<string> SupportedExtensions => new HashSet<string>
{
".mp4", ".mkv", ".avi", ".mov", ".wmv", ".webm", ".flv", ".m4v", ".mpeg", ".mpg"
};
private List<ContentChunk> BuildContentChunks(VideoContext context, string filePath)
{
var chunks = new List<ContentChunk>();
// 1. Scene-based chunks (best for video retrieval)
foreach (var scene in context.Scenes)
{
var sceneText = BuildSceneText(context, scene);
var embedding = context.GetCached<float[]>($"scene_centroid.{scene.Id}");
chunks.Add(new ContentChunk
{
Text = sceneText,
ContentType = ContentType.Summary,
Embedding = embedding, // Proper vector column, not metadata
Metadata = new Dictionary<string, object?>
{
["source"] = "video_scene",
["scene_id"] = scene.Id,
["key_terms"] = scene.KeyTerms,
["speakers"] = scene.SpeakerIds,
["start_time"] = scene.StartTime,
["end_time"] = scene.EndTime
}
});
}
// 2. Transcript chunks (1-minute windows)
var transcriptChunks = BuildTranscriptChunks(context, filePath);
chunks.AddRange(transcriptChunks);
// 3. Text track chunks (on-screen text/subtitles)
foreach (var textTrack in context.TextTracks)
{
chunks.Add(new ContentChunk
{
Text = $"On-screen text: {textTrack.Text}",
ContentType = ContentType.ImageOcr,
Metadata = new Dictionary<string, object?>
{
["source"] = "video_ocr",
["text_type"] = textTrack.TextType.ToString(),
["start_time"] = textTrack.StartTime
}
});
}
return chunks;
}
private string BuildSceneText(VideoContext context, SceneSegment scene)
{
var parts = new List<string>();
if (!string.IsNullOrEmpty(scene.Label))
parts.Add($"Scene: {scene.Label}");
parts.Add($"[{FormatTime(scene.StartTime)} - {FormatTime(scene.EndTime)}]");
if (scene.KeyTerms.Count > 0)
parts.Add($"Topics: {string.Join(", ", scene.KeyTerms)}");
// Add utterances in this scene
var sceneUtterances = context.Utterances
.Where(u => u.StartTime >= scene.StartTime && u.EndTime <= scene.EndTime)
.OrderBy(u => u.StartTime);
if (sceneUtterances.Any())
parts.Add($"Speech: {string.Join(" ", sceneUtterances.Select(u => u.Text))}");
return string.Join("\n", parts);
}
}
Esempio di output per un film:
{
"chunks": [
{
"text": "Scene: Opening montage\n[0:00 - 2:34]\nTopics: city, night, traffic\nSpeech: The year is 2049. The world has changed.",
"contentType": "Summary",
"metadata": {
"source": "video_scene",
"scene_id": "abc123",
"key_terms": ["city", "night", "traffic"],
"start_time": 0.0,
"end_time": 154.0
}
},
{
"text": "The detective arrived at the crime scene. Forensics had already processed the area.",
"contentType": "Transcript",
"metadata": {
"source": "video_transcript",
"time_window": "2:34 - 3:34",
"utterance_count": 4
}
},
{
"text": "On-screen text: LOS ANGELES 2049",
"contentType": "ImageOcr",
"metadata": {
"source": "video_ocr",
"text_type": "Title"
}
}
]
}
| Stazione | Tempo | Note S | |||||
|---|---|---|---|---|---|---|---|
| FFprobe metadata | |||||||
| Detezione di sparatorie | ~10s S | Filtro di scena FFmpeg M | |||||
| Extrazione di frammenti chiave | ~30s | \500 IM SK5frame SSK6 | |||||
| deduplicazione di dHash | ~0.5s | \500 | 5 | 6 | frami | 7 | |
| Inserzione di CLIP in un batchetto | CSK2s | \300 fotogrammi, batchamento S8 | |||||
| ImageSummarizer OCR | |||||||
| Extrazione d'audio | |||||||
| Transcrizione murmurata | ~180s S | \2 ore di discorso SSK5 | |||||
| Diarizzazione dell'altoparlante | ~60s M | ECAPA-TDNN P | |||||
| Extrazione del NER | ~10s M | BERTM SK4NER sulla trascrizione | |||||
| Clustrazione di scena | ~5s M | ≥ | |||||
| Generazione di prove | ~2s M | ≥ | |||||
| Totale | ~8-10 minuti |
| ottimizzazione | risparmio |
|---|---|
| deduplicazione di dHash | ~40% fotogrammi filtrati M= ~24s CLIP salvato |
| CLIP di catena | 3-5x più veloce SSK3 ~180s risparmiato S |
| Composizione del tubo | Riutilizza l'immaurizzatore di immaginiM SK2Le onde dell'audio |
| Totali risparmi | ~3-4 minuti |
| Componente | |
|---|---|
| CLIP ViT | |
| Base di fischio | ~500MB S |
| ECAPA-TDNN | |
| BERTM SK1NER | |
| Piccolo | ~1.5GB |
VideoSummarizer registra come un IPipeline per il routing automatico:
// In Program.cs
builder.Services.AddDocSummarizer(builder.Configuration.GetSection("DocSummarizer"));
builder.Services.AddDocSummarizerImages(builder.Configuration.GetSection("Images"));
builder.Services.AddVideoSummarizer(); // NEW
builder.Services.AddPipelineRegistry(); // Must be last
// Auto-routing by extension
var registry = services.GetRequiredService<IPipelineRegistry>();
var pipeline = registry.FindForFile("movie.mp4"); // Returns VideoPipeline
var result = await pipeline.ProcessAsync("movie.mp4");
Estensioni supportate:
.mp4, .mkv, .avi, .mov, .wmv, .webm, .flv, .m4v, .mpeg, .mpgVideoSummarizer dimostra che La composizione delle pipeline. Scale:
Il risultato: un film di 2-ora diventa un ledger di segnali strutturato con scene, transcrizioni, entità, ,, e inserzioni,-, pronti per ricerche RAG come l':.
Il modello RAG ridotto per video:
Ingestion: Video → 16 waves → Signals + Evidence (scenes, transcripts, entities)
Storage: Signals (indexed) + Embeddings (CLIP, voice) + Evidence (chunks)
Query: Filter (SQL) → Search (BM25 + vector) → Synthesize (LLM, ~5 results)
Il sistema di capacità:
Startup: Detect GPU → Load ModelManifest (YAML) → Initialize SignalSink
Activation: Component requests model → Lazy download → Signal "ModelAvailable"
Routing: Route to best provider → Fallback chain → Backpressure control
Atoms: Rate limiting + Time estimation + Pipeline balancing
Questo è Fuzzinesse limitata a scala:
Il LLM opera su pre--evidenza computata-non video crudo.
Patterns Core:
Implementazioni RAG riducite:
| Parte | Pattern | Focus S |
|---|---|---|
| 1 | Fuzzinesse limitata | Componente unica |
| 2 | MoM Fuzzy Constretto | Numerosi componenti |
| 3 | Dragging Contexto | Tempo / memoria |
| 4 | Intelligenza dell'immagine | Architectura delle ondeM SK1 22 onde |
| 4.1 | Tre-Tier OCR Pipeline | OCRM SK1 Modelli ONNX, filmtrips |
| 4.2 | AudioSummarizer | Audio forense, diarizzazione dell'altoparlante |
| 4.3 | VideoSummarizer (Questo articolo) | Orchestrazione video, batch CLIP, NER |
Più avanti: MultiM SK1Graphmodal RAG con lucidRAG-componendo tutti i quattro somministratori in un grafico di conoscenza unificato con un crossMSC3ente multi collegato a .
Tutte le parti segueno la stessa invariante: Componenti probabilistice propose; sistemi deterministici persistono.
© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.