How Recording 100 rtsp or more
desenvolvimentofonelight opened this issue · 0 comments
desenvolvimentofonelight commented
I'm using FFMpegCore to record 100 cameras, the problem I'm going through is that it opens the 100 ffmpeg processes but only starts recording +/- 15 cameras only. When I do the same process, only using Process.Start, they all open and save normally. On the system I take camera by camera and create a Threading.Thread function Gerar
For Each Item In Lista
If Not Directory.Exists(Path.GetDirectoryName(Item.outputFilePath)) Then Directory.CreateDirectory(Path.GetDirectoryName(Item.outputFilePath))
Dim T1 = New Threading.Thread(AddressOf Gerar) With {.IsBackground = True}
Dim Parametro1 = New Object() {Item.SimpleRtspUrl, Item.outputFilePath, Item.ChaveCamera}
T1.Start(Parametro1)
'Dim T1 = New Threading.Thread(AddressOf FFMPEGV2) With {.IsBackground = True}
'Dim Parametro1 = New Object() {Item.SimpleRtspUrl, Item.outputFilePath, Item.ChaveCamera}
'T1.Start(Parametro1)
Next
Public Sub Gerar(Ob As Object)
Dim rtspUrl As String = Ob(0)
Dim outputFilePath As String = Ob(1)
Dim ChaveCamera As String = Ob(2)
Try
Dim aaa = FFMpegArguments.FromUrlInput(New Uri(rtspUrl), Sub(argumento)
argumento.WithCustomArgument("-re")
argumento.WithCustomArgument("-rtsp_transport tcp")
argumento.WithCustomArgument("-timeout 50000000")
End Sub) _
.OutputToFile(outputFilePath, True, Sub(options)
options.UsingMultithreading(True)
options.WithVideoCodec("copy")
options.WithCustomArgument("-an")
options.WithConstantRateFactor(21)
options.OverwriteExisting()
options.WithCustomArgument("-reset_timestamps 1")
options.WithCustomArgument("-f segment")
options.WithCustomArgument("-segment_time 10")
options.WithCustomArgument("-segment_time_delta 0")
options.WithCustomArgument("-strftime 1")
End Sub) _
.WithLogLevel(Enums.FFMpegLogLevel.Debug) _
.NotifyOnProgress(Sub(tt)
Log2(tt.ToString, ChaveCamera)
End Sub) _
.ProcessSynchronously(True, New FFOptions With {.BinaryFolder = "D:\ffmpeg5\bin", .TemporaryFilesFolder = "D:\1\00000000002"})
'options.WithVariableBitrate(4)
'options.WithAudioCodec(AudioCodec.)
'options.WithFastStart()
'options.WithCustomArgument("-analyzeduration 5000000")
'options.WithCustomArgument("-probesize 5000000")
'Console.WriteLine("Gravação concluída! O vídeo foi salvo em: " & outputFilePath)
Catch ex As Exception
Log($"{MethodBase.GetCurrentMethod().Name} -> {ex}", ChaveCamera)
End Try
End Sub
It's just like that, just a few recording. The other FFMPEG has no CPU or network consumption