This post is the second article of three about hardware accelerated video playback on the Wandboard. Todays topic is gstreamer basics and how gstreamer framework can be used from the linux command line.
The gstreamer framework is typically integrated in a movie player, and quite unnoticable for the user. Here, we will instead dive into the command line interface to gstreamer.
The main command is called gst-launch.
However that is not enough as such. One needs to give it arguments with:
– where to play from
– how to decode video / audio
– how to ‘display’ the result
The word display is in quotes, since gstreamer can read and send playback from several different sources. Here we will assume a video file is to be displayed on the screen.
An example command is:
% gst-launch filesrc location=movie.mp4 typefind=true \
! aiurdemux \
! vpudec \
The first argument to gst-launch is typically the video source. Typically the source is a media file, but it can be a network socket or just about anything. It is from where the videostream (encoded) is to be read. In the example command, the video is to be read from the file “movie.mp4”.
The sink is where to dump the decoded video, typically the screen, but can also be just about anything. Here the sink is mfw_v4lsink, which is to display it using the iMX6 Video4Linux output.
In between the source and the sink, a number of elements can be specified, acting as filters, converters etc. In the example command above, one important element is the vpudec one — that is the VPU video decoder element. More about that in part 3.
One issue one might encounter is incompatible colourspaces. The vpudec element outputs YUV format, while the framebuffer is in RGBA format. While imagesinks like ximagesink is able to convert YUV to RGBA, the conversion is very slow. The iMX6 has hardware support for colourspace conversion, and one element for colourspace conversion is the mfw_ipucsc element: gst-launch filesrc location=movie.mp4 typefind=true ! aiurdemux ! vpudec frame-plus=1 ! mfw_ipucsc ! videoscale ! ximagesink
To find out the input and output formats of elements, one can use the ‘gst-inspect’ command, i.e: gst-inspect vpudec
Talk back and discuss in the Wandboard community forums