File Playback

Multimedia User Guide (UG1449)

Document ID
UG1449
Release Date
2022-04-21
Revision
1.4 English

Use the following static pipelines to perform local file playback using Gstreamer-1.0.

  • Static pipelines for file playback using Gstreamer-1.0
    • To play a Transport Stream (TS) file with only the video stream:
      gst-launch-1.0 filesrc location=/media/card/abc.ts ! tsdemux ! \
      queue ! h265parse ! omxh265dec ! kmssink bus-id=a0070000.v_mix

      In this example, the file is present in the SD card, the container format is TS, and the encoded video format is H265.

    • To play a TS file with both the video and audio streams:
      gst-launch-1.0 filesrc location=/media/card/abc.ts ! \
      tsdemux name=demux ! queue ! h265parse ! omxh265dec ! queue max-size-bytes=0 ! \
      kmssink bus-id=a0070000.v_mix sync=true demux. ! queue ! faad ! audioconvert ! \
      audio/x-raw, rate=48000, channels=2, format=S24_32LE ! alsasink device=hw:2,0

      In this example, the file is present in the SD Card, the container format is TS, and the encoded video format is H265. The encoded audio stream is AAC, with a sample rate of 48000 (48kHz) and audio format of S24_32LE. Audio playback device is hw:2,0.

  • Dynamic pipeline for file playback using Gstreamer-1.0

    GStreamer also provides uridecodebin, a basic media-playback plugin that automatically takes care of most playback details. The following example shows how to play any file if the necessary demuxing and decoding plugins are installed.

    • To play a TS file containing only the video stream:
      gst-launch-1.0 uridecodebinuri=file:///media/card/abc.ts ! \
      queue ! kmssink bus-id=a0070000.v_mix

      This example shows that the file is present in the SD Card.

  • To play a TS file containing both the video and the audio streams:
    gst-launch-1.0 uridecodebinuri="file:///media/card/test.ts" name=decode ! \
    queue max-size-bytes=0 ! kmssink bus-id="a0070000.v_mix" decode. ! \
    audioconvert ! audioresample ! audio/x-raw, rate=48000, channels=2, format=S24_32LE ! \
    queue ! alsasink device="hw:2,0"