Kick from edge forward

This commit is contained in:
2023-08-01 11:25:31 +01:00
parent 9a8aca72ab
commit 0634622c4d
20 changed files with 523 additions and 74 deletions

View File

@ -1,3 +1,4 @@
using System.Diagnostics;
using FFMpegCore;
using NostrStreamer.Database;
@ -24,6 +25,7 @@ public class ThumbnailService
var path = MapPath(stream.Id);
try
{
var sw = Stopwatch.StartNew();
var cmd = FFMpegArguments
.FromUrlInput(new Uri(_config.RtmpHost, $"{stream.Endpoint.App}/source/{stream.User.StreamKey}?vhost=hls.zap.stream"))
.OutputToFile(path, true, o => { o.ForceFormat("image2").WithCustomArgument("-vframes 1"); })
@ -31,10 +33,12 @@ public class ThumbnailService
_logger.LogInformation("Running command {cmd}", cmd.Arguments);
await cmd.ProcessAsynchronously();
sw.Stop();
_logger.LogInformation("Generated {id} thumb in {n:#,##0}ms", stream.Id, sw.Elapsed.TotalMilliseconds);
}
catch (Exception ex)
{
_logger.LogWarning("Failed to generate thumbnail {msg}", ex.Message);
_logger.LogWarning("Failed to generate {id} thumbnail {msg}", stream.Id, ex.Message);
}
}