PNM, PNG, TIFF in Gstreamer

1. Gstreamer to PNM to Tiff

Gstreamer PNM Script

 /opt/gst-installed/bin/gst-launch-1.0 -e v4l2src num-buffers=8000 io-mode=1 blocksize=512 \
 ! video/x-raw, format=GRAY16_LE, width=640, height=512 , framerate=7/1 ! queue \
 ! videorate ! video/x-raw, framerate=1/1 ! pnmenc \
 ! multifilesink async=1 location=${RECORD_DIR}/tau2pipe_${TIMESUBFIX}/tau_%05d.pnm

Netpbm – Pnm to tiff

To manimulate pnm, install netpbm package

> sudo apt-get install netpbm

Then for itirating every pnm file in the folder and convert to tiff in a subfolder, using the command below:

> find . -name "tau_*.pnm" -print0 | while read -d $'\0' f; do pnmtotiff -lzw "$f" > ./outtiff/${f%.pnm}.tiff ; done

 

2. Gstreamer to PNG

Gstreamer PNG Script

 log sudo ionice -c 1 -n 0 nice -20 \
 /opt/gst-installed/bin/gst-launch-1.0 -e v4l2src num-buffers=8000 io-mode=1 blocksize=512 \
 ! video/x-raw, format=GRAY16_LE, width=640, height=512 , framerate=7/1 ! queue \
 ! videorate ! videoconvert! video/x-raw, format=GRAY16_BE, framerate=1/1 ! pngenc \
 ! multifilesink async=1 location=${RECORD_DIR}/tau2pipe_${TIMESUBFIX}/tau_%05d.png

 

3. Gstreamer to PNG and UDP

Gstreamer PNG & UDP Script

TODO

 

Gstreamer 1.10 Cross Compiling

This guide is intended for Raspberry Pi 3B.

0. The Motive

Gstreamer on the package list of Rasbian is 1.4.4 currently, and does not support GRAY16 for some reason. It works fine on Ubuntu based version where the packaged is updated to 1.10.0.

Therefore, building from source is required to support GRAY16 on Raspberry Pi.

1. Set Up Directories

Firstly we need gstreamer source codes, Raspbian root directories (can be simply copy paste) as well as gcc cross compile toolchains.

Continue reading