This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM4378: video file playing with gstreamer

Part Number: AM4378

Hi,

I have ported linux kerenl on custom AM437x board based on AM437x-gp-evm.

I am trying to play a video using GStreamer. I tested it with a sample video from the SDK filesystem.

When I run: 'gst-launch-1.0 playbin uri=file:///usr/share/ti/video/TearOfSteel-AV-Short-720x406.mp4', it seems to play on Wayland, and the playback is smooth.

However, I want to play it without Wayland, so when I run: 'gst-launch-1.0 filesrc location=/usr/share/ti/video/TearOfSteel-AV-Short-720x406.mp4 ! decodebin ! kmssink ', the following log is printed.

Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstKMSSink:kmssink0: Could not open DRM module (NULL)
Additional debug info:
../gst-plugins-bad-1.20.7/sys/kms/gstkmssink.c(850): gst_kms_sink_start (): /GstPipeline:pipeline0/GstKMSSink:kmssink0:
reason: No such file or directory (2)
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPipeline:pipeline0/GstKMSSink:kmssink0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
../gstreamer-1.20.7/libs/gst/base/gstbasesink.c(5878): gst_base_sink_change_state (): /GstPipeline:pipeline0/GstKMSSink:kmssink0:
Failed to start
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...


Is this issue related to Wayland?

  • Hi,

    Can you do a gst-inspect on your target board to see if kmssink is present?

    Also, if not you may have to download the gst-plugins-bad so kmssink is available.

    Best Regards

    Suren

  • Hi,

    When I enter the 'gst-inspect-1.0', below log is printed.

    accurip:  accurip: AccurateRip(TM) CRC element
    adder:  adder: Adder
    adpcmdec:  adpcmdec: ADPCM decoder
    adpcmenc:  adpcmenc: ADPCM encoder
    aes:  aesdec: aesdec
    aes:  aesenc: aesenc
    aiff:  aiffmux: AIFF audio muxer
    aiff:  aiffparse: AIFF audio demuxer
    alaw:  alawdec: A Law audio decoder
    alaw:  alawenc: A Law audio encoder
    alpha:  alpha: Alpha filter
    alphacolor:  alphacolor: Alpha color filter
    alsa:  alsadeviceprovider (GstDeviceProviderFactory)
    alsa:  alsamidisrc: AlsaMidi Source
    alsa:  alsasink: Audio sink (ALSA)
    alsa:  alsasrc: Audio source (ALSA)
    apetag:  apedemux: APE tag demuxer
    app:  appsink: AppSink
    app:  appsrc: AppSrc
    asfmux:  asfmux: ASF muxer
    asfmux:  asfparse: ASF parser
    asfmux:  rtpasfpay: RTP ASF payloader
    audiobuffersplit:  audiobuffersplit: Audio Buffer Split
    audioconvert:  audioconvert: Audio converter
    audiofx:  audioamplify: Audio amplifier
    audiofx:  audiochebband: Band pass & band reject filter
    audiofx:  audiocheblimit: Low pass & high pass filter
    audiofx:  audiodynamic: Dynamic range controller
    audiofx:  audioecho: Audio echo
    audiofx:  audiofirfilter: Audio FIR filter
    audiofx:  audioiirfilter: Audio IIR filter
    audiofx:  audioinvert: Audio inversion
    audiofx:  audiokaraoke: AudioKaraoke
    audiofx:  audiopanorama: Stereo positioning
    audiofx:  audiowsincband: Band pass & band reject filter
    audiofx:  audiowsinclimit: Low pass & high pass filter
    audiofx:  scaletempo: Scaletempo
    audiofx:  stereo: Stereo effect
    :
    alsa:  alsasrc: Audio source (ALSA)
    apetag:  apedemux: APE tag demuxer
    app:  appsink: AppSink
    app:  appsrc: AppSrc
    asfmux:  asfmux: ASF muxer
    asfmux:  asfparse: ASF parser
    asfmux:  rtpasfpay: RTP ASF payloader
    audiobuffersplit:  audiobuffersplit: Audio Buffer Split
    audioconvert:  audioconvert: Audio converter
    audiofx:  audioamplify: Audio amplifier
    audiofx:  audiochebband: Band pass & band reject filter
    audiofx:  audiocheblimit: Low pass & high pass filter
    audiofx:  audiodynamic: Dynamic range controller
    audiofx:  audioecho: Audio echo
    audiofx:  audiofirfilter: Audio FIR filter
    audiofx:  audioiirfilter: Audio IIR filter
    audiofx:  audioinvert: Audio inversion
    audiofx:  audiokaraoke: AudioKaraoke
    audiofx:  audiopanorama: Stereo positioning
    audiofx:  audiowsincband: Band pass & band reject filter
    audiofx:  audiowsinclimit: Low pass & high pass filter
    audiofx:  scaletempo: Scaletempo
    audiofx:  stereo: Stereo effect
    

    I think gst-inspection is already installed.

  • Hi Kim,

    Wanted to know if kmssink shows up when you run gst-inspect.

    If not, you would need to include gstreamer-bad-plugins in your default sdk image to see it. 

    Best Regards

    Suren

  • Hi,

    What you mentioned was already installed.

    When I ran: 

    gst-launch-1.0 filesrc location=/usr/share/ti/video/TearOfSteel-AV-Short-720x406.mp4 ! decodebin ! videoconvert ! kmssink driver-name=omapdrm connector-id=52 plane-id=32

    the problem was sloved.

    I have additional question.

    I am trying to play a video in Qt. 

    When I run: gst-launch-1.0 playbin uri=file:///usr/share/ti/video/TearOfSteel-AV-Short-720x406.mp4, the video plays most smoothly.

    What is the best way to play it in Qt? I run the Qt application on eglfs platform. Please recmmend.

  • Hi Kim,

    Glad you were able to get it working with kmssink.

    For using QT, have you looked at QMediaplayer and QVideowidget class for implementation and validation.

    Simple sample  QT 6 approach would be something like below:

    #include <QApplication>
    #include <QMediaPlayer>
    #include <QVideoWidget>
    #include <QAudioOutput>
    
    int main(int argc, char *argv[]) {
        QApplication app(argc, argv);
        
        QVideoWidget *videoWidget = new QVideoWidget;
        QMediaPlayer *player = new QMediaPlayer;
        QAudioOutput *audioOutput = new QAudioOutput;
        
        player->setVideoOutput(videoWidget);
        player->setAudioOutput(audioOutput);
        player->setSource(QUrl::fromLocalFile("/path/to/video.mp4"));
        
        videoWidget->resize(800, 600);
        videoWidget->show();
        player->play();
        
        return app.exec();
    }

    Please refer: https://doc.qt.io/qt-6/qvideowidget.html for more information.

    Best Regards

    Suren