FFMpegCore icon indicating copy to clipboard operation
FFMpegCore copied to clipboard

System.IO.IOException: "Pipe is broken." when using duration

Open ComTols opened this issue 3 years ago • 2 comments

When I try to add a duration a System.IO.IOException is thrown.

await FFMpegArguments
	.FromPipeInput(new StreamPipeSource(stream))
	.OutputToPipe(new StreamPipeSink(outputStream), options => options
		.WithVideoCodec("vp9")
		.Seek(new TimeSpan(0,0,5))
		.WithDuration(TimeSpan.FromSeconds(5))
		.ForceFormat("webm"))
	.ProcessAsynchronously();

Without the duration it works perfectly. My input stream is a WebM audio file from the Internet. Please fix I need this function.

ComTols avatar Jul 03 '22 15:07 ComTols

Same here FFProbeHelper.VerifyFFProbeExists(new FFOptions { BinaryFolder = "./", TemporaryFilesFolder = "/tmp" }); using (var videoStream = await AzureStorageManager.DownloadAsync(model.VideoFilePath, AzureContainers.video)) { var mediaInfo = await FFProbe.AnalyseAsync(videoStream); model.AdvertLength = mediaInfo.Duration.Seconds; }

await FFProbe.AnalyseAsync(videoStream); return null because of System.Io.IoException "Pipe is broken"

bidy avatar Aug 26 '22 19:08 bidy

@ComTols Pretty sure that this is a case of incompatible arguments (based on this).

.Seek(new TimeSpan(0,0,5))

tells ffmpeg to skip to that elapsed time in the stream (so, 5 seconds as written).

.WithDuration(TimeSpan.FromSeconds(5))

tells ffmpeg to limit the stream to the specified duration (again, 5 seconds as written). So, essentially, you're trying to read beyond the end of the stream, given your arguments.

@bidy I'm not seeing a whole lot of overlap with the original issue. Probably need to repost that as a new issue (preferably formatted as a code block? Use three ` rather than one).

tiesont avatar Aug 26 '22 21:08 tiesont

Assuming tiesont's suggestion solved the issue, I will close this one

rosenbjerg avatar Feb 09 '23 19:02 rosenbjerg