GStreamer Troubleshooting

This topic lists the issues you might encounter when using GStreamer and provides the workaround to address the issues.
Issue Description Workaround
Fail to play some sources Some sources cannot be played, the system log is lagging, and the progress is not printed or the progress is always 0. Try to use the playbin3 plug-in. For example:
gst-play-1.0 --flags=3 --use-playbin3 test.mp4
No audio output Some sources can be played with display only, no sound output. Try to specify the audiosink manually. For example:
 gst-play-1.0 --flags=3 test.mp4 --audiosink="alsasink device=hw:0,0"
It is recommended to make sure the video can be played properly using basic testing tools such as aplay and then use GStreamer to debug.
Fail to play via SSH In the Debian Operating System (OS), playing some audio or video sources may fail via SSH but succeed on the UART terminal.

After log in through the SSH terminal each time, you can try to check if the DISPLAY environment variable is properly configured to specify the display device.

For example:
export DISPLAY=:0
gst-play-1.01080p_h264_aac.mp4
Play performance issue The audio or the video files are played slowly or even suspended. It may be because video or audio play is slower than decoding. Always use the queue plug-in before alsasink and kmssink. For example:
gst-launch-1.0 -v filesrc location=640_360_h264_aac.mkv ! matroskademux name=demux demux.audio_0 ! aacparse ! avdec_aac ! audioconvert ! audioresample ! queue ! alsasink device=hw:0,1 demux.video_0 ! queue ! h264parse ! omxh264dec ! videoconvert ! videoscale ! video/x-raw,width=800,height=480,format=NV12 ! queue ! kmssink driver-name=starfive force-modesetting=1 plane-id=74 connector-id=118
Invalid MP4 The system produces corrupted MP4 files when the process is terminated via Ctrl+C.

Force termination via Ctrl+C interrupts the MP4 finalization routine.

Do not terminate the pipeline with Ctrl+C.

If you generate MP4 files using audiotestsrc or videotestsrc, set the num-buffers property. For example:
gst-launch-1.0 filesrc location=480P.yuv ! rawvideoparse width=640 height=480 format=nv12 ! queue ! omxh265enc ! h265parse ! mux. audiotestsrc num-buffers=440 ! audioconvert ! avenc_aac ! queue ! mux. qtmux name=mux ! filesink location=test.mp4
Play fails at the start Play fails and the player freezes at the first frame of the video. Perform the following to debug:
  1. Make sure the correct plug-in is used.
  2. Play with the decodebin or the uridecodebin plug-in. They can always find the correct plug-ins and create pipelines automatically. For example:
    gst-launch-1.0 filesrc location=4K_h265_hevc_30FPS.mkv ! decodebin ! kmssink driver-name=starfive force-modesetting=1
    
    gst-launch-1.0 uridecodebin uri=file:///media/root/4K_h265_hevc_30FPS.mkv ! kmssink driver-name=starfive force-modesetting=1