Search code examples
audioembedded-linuxgstreamerhardware-accelerationmpeg

Gstreamer audio problem on embedded linux


I work on embedded linux. I want play video with minimum CPU. So after I completed compile, I tried play video with mplayer and gstreamer. Mplayer use CPU avarage %10-20. I want to obtain this perform on gstreamer. So I tried these command:

1- gst-launch filesrc location=video_path.mpeg ! mpegdemux ! mpeg2dec ! autovideosink

2-gst-launch-0.10 filesrc location=video_path.mpeg ! dvddemux ! mpegvideoparse ! mpeg2dec ! xvimagesink

These commands use avarage %10-20 CPU. This number that I want number. But audio did not work with these command. I tried added audio element but I could not achieve.

I also tried gst-launch-1.0 playbin uri=file:///video_path.mpeg. Audio work with this command but CPU usage is so high and I don2t prefer this.

How can I work audio with 1 or 2 commands?


Solution

  • 1- gst-launch filesrc location=video_path.mpeg ! mpegdemux ! mpeg2dec ! autovideosink

    2-gst-launch-0.10 filesrc location=video_path.mpeg ! dvddemux ! mpegvideoparse ! mpeg2dec ! xvimagesink

    With the above two pipelines you are asking gtreamer to just play video, as a result you aren’t getting any audio.

    gst-launch filesrc location=video_path.mpeg ! mpegdemux name=demuxer demuxer. ! queue ! mpeg2dec ! autovideosink demuxer. ! queue ! mad ! audioconvert ! audioresample ! autoaudiosink

    The above pipeline should play both audio and video.

    Note: If you have support for hardware decoding that would reduce further CPU usage.