Skip to content

Conversation

@ChocoLZS
Copy link

Fix the stuck issue mentioned in #468

When ffmpeg exit abnormally, error happend for using RE_LIVE_PIPE_OPTIONS with pipe to ffmepg muxer.

In Windows, beacause of NamedPipeServerStream, the program will exited by C# throwing Exception.
In linux, the Process may not handle the none-zero exit code, so the main thread is still running.

I‘m not an expert at C#, I tryied to log the error message from ffmpeg process, but failed.


Command

RE_LIVE_PIPE_OPTIONS="-c copy -f flv rtmp://${url}"  N_m3u8DL-RE "url" --live-real-time-merge --live-pipe-mux

Windows pipe error to ffmpeg

ERROR: System.IO.IOException: Pipe is broken.
   at System.IO.Pipes.PipeStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Stream.CopyTo(Stream destination, Int32 bufferSize)
   at N_m3u8DL_RE.DownloadManager.SimpleLiveRecordManager2.RecordStreamAsync(StreamSpec streamSpec, ProgressTask task, SpeedContainer speedContainer, BufferBlock`1 source) in N_m3u8DL-RE\src\N_m3u8DL-RE\DownloadManager\SimpleLiveRecordManager2.cs:line 564
   at N_m3u8DL_RE.DownloadManager.SimpleLiveRecordManager2.<>c__DisplayClass28_0.<<StartRecordAsync>b__8>d.MoveNext() in N_m3u8DL-RE\src\N_m3u8DL-RE\DownloadManager\SimpleLiveRecordManager2.cs:line 854
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.<>c__53`1.<<ForEachAsync>b__53_0>d.MoveNext()
--- End of stack trace from previous location ---
   at N_m3u8DL_RE.DownloadManager.SimpleLiveRecordManager2.<>c__DisplayClass28_0.<<StartRecordAsync>b__1>d.MoveNext() in N_m3u8DL-RE\src\N_m3u8DL-RE\DownloadManager\SimpleLiveRecordManager2.cs:line 850
--- End of stack trace from previous location ---
   at Spectre.Console.Progress.<>c__DisplayClass31_0.<<StartAsync>b__0>d.MoveNext() in /_/src/Spectre.Console/Live/Progress/Progress.cs:line 103
--- End of stack trace from previous location ---
   at Spectre.Console.Progress.<>c__DisplayClass32_0`1.<<StartAsync>b__0>d.MoveNext() in /_/src/Spectre.Console/Live/Progress/Progress.cs:line 138
--- End of stack trace from previous location ---
   at Spectre.Console.Internal.DefaultExclusivityMode.RunAsync[T](Func`1 func) in /_/src/Spectre.Console/Internal/DefaultExclusivityMode.cs:line 40
   at Spectre.Console.Progress.StartAsync[T](Func`2 action) in /_/src/Spectre.Console/Live/Progress/Progress.cs:line 121
   at Spectre.Console.Progress.StartAsync(Func`2 action) in /_/src/Spectre.Console/Live/Progress/Progress.cs:line 101
   at N_m3u8DL_RE.DownloadManager.SimpleLiveRecordManager2.StartRecordAsync() in N_m3u8DL-RE\src\N_m3u8DL-RE\DownloadManager\SimpleLiveRecordManager2.cs:line 811
   at N_m3u8DL_RE.Program.DoWorkAsync(MyOption option) in N_m3u8DL-RE\src\N_m3u8DL-RE\Program.cs:line 410
   at N_m3u8DL_RE.CommandLine.CommandInvoker.<>c__DisplayClass81_0.<<InvokeArgs>b__0>d.MoveNext() in N_m3u8DL-RE\src\N_m3u8DL-RE\CommandLine\CommandInvoker.cs:line 628
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

@nilaoda nilaoda force-pushed the main branch 2 times, most recently from d1bea34 to e53faf6 Compare October 27, 2025 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant