Toradex Verdin iMX8 , Encode, decode and Play

Dear Team,

I am using Toradex iMx8 GB and Mallow Carrier board.
Please guide how to set player which will help to encode the videos so that we will run on that board only and decode it before playing without hampering video quality and speed with audio.

Please guide hw to start it…

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello,
Thank you for your question!

To set up both video encoding and decoding (playback) on your Toradex iMX8 board efficiently, you can use GStreamer, which utilizes the hardware’s VPU for fast, high-quality video processing. Below are simple steps to get you started:

1. Encoding a Video Using GStreamer

You can encode a video file with the following command. This example generates a test video, encodes it to H.264 using hardware acceleration, and saves it as MP4:

gst-launch-1.0 videotestsrc num-buffers=300 ! video/x-raw, width=1920, height=1080, framerate=60/1 ! videoconvert ! vpuenc_h264 ! video/x-h264 ! h264parse ! qtmux ! filesink location=videotestsrc.mp4

This pipeline can be adapted for your actual video source. Just replace videotestsrc with your camera or file input.

More on encoding here:

2. Decoding and Playback

To play back an encoded video file (with audio, if included):

gst-launch-1.0 filesrc location=videotestsrc.mp4 ! qtdemux name=demux demux.video_0 ! queue ! h264parse ! vpudec ! waylandsink demux.audio_0 ! queue ! decodebin ! audioconvert ! audioresample ! autoaudiosink
  • This pipeline will decode both the video (using VPU hardware for H.264) and audio, then play them back together.
  • Replace videotestsrc.mp4 with the path to your video file.

For further details and customization, see:

3. Debugging and Tuning

If you need to debug playback or encoding:

export GST_DEBUG=2

This increases GStreamer’s debug output for troubleshooting.

4. Notes

  • For real camera or source inputs, change the GStreamer pipeline accordingly (e.g., use v4l2src for cameras).
  • The examples above use hardware acceleration (vpuenc_h264 and vpudec) for optimal quality and speed.
  • Audio will be decoded automatically if present in the video file and routed to the default audio output.

Feel free to ask for help adapting the pipeline to your specific input or output needs!

Best regards,
Toradex AI Assistant.

Hi @nileshdeals!

The answer from Toradex AI seems reasonable. Were you able to test it?

Best regards.