imageconvertersgstreamergst-launch

How to convert raw BGRA image to JPG using GStreamer 1.0?


I'm trying to display a raw image (1.8MB) with gst-launch-1.0. I understand that the data needs to be encoded to JPG before this can be achieve. If image was already stored as a jpg file the story would be quite simple:

gst-launch-1.0.exe -v filesrc location=output.jpg ! decodebin ! imagefreeze ! autovideosink

However, I need to assemble the pipeline to display a raw BGRA 800x600 image (looks the same as the above) that was dumped to the disk by a 3D application.

This is what I've done so far, but the problem is that it creates a completely black image on the disk:

gst-launch-1.0.exe -v filesrc location=dumped.bin ! video/x-raw,format=BGRA,width=800,height=600,framerate=1/1 ! videoconvert ! video/x-raw,format=RGB,framerate=1/1 ! jpegenc ! filesink location=out.jpg

Can GStreamer handle this task?


Solution

  • Solved! The 2 major issues I faced were:

    ā„

    gst-launch-1.0.exe -v filesrc location=dumped.bin blocksize=1920000 ! video/x-raw,format=BGRA,width=800,height=600,framerate=1/1 ! videoconvert ! video/x-raw,format=RGB,framerate=1/1 ! jpegenc ! filesink location=out.jpg
    

    On this specific case I also needed to flip the image vertically because it was captured from the OpenGL framebuffer of a 3D application:

    gst-launch-1.0.exe -v filesrc location=dumped.bin blocksize=1920000 ! video/x-raw,format=BGRA,width=800,height=600,framerate=1/1 ! videoconvert ! video/x-raw,format=RGB,framerate=1/1 ! videoflip method=vertical-flip ! jpegenc ! filesink location=out.jpg