On Tuesday 22 January 2008, Oliver Bandel wrote:
> Zitat von Torquil Macdonald Sørensen <[EMAIL PROTECTED]>:
> > 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() 
works with the JPG-driver. I had already tried using the STDOUT instead of an 
ordinary file in plplot, but it didn't work to use the data that plplot wrote 
to stdout as input to ffmpeg. From what I could understand it was not 
equivalent to "cat *.jpg | ffmpeg_command". I ended ut with only one frame in 
the ffmpeg-generated video.

But I have managed to find a workaround for now (it works but is a bit 
inefficient). I start and stop plplot between each plot page with plinit() 
and plend(). Between each plot I then send the newly created "file.jpg" into 
an ofstream that is really a FIFO-file "fifo.mjpeg" (which is equivalent to 
STDOUT, but nicer, I think). Then plplot overwrites "file.jpg" when I start 
it up again with plinit() and changes "file.jpg" to the next plot page, and 
the process goes on and on sending each newly created "file.jpg" into the 
pipe going to ffmpeg. I think the main point here is that the pipe is always 
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 way I 
am sure that the data going into my FIFO is equivalent to doing cat *.jpg > 
fifo.mjpeg. I have already gotten my ffmpeg-script to work with such input. 
The fifo.mjpeg must be created first, of course, using "mkfifo fifo.mjpeg". I 
will experiment some more trying do get the STDOUT from plplot to work 
directly with the STDIN on ffmpeg, with out using an additional ofstream in 
the c++ code.

But at least I have now reached my goal to create a video on the fly, without 
temporary image files, I I'm really happy about that :-)

I will post my example programs here later, in case somebody is interested in 
doing something similar.

Thanks to everone on the list that helped me with all of this!

Best regards,
Torquil Sørensen

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to