i.MX 95 GStreamer Support: Example Pipelines
The NXP i.MX95 Technical Guide documentation from RidgeRun is presently being developed. |
Audio Only Playback
An audio-only playback pipeline looks like the one below. This pipeline reads an ID3 container with MP3 audio file, demux and decodes the audio to finally play it back in the default audio device.
gst-launch-1.0 filesrc location=file_example_MP3_1MG.mp3 ! id3demux ! mpegaudioparse ! mpg123audiodec ! queue ! autoaudiosink
NOTE: For Verdin i.M95 EVK if you want to use the headphones, verify the position of the S3 switch. Check Verdin Audio Switch section.
Video Only Playback
Video-only playback consists of taking a containerized video file and rendering it on the display.
H.264
This example playback an AVI file container with H.264 encoded video.
gst-launch-1.0 filesrc location=vid_only_h264.avi ! avidemux ! h264parse ! v4l2h264dec ! queue ! waylandsink
H.265
This example reproduces an MP4 file container with H.265 encoded video.
gst-launch-1.0 filesrc location=vid_only_h265.avi ! avidemux ! h265parse ! v4l2h265dec ! queue ! waylandsink
VPU Downscaling
This example uses VPU to downscale video from 1920x1080 to 720x480, downscaling takes place in the decoder.
Using fakesink:
gst-launch-1.0 filesrc location=video-only-h264.avi ! avidemux ! h264parse ! v4l2h264dec ! video/x-raw,width=720,height=480 ! v4l2h264enc ! h264parse ! waylandsink
Save downscaled version to playable file:
gst-launch-1.0 filesrc location=vid_only_AVI_1920_2_3MG.avi ! avidemux ! h264parse ! v4l2h264dec ! video/x-raw,width=720,height=480 ! v4l2h264enc ! h264parse ! mp4mux ! filesink location=downscaled_720x480.mp4
Audio/Video Playback X
An audio and video playback pipeline looks like the one below. This pipeline reads the MP4 file, demux it, extracting the audio and video stream, decode them and reproduce them on display and audio outputs
gst-launch-1.0 filesrc location=outro_h264_vid_aud.mp4 ! qtdemux name=demux \ demux.video_0 ! queue ! h264parse ! v4l2h264dec ! fakesink \ demux.audio_0 ! queue ! decodebin ! audioconvert ! audioresample ! autoaudiosink
Audio Recording
An audio-only recording pipeline looks like the one below. This pipeline records audio from a audiotestsrc encoded in MP3 format. You can change the encoder to any audio encoder available.
gst-launch-1.0 audiotestsrc ! lamemp3enc ! filesink location=output.mp3
NOTE: For Verdin i.M95 EVK if you want to use the headphones, verify the position of the S3 switch. Check Verdin Audio Switch section.
Video Recording
Video recording examples get a video test pattern, encode and containerize it and save it to a file. The encoder might be H.264 or H.265 as shown below.
H.264
gst-launch-1.0 videotestsrc is-live=true ! video/x-raw,width=1920,height=1080 ! queue ! v4l2h264enc ! h264parse ! queue ! qtmux ! filesink location=output.mp4 -e
H.265
gst-launch-1.0 videotestsrc is-live=true pattern=ball ! video/x-raw,width=1920,height=1080 ! queue ! v4l2h265enc ! h265parse ! queue ! matroskamux ! filesink location=output.mkv