Time parsing error when transcoding long than 24 hours
kuochenwoo opened this issue · 4 comments
When using ffmpegCore to transcoding for longer than 24hour, the following error is thrown:
Unhandled exception. System.OverflowException: The TimeSpan string '24:00:00.00' could not be parsed because at least one of the numeric components is out of range or contains too many digits.
at System.Globalization.TimeSpanParse.TimeSpanResult.SetOverflowFailure()
at System.Globalization.TimeSpanParse.ProcessTerminal_HMS_F_D(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
at FFMpegCore.FFMpegArgumentProcessor.ErrorData(Object sender, String msg)
at System.Diagnostics.AsyncStreamReader.FlushMessageQueue(Boolean rethrowInNewThread)
--- End of stack trace from previous location ---
at System.Diagnostics.AsyncStreamReader.<>c.<FlushMessageQueue>b__18_0(Object edi)
at System.Threading.QueueUserWorkItemCallbackDefaultContext.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
We are using the latest versions of ffmepgCore of v5.1.0
And the related code snippet is:
private async Task<bool> FfmpegExecTask(string ffmpegInputOptions, string ffmpegOutputOptions, string codec
{
return await FFMpegArguments
.FromPipeInput(this.RawVideoPipeWriter, options => options
.WithCustomArgument(ffmpegInputOptions))
.OutputToUrl(string.Empty, args => args
.WithVideoCodec(FFMpeg.GetCodec(codec))
.WithCustomArgument(ffmpegOutputOptions)
.UsingMultithreading(false)
.WithFastStart()
)
.NotifyOnProgress((time) => logger.Verbose($"Progress {this.StreamName}: {time}"))
.NotifyOnOutput((string output) =>
{
logger.Verbose($"RtspServer Notify output Stream {this.StreamName}: {output}");
})
.NotifyOnError((err) => { logger.Verbose($"RtspServer STDError Stream {this.StreamName}: {err}"); })
.CancellableThrough(cancellationToken, this.FfmpegTcpTimeout)
.ProcessAsynchronously().ConfigureAwait(false);
}
Similar issue is also mentioned in:
#170 (comment)
I guess this error is related to
https://github.com/rosenbjerg/FFMpegCore/blob/main/FFMpegCore/FFMpeg/FFMpegArgumentProcessor.cs#L266
If the registered callback function tries to parse the TimeSpan string larger than “24:00:00”, then the parsing error would be thrown.
We are facing the same issue too :(
Hi Maintainers, I've proposed a PR above. Can someone plz review it?
is this repo maintained? cant see any release or checkins since 9 months :(
Hi! We met this issue too. It would be great if you fixed this using the pull request above :)