Lossless compressed JPEG gstreamer element?
The pipeline below works fine for saving compressed JPEG images but is there a way to save lossless compressed JPEG images using gstreamer?
gst-launch v4l2src always-copy=false num-buffers=1 chain-ipipe=true ! 'video/x-raw-yuv,format=(fourcc)NV12, width=2176, height=1944' ! dmaiaccel ! dm365facedetect draw-square=true ! dmaienc_jpeg ! filesink location=$FILE_NAME
Assuming you have all the GStreamer plugins installed (good, bad, and ugly), you have an impressive number of lossless video compressors at your disposal via the FFmpeg GStreamer element. These include ffenc_png (for PNG encoding), ffenc_jpegls (lossless JPEG algorithm), and many less common ones.
However, if I'm reading your GStreamer command line correctly, you seem to be calling a series of custom components that are tied to a particular type of hardware (I have been Googling but I haven't quite nailed down what it is). The JPEG encoder component is 'dmaienc_jpeg'. It's possible that the element preceding it in the chain (dm365facedetect) only outputs data that dmaienc_jpeg can interpret. However, if it's a general colorspace, then you can send it through an FFmpeg lossless encoder, possibly with a colorspace conversion in between. The answer can be ascertained by invoking 'gst-inspect' on the elements and studying the output (the src and sink data types).
Update, pursuant to new data: Good news: that dm365facedetect element outputs raw YUV in an NV12 format. Very flexible, and you have a lot of options.
What platform are you on? If you are using Ubuntu Linux, install a bunch of GStreamer plugins using:
apt-get install gstreamer0.10-plugins-good
gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly gstreamer0.10-ffmpeg
Some lossless codec options: PNG, via either 'pngenc' or 'ffenc_png' (although this may technically incur a tiny bit of loss due to YUV -> RGB colorspace conversion), 'ffenc_huffyuv', 'ffenc_jpegls', or 'ffenc_ljpeg'. When you encode these, send them through the avimux component. So, an example amendment to the end of your command line:
... ! dm365facedetect draw-square=true ! ffenc_ljpeg !
avimux ! filesink location=$FILE_NAME
Expect the lossless codec data to be somewhat larger than the JPEG data you were getting before. Experiment with different codecs to see what you like, and make sure you can decode the data on the other side using your preferred toolchain (FFmpeg and VLC should always be able to handle it).
链接地址: http://www.djcxy.com/p/43934.html