GStreamer i.MX6 Encoding

Audio, from a filegst-launch filesrc location=test.wav ! wavparse ! mfw_mp3encoder ! filesink location=output.mp3
Audio Recording

gst-launch alsasrc num-buffers=$NUMBER blocksize=$SIZE ! mfw_mp3encoder ! filesink

location=output.mp3

# where

#     duration = $NUMBER*$SIZE*8 / (samplerate *channel *bitwidth)

# Example: 60 seconds recording

#

gst-launch alsasrc num-buffers=240 blocksize=44100 ! mfw_mp3encoder ! filesink location=output.mp3

#

# To verify that is correct, do a normal audio playback

gst-launch filesrc location=output.mp3 typefind=true ! beepdec ! audioconvert ! 'audio/x-raw-int,channels=2' ! alsasink

Video, from a test sourcegst-launch videotestsrc ! queue ! vpuenc ! matroskamux ! filesink location=./test.avi
Video, from a file

gst-launch filesrc location=sample.yuv blocksize=$BLOCK_SIZE ! 'video/x-raw-yuv,format=(fourcc)I420, width=$WIDTH, height=$HEIGHT, framerate=(fraction)30/1' ! vpuenc codec=$CODEC ! matroskamux ! filesink location=output.mkv sync=false

# where

#     BLOCK_SIZE = WIDTH * HEIGHT * 1.5

#     CODEC = 0(MPEG4), 5(H263), 6(H264) or 12(MJPG).

#

# For example, encoding a CIF raw file

gst-launch filesrc location=sample.yuv blocksize=152064 ! 'video/x-raw-yuv,format=(fourcc)I420, width=352, height=288, framerate=(fraction)30/1' ! vpuenc codec=0 ! matroskamux ! filesink location=sample.mkv sync=false

Video, from Web camera

# when the web cam is connected, the device node /dev/video0 should be present. In order to test the camera, without encoding

gst-launch v4l2src ! mfw_v4lsink

# in recording, run:

#
gst-launch v4l2src num-buffers=-1 ! queue max-size-buffers=2 ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false

#

# where sync=false indicates filesink to to use a clock sync

#

# In case a specific width/height is needed, just add the filter caps

gst-launch v4l2src num-buffers=-1  ! 'video/x-raw-yuv,format=(fourcc)I420, width=352, height=288, framerate=(fraction)30/1' ! queue ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false

#

# In case you want to see in the screen what the camera is capturing, add a tee element

#

gst-launch v4l2src num-buffers=-1 ! tee name=t ! queue ! mfw_v4lsink t. ! queue ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false

Video, from Parallel/MIPI camera

# The camera driver needs to be loaded before executing the pipeline, refer to the BSP document to see which driver to load

# MIPI (J5 port):

modprobe ov5640_camera_mipi

modprobe mxc_v4l2_capture


# Parallel (J9 port):

modprobe ov5642_camera

modprobe mxc_v4l2_capture


gst-launch mfw_v4lsrc ! queue ! vpuenc codec=0 ! matroskamux ! filesink location=output.mkv sync=false


# Do a 'gst-inspect mfw_v4lsrc' or 'gst-inspect vpuenc' to see other possible settings (resolution, fps, codec, etc.)