Re: How best to compress a yuv420p image to a common picture format?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi Joe,

On Tue, 2002-01-22 at 09:41, joe briggs wrote:
> Please forgive the broad mailing.  I am using a modified ffmpeg (I pulled in 
> motion detection stuff from the motion project, and insert text into the 
> image before compression) to read 30 fps from a v4l device (bt878) and render 
> to MPEG.  The chip is initialized in yuv420p format, which is what the mpeg 
> encoder wants to see so the real-time encoding process can keep up with the 
> frame rate (i.e., no conversions).  However, I need to periodically (once or 
> twice per second) create a snapshot and save it as a commonly recognizable 
> compressed file format such as jpeg.  I am trying hard to avoid the rather 
> expensive yuv->rgb conversions.  Can anyone recommend a compressed output 
> file format (such as jpeg) that most browsers can recognize & decode, and if 
> it is possible to create it from a yuv420p image (without the compressor 
> converting to rgb first)?  Thanks!

You can create JPEG from YUV. If you create JPEG from RGB, it will
convert to YUV internally ;-). You can basically use code from
gstreamer's jpegenc (http://www.sf.net/projects/gstreamer -> CVS ->
Browse CVS Repository -> gst-plugins/ -> ext/ -> jpeg/ -> gstjpegenc.c)
or mjpegtools' JPEG handling library (http://www.sf.net/projects/mjpeg
-> CVS -> Browse CVS Repository -> mjpeg_play/ -> lavtools/ ->
jpegutils.c). The second is probably a bit easier. Just either copypaste
the function or link to "`mjpegtools-config --cflags --libs` -llavjpeg"
and call encode_jpeg_raw(). encode_jpeg_raw() takes planar yuv-420
(YUV420P) as input and outputs a JPEG buffer.

Ronald

-- 
-   .-.
-   /V\    | Ronald Bultje <rbultje@xxxxxxxxxxxxxxxxxxx>
-  // \\   | Running: Linux 2.4.17-XFS and OpenBSD 3.0
- /(   )\  | http://ronald.bitfreak.net/
-  ^^-^^





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux