WIP: contenitori, sonda dei metadati, fotogrammi e scrittore MP4 in casa; via ffmpeg e ffprobe (#58)
Lettori ISO BMFF (anche frammentato), Matroska/WebM e AVI; ContainerVideoMetadataProbe è la sonda predefinita; VideoFrameDecoder (H.264 in casa, BMP ruotato, riconoscimento dei video fermi) sostituisce VideoFrameExtractor; Mp4Writer con moov in testa. Tolti ffmpeg e ffprobe da Dockerfile, CI, script e prove. WIP perché la corsa completa di tests/Febe.Tests non era finita al momento del commit e l'ultima correzione (data qualsiasi nella lettura dei campioni) non è stata ricompilata né riprovata: la compilazione durante la corsa fallisce per DLL bloccate dalle prove in esecuzione. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
697de97ec3
commit
6ffcb1bb18
39 files changed
+4235
-469
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using Febe.Core.Library;
|
||||
using Febe.Tests.Codecs.Containers;
|
||||
using Febe.Tests.Support;
|
||||
using SkiaSharp;
|
||||
|
||||
@@ -105,39 +106,19 @@ public sealed class ThumbnailStoreTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task VideoFramesComeFromFfmpegWhenAvailable()
|
||||
public async Task VideoFramesComeFromTheInHouseDecoder()
|
||||
{
|
||||
var ffmpeg = VideoFrameExtractor.TryCreate();
|
||||
if (ffmpeg is null)
|
||||
{
|
||||
Assert.Inconclusive("ffmpeg non è installato: le miniature dei video senza copertina usano la tessera neutra.");
|
||||
}
|
||||
|
||||
using var temp = new TempFolder();
|
||||
var video = temp.Combine("prova.mp4");
|
||||
var start = new System.Diagnostics.ProcessStartInfo(ffmpeg.Executable)
|
||||
{
|
||||
RedirectStandardError = true,
|
||||
RedirectStandardOutput = true,
|
||||
UseShellExecute = false,
|
||||
};
|
||||
foreach (var argument in new[] { "-hide_banner", "-nostdin", "-v", "error", "-f", "lavfi", "-i", "testsrc=duration=2:size=640x360:rate=10", "-pix_fmt", "yuv420p", video })
|
||||
{
|
||||
start.ArgumentList.Add(argument);
|
||||
}
|
||||
var es = ElementaryStream.Load("CABA3_SVA_B");
|
||||
var video = TestVideos.Write(temp, "prova.mp4", TestVideos.Mp4(es));
|
||||
|
||||
using (var process = System.Diagnostics.Process.Start(start)!)
|
||||
{
|
||||
await process.WaitForExitAsync();
|
||||
Assert.AreEqual(0, process.ExitCode, "ffmpeg non ha creato il video di prova.");
|
||||
}
|
||||
|
||||
var frame = await ffmpeg.ExtractJpegAsync(video);
|
||||
var frame = await VideoFrameDecoder.Instance.ExtractImageAsync(video);
|
||||
Assert.IsNotNull(frame);
|
||||
var store = new ThumbnailStore(temp.Combine("miniature"));
|
||||
Assert.IsTrue(store.Create(Make.Sha(6), new MemoryStream(frame)));
|
||||
Assert.AreEqual(480, InfoOf(store.PathFor(Make.Sha(6))).Width);
|
||||
var info = InfoOf(store.PathFor(Make.Sha(6)));
|
||||
Assert.AreEqual((es.Width, es.Height), (info.Width, info.Height));
|
||||
|
||||
Assert.IsNull(await ffmpeg.ExtractJpegAsync(temp.Combine("non-esiste.mp4")));
|
||||
Assert.IsNull(await VideoFrameDecoder.Instance.ExtractImageAsync(temp.Combine("non-esiste.mp4")));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user