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
Selon Kyle Cordes <kyle at kylecordes.com>:
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.
Hello, I don't know about the rest of your problem, but, with my ffmpeg 0.4.8 (I think I compiled with all default configure option), with ffmpeg -formats, I get following formats as Image formats : Output image formats: pbm pgm ppm pam pgmyuv yuv png jpeg gif Input image formats: pnm pam pgmyuv yuv png jpeg gif
othellogrenoble at free.fr wrote:
Image formats (filename extensions, if any, follow): DE gif gif
I don't know about the rest of your problem, but, with my ffmpeg 0.4.8 (I think I compiled with all default configure option), with ffmpeg -formats, I get following formats as Image formats :
Should I track down such a version and use it? The ffmpeg web pages seem to pretty clearly insist the the current CVS is the code to use... there are no releases on the SF page, and this text seems unambiguous: "Never ask for help or report bugs if you are using a formal release instead of CVS." :-) Of course this image format thing may be unrelated to my original problem. -- Kyle Cordes http://kylecordes.com
Quoting Kyle Cordes <kyle at kylecordes.com>:
othellogrenoble at free.fr wrote:
Image formats (filename extensions, if any, follow): DE gif gif
I don't know about the rest of your problem, but, with my ffmpeg 0.4.8 (I think I compiled with all default configure option), with ffmpeg -formats, I get following formats as Image formats :
Should I track down such a version and use it?
Well, it was easy to find, it is the "most recent official release"... If you need to use recent codec and such, you definitely should use up-to-date CVS version, but otherwise an older version might be good enough (or better). If I stick to this version, it is because I have a "can not find video grab device" problem with CVS-versions... The ffmpeg web pages
seem to pretty clearly insist the the current CVS is the code to use... there are no releases on the SF page,
There used to be. Probably it is due to the "set up of new project server". and this text seems unambiguous:
"Never ask for help or report bugs if you are using a formal release instead of CVS." :-)
Of course this image format thing may be unrelated to my original problem.
-- Kyle Cordes http://kylecordes.com
_______________________________________________ ffmpeg-user mailing list ffmpeg-user at mplayerhq.hu http://mplayerhq.hu/mailman/listinfo/ffmpeg-user
participants (2)
-
kyle@kylecordes.com -
othellogrenoble@free.fr