PDA

View Full Version : pipe reading problems


d2mp
22nd September 2006, 03:17
I've been programming my own divx to dvd conversion tool:
d2mp, (http://d2mp.planetaclix.pt).
This tool uses several other tools for the conversion process(quenc, avisynth, dgindex, besweet, ffmpeg, dvdauthor, mkisofs)

When calling the command line tools, it will be helpfull to dump the stdout to a file and so constitue a detailed log for error handling.
All my code is made in delphi, and tried several times to redirect the command line tools stdout to my own created pipes.
When a command line tool ends I try to read the pipe that i've associated for the stdout, but my program hangs in readfile for the pipe.

Any ideias?

thank's
d2mp
http://d2mp.planetaclix.pt

Sirber
22nd September 2006, 03:57
I failed to use Pipes with Delphi, so I create a file.cmd which has the pipe in it, then call the .cmd. It works #1.

d2mp
22nd September 2006, 14:15
That seems interesting.
Can you please elaborate ?
How do you create a .CMD with the pipe in it ?


thank's again
d2mp

Sirber
22nd September 2006, 16:35
blabla.cmd:

bepipeexe yyy | enc.exe options -

you can get the code from RealAnime 5 if your thing is GPL ;)

d2mp
24th September 2006, 17:48
Thank you. It is a good sugestion, but not yet what i'm looking.
I need to dump the error log of ffmpeg and dvdauthor to a file.

But finally I found it !!!!!
So stupid, so easy, but found :confused:

So, if someone else need it, here goes the solution:
Of course that if I want to redirect output, i can use something like:

ffmpeg command line > log.txt

but since I want to dump errors, it is obvious that the above command will not put them in the log file, because errors are dumped in stderr (not stdout).
So I also need to redirect stderr to stout (2>&1).

The solution is:

ffmpeg command line >log.txt 2>&1


thank's.
(and I hope this servers to anyone else)

Regards
d2mp