Use DGDemux in C# Application - get no StandardOutput

Post Reply
DAE avatar
LastOne
Posts: 7
Joined: Thu Jul 14, 2022 10:37 am

Use DGDemux in C# Application - get no StandardOutput

Post by LastOne »

Hallo,
i would like to use DGDemux in a c# Application.

i Use the following Code for some other Commandline Interfaces and normaly i get information from StandardOutput or by ffnpeg StandardError.

Code: Select all

using(Process process = new Process())
{                           
	process.StartInfo.FileName = dgDemuxerFilePath;                            
	process.StartInfo.UseShellExecute = false;
	process.StartInfo.CreateNoWindow = true;
	process.StartInfo.RedirectStandardInput = true;
	process.StartInfo.RedirectStandardError = true;
	process.StartInfo.RedirectStandardOutput = true;
	process.StartInfo.Arguments = command; //"/S /C \"" + command + "\"";

	process.OutputDataReceived += (s, e) =>
	{
		if (_newEventReportMethod != null)
		{
			_newEventReportMethod.Report(e.Data);
		}
	};

	process.ErrorDataReceived += (s, e) =>
	{
		if (_stopWorking)
		{
			process.Kill(true);
		}

		redirectedErrorOutput = e.Data;

		if (_newEventReportMethod != null)
		{
			_newEventReportMethod.Report(redirectedErrorOutput);
		}

		if (!string.IsNullOrEmpty(redirectedErrorOutput))
		{
			if (redirectedErrorOutput.ToLower().Contains("error while decoding") || redirectedErrorOutput.ToLower().Contains("broken pipe"))
			{
				hasError = true;
				process.Kill(true);
			}
		}
	};

	try
	{
		process.Start();
		process.BeginOutputReadLine();
		process.BeginErrorReadLine();                        
		process.WaitForExit();
	}
	catch (Exception ex)
	{
		//ex.Message;
	}
}
At DGDemux the Events OutpurDataRecived and ErrorDataRecived fires only if the Application finished the work.

Could you Please implement the OutputData that i get the Progress of the Demuxing process?


thx and regards
lastone
User avatar
Rocky
Moose Approved
Posts: 2421
Joined: Fri Sep 06, 2019 12:57 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Rocky »

You are invoking DGDemux.exe (not DGDemuxGUI.exe)? If yes, show me the command line.

DGDemux uses printf() for everything unless you give the -l option, in which case it uses fprintf() to the specified file path.

I don't know anything about C# or what you are doing.
DAE avatar
LastOne
Posts: 7
Joined: Thu Jul 14, 2022 10:37 am

Use DGDemux in C# Application - get no StandardOutput

Post by LastOne »

hi,
the dgDemuxerFilePath holds "C:\DGDemuxer.exe"
and as command i use
"-i "D:\BDMV\PLAYLIST\00800.mpls" -o "D:\Streams" -demux 1011,1100,1101,Chapters"

I use the DGDemux.exe as Commandline in the C# Code.

But at DGDemux the OutputEvent dont raise until the process is finished.
I try with the command -l and -l nul.

But i never get the Progress like in the normal Windows CMD.
User avatar
Rocky
Moose Approved
Posts: 2421
Joined: Fri Sep 06, 2019 12:57 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Rocky »

LastOne wrote:
Thu Jul 14, 2022 12:37 pm
the dgDemuxerFilePath holds "C:\DGDemuxer.exe"
Typo? There is no DGDemuxer.exe.
and as command i use
"-i "D:\BDMV\PLAYLIST\00800.mpls" -o "D:\Streams" -demux 1011,1100,1101,Chapters"
OK, looks good.
But at DGDemux the OutputEvent dont raise until the process is finished.
Don't know C# so can't help with that. If you DO NOT give the -l then the progress lines are written with printf() and are terminated with \n.
I try with the command -l and -l nul.
No you must NOT have the -l option.

Are you getting any output at all? Maybe your paths are wrong or something. It works just at CMD prompt?

When you get the event at end what is the string that is printed?
DAE avatar
LastOne
Posts: 7
Joined: Thu Jul 14, 2022 10:37 am

Use DGDemux in C# Application - get no StandardOutput

Post by LastOne »

hi,
dgdemuxer.exe was a mistake, i use dgdemux.exe

my command runs fine an i get the streams demuxed, in the windows cmd and in my programm.

the only thing what i need for my application ist the progress to show the user where the demux progress is.

with this c# code i use ffmpeg, lame, ogg, x264 and all give me infos.
thats why i dont know whats wrong because i dont write in c++
User avatar
Rocky
Moose Approved
Posts: 2421
Joined: Fri Sep 06, 2019 12:57 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Rocky »

Try this:

https://rationalqm.us/misc/DGDemux.exe

stdout gets flushed on a newline for console output, but apparently not when redirected. I added an explicit fflush(stdout) after the printf().
DAE avatar
LastOne
Posts: 7
Joined: Thu Jul 14, 2022 10:37 am

Use DGDemux in C# Application - get no StandardOutput

Post by LastOne »

hi
i get a message that this is Win32/Sabsik.FL.B!ml
could you please zip the file that i can download it and test it in a virtual machine without the windows defender
User avatar
Rocky
Moose Approved
Posts: 2421
Joined: Fri Sep 06, 2019 12:57 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Rocky »

DAE avatar
LastOne
Posts: 7
Joined: Thu Jul 14, 2022 10:37 am

Use DGDemux in C# Application - get no StandardOutput

Post by LastOne »

now it works, i get the progress.

thx
User avatar
Bullwinkle
Moose Approved
Posts: 295
Joined: Thu Sep 05, 2019 6:37 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Bullwinkle »

Great to hear. Thank you for the report and welcome to the forum. Rocky is napping. ;)

Will be included in the next release.
DAE avatar
LastOne
Posts: 7
Joined: Thu Jul 14, 2022 10:37 am

Use DGDemux in C# Application - get no StandardOutput

Post by LastOne »

i am glad to can help

but i get stil the warning from windows defender that dgdemus is a trojaner Win32/Sabsik.FL.B!ml and it will delete if i use a machine with the defender.

could you please have a look why it was classified as a trojaner ?
User avatar
Bullwinkle
Moose Approved
Posts: 295
Joined: Thu Sep 05, 2019 6:37 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Bullwinkle »

Sorry, we don't care about false virus reports. Several other prominent developers have the same policy. If you don't trust us don't use our tools. We've been developing and providing tools since 2003.

You can run it through VirusTotal and probably you'll see only one or two thinking it is a virus.

You can add it as an exclusion:

1. Go to Start > Settings > Update & Security > Windows Security > Virus & threat protection.
2. Under Virus & threat protection settings, select Manage settings, and then under Exclusions, select Add or remove exclusions.

BTW, it is not reported as a virus on our Win10 system.
User avatar
Rocky
Moose Approved
Posts: 2421
Joined: Fri Sep 06, 2019 12:57 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Rocky »

Yup. I just ran it through VirusTotal and 1 out of 69 anti-virus checkers thought it was bad. You guessed it: Windows Defender.

If you do a google search you'll find other developers reporting these false detections, going back years. Search "Win32/Sabsik.FL.B!ml false detections".
DAE avatar
LastOne
Posts: 7
Joined: Thu Jul 14, 2022 10:37 am

Use DGDemux in C# Application - get no StandardOutput

Post by LastOne »

i saw the result of virus total.

i know your tools longer than i know that is from you :)

the first was dgindex
User avatar
Bullwinkle
Moose Approved
Posts: 295
Joined: Thu Sep 05, 2019 6:37 pm

Use DGDemux in C# Application - get no StandardOutput

Post by Bullwinkle »

Ha ha. There was a lot of VirtualDub stuff even before DGIndex.
Post Reply