From: Torquil M. <to...@gm...> - 2008-01-22 10:22:52
|
On Tuesday 22 January 2008, Oliver Bandel wrote: > Zitat von Torquil Macdonald S=F8rensen <to...@gm...>: > > Hello, sorry to ask so many questions... I am trying to get plplot to > > rewrite > > the plot to the same file several times (part of my quest to write to > > a pipe > > into ffmpeg). In between plots (plbop().....pleop()) I delete the > > file > > [...] > > > When you give the outputfile the name "-" > plplot-lib will write to stdout!!! > > You can make your executable that writes > a stream to stdout and then redirect the output of > your file into the fifo! > > $ my-stream-generator > my_fifo > > > But at the other end of the fifo, > then you maybe have to cut the stream into seperated files... > ...depends on your reading process / program, if it can read > plplot-lib's output directly. Hello Oliver, thanks for your suggestion and explanation about how plbop()= =20 works with the JPG-driver. I had already tried using the STDOUT instead of = an=20 ordinary file in plplot, but it didn't work to use the data that plplot wro= te=20 to stdout as input to ffmpeg. From what I could understand it was not=20 equivalent to "cat *.jpg | ffmpeg_command". I ended ut with only one frame = in=20 the ffmpeg-generated video. But I have managed to find a workaround for now (it works but is a bit=20 inefficient). I start and stop plplot between each plot page with plinit()= =20 and plend(). Between each plot I then send the newly created "file.jpg" int= o=20 an ofstream that is really a FIFO-file "fifo.mjpeg" (which is equivalent to= =20 STDOUT, but nicer, I think). Then plplot overwrites "file.jpg" when I start= =20 it up again with plinit() and changes "file.jpg" to the next plot page, and= =20 the process goes on and on sending each newly created "file.jpg" into the=20 pipe going to ffmpeg. I think the main point here is that the pipe is alway= s=20 open until the program has ended, if I understand correctly. At the same time I have a ffmpeg skript reading from the FIFO-file. That wa= y I=20 am sure that the data going into my FIFO is equivalent to doing cat *.jpg >= =20 fifo.mjpeg. I have already gotten my ffmpeg-script to work with such input.= =20 The fifo.mjpeg must be created first, of course, using "mkfifo fifo.mjpeg".= I=20 will experiment some more trying do get the STDOUT from plplot to work=20 directly with the STDIN on ffmpeg, with out using an additional ofstream in= =20 the c++ code. But at least I have now reached my goal to create a video on the fly, witho= ut=20 temporary image files, I I'm really happy about that :-) I will post my example programs here later, in case somebody is interested = in=20 doing something similar. Thanks to everone on the list that helped me with all of this! Best regards, Torquil S=F8rensen |