logo       
Bookmark and Share

Pipe RGB in to ffmpeg?: msg#00041

video.ffmpeg.user

Subject: Pipe RGB in to ffmpeg?

Hello. I'm looking for a way to pipe uncompressed RGB image data in to ffmpeg. I apologize for the length of this, I didn't know what all information might be helpful so I've included a "brain dump".

Here is a bit of background: in my code I am building video frames, 720x480x24bit. I have in mind generating a large number of these, as long as a full DVD worth at 30fps, then using ffmpeg (followed by dvdauthor) to encode them in to MPEG2 for DVD usage. Some of my false starts:

* Write each frame image as a JPG file. I can get ffmpeg to accept this input, but the quality loss, CPU time to encode each as JPG, and the very large number of files, becomes problematic.

* Write each frame image as a PNG file. Mostly the same problems as above.

* Write them all as frames to an MJPEG AVI file. Again, ffmpeg is happy with this input, and it fixes the many-files problem, but the time to compress all those frames and JPG is enormous, and quality loss is still there.

* Write them all as frames in a DIB (raw) AVI file. ffmpeg is happy with this also; but as you can imagine the files size is enormous. Really, really enormous :-)

After all that, I figured out that what I need to do is to pipe the frames in to ffmpeg as I generate them; thus no disk storage of raw video, and no JPG compress/uncompress. Unfortunately, at this point I switch from being able to easily get ffmpeg to do what I want, to an unending search for different ffmpeg command lines. I've read hundreds of posts to this list; tried many many commands, and gotten nearly all of the same errors that others have reports in other posts :-) I am using code compiled from CVS sources as of today.

The closest I've found is the yuv4mpegpipe format; I can pipe such a file in to ffmpeg and get good results - so I know that piping in general works. Unfortunately the images I am building are in 24-bit (8 bits of R, G, and B) RGB format, not in YUV. I can readily write out the raw images in DIB/BMP, PPM, or other similar simple format. But I have not been able to find a way to get ffmpeg to accept a series of such images piped in on stdin; only to pull each image separate off the disk.

Here are some of the command lines I have tried for this; some experiments were with PNG files, some JPG, some PPM; none works. I apologize for including mostly the .jpg and .png variations here; I also tried many variations with PPM files.


cat ex*.png | ffmpeg -y -f image2pipe -img ppm -i - -target ntsc-dvd dvd.mpg

cat *.ppm | ffmpeg -y -f imagepipe -img ppm -i - -target ntsc-dvd dvd.mpg

cat ex*.png | ffmpeg -y -f image2pipe -vcodec mjpeg -i - -target ntsc-dvd dvd.mpg

cat ex*.png | ffmpeg -y -f imagepipe -vcodec mjpeg -i - -target ntsc-dvd dvd.mpg


cat *.png | ffmpeg -y -f image2pipe -i pipe:.png -target ntsc-dvd my.mpg

cat *.jpg | ffmpeg -y -f image2pipe -i pipe:.jpg -target ntsc-dvd my.mpg


I would greatly appreciate it if someone who understand these things could provide an actual correct command line to do this; or tell me if it is not possible, in which case I'll start looking for how to convert what I have to yuv2mpeg.

If any of those invocations is already correct, I will be happy to follow up with the full and specific ffmpeg output to show the error messages, to provide a full example (with a few sample files) etc.

A possible related problem is that in the "Image Formats" section of "ffmpeg -formats", I see only this:

Image formats (filename extensions, if any, follow):
DE gif gif

where I would expect to see other common image formats listed. This makes me wonder if I missed an important option or library when compiling. I saw a few previous posters asking about this with no reply though.

--
Kyle Cordes
http://kylecordes.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise