Convert Image Format

Convert a PNG to a Raw Framebuffer

IN_FILE=...

OUT_FORMAT="BGR"

OUT_FILE="${IN_FILE%.*}.raw"

gst-launch-1.0 -v filesrc "location=${IN_FILE}" \
  ! decodebin \
  ! videoconvert \
  ! video/x-raw,format=${OUT_FORMAT},framerate=0/1 \
  ! filesink "location=${OUT_FILE}"

Convert a Raw Framebuffer Dump to a PNG

IN_FILE=...

IN_FORMAT="BGR"
IN_WIDTH="1920"
IN_HEIGHT="1080"

OUT_FILE="${IN_FILE%.*}.png"

gst-launch-1.0 -v filesrc "location=${IN_FILE}" blocksize=$(stat "${IN_FILE}" -c%s) \
    ! video/x-raw,format=${IN_FORMAT},width=${IN_WIDTH},height=${IN_HEIGHT},framerate=0/1 \
    ! autovideoconvert \
    ! pngenc \
    ! filesink "location=${OUT_FILE}"

Convert a series of Raw Framebuffers into a PNG Flipbook

IN_FILE=...

IN_FORMAT="BGR"
IN_WIDTH="1920"
IN_HEIGHT="1080"
IN_PIXEL_SIZE="3"

OUT_FILE="${IN_FILE%.*}_%d.png"

gst-launch-1.0 -v filesrc "location=${IN_FILE}" blocksize=$(( ${IN_WIDTH} * ${IN_HEIGHT} * ${IN_PIXEL_SIZE} )) \
  ! video/x-raw,format=${IN_FORMAT},width=${IN_WIDTH},height=${IN_HEIGHT},framerate=0/1 \
  ! autovideoconvert \
  ! pngenc \
  ! multifilesink location="${OUT_FILE}"