Command line examples
Clone this wiki locally
Table of Contents
Once the streaming media server has been built, running gstd is easy.
I you are on an embedded system that uses custom Linux drivers to access any hardware accelerators, you might need to load some driver modules and manually start D-Bus first.
loadmodules dbus-daemon --system
The GStreamer Daemon registers with the D-Bus Daemon and then patiently waits for a client to create and control a pipeline.
If you already have a GStreamer Daemon running, you will get the error:
Failed to obtain primary ownership of the service This usually means there is another instance of gstd already running
You can kill the streaming media server by issuing the command
If you want to monitor the d-bus messages being exchanged with GStreamer Daemon, run
GStreamer Daemon includes a gst-launch style client. The client can be used to invoke any of the methods supported by the streaming media server.
The command line streaming media client syntax is
gst-client [<flags>*] [<command> [<arguments>*]]
To see the options or flags available on gst-client, you could enter:
By the moment, it has three flags available:
-p, --by_path Pipeline path, for which command will be apply. Usage:-p <path> -s, --enable_signals Flag to enable the signals reception.
gst-client has two operation modes, everything on the command line, or interactive. When you want to control an existing pipeline using the command line (non-interactive), you need to use the option '-p' to specify in which pipeline you want to apply the command. The argument to the -p pipeline path argument is either the full path returned by the create command, e.g. /com/ridgerun/gstreamer/gstd/pipe0, or just the number at the end; zero in this case.
The '-s' is useful only in interactive console mode to monitor signals on the active pipeline.
To open the interactive console, you need to run gst-client without any parameters (but you can include flags).
To know which commands are available,execute:
The response will show a description of each command, as follows:
Request the syntax of an specific command with "help <command>". This is the list of supported commands: create: Creates a new pipeline and returns the dbus-path to access it destroy: Destroys the pipeline specified by_path(-p) or the active pipeline play: Sets the pipeline specified by_path(-p) or the active pipeline to play state ready: Sets the pipeline specified by_path(-p) or the active pipeline to ready state pause: Sets the pipeline specified by_path(-p) or the active pipeline to pause state null: Sets the pipeline specified by_path(-p) or active pipeline to null state aplay: Sets the pipeline to play state, it does not wait the change to be done aready: Sets the pipeline to ready state, it does not wait the change to be done apause: Sets the pipeline to pause state, it does not wait the change to be done anull: Sets the pipeline to null state, it does not wait the change to be done set: Sets an element's property value of the pipeline get: Gets an element's property value of the pipeline get-duration: Gets the pipeline duration time get-position: Gets the pipeline position sh: Execute a shell command using interactive console get-state: Get the state of a specific pipeline(-p flag) or the active pipeline list-pipes: Returns a list of all the dbus-path of the existing pipelines ping: Shows if gstd is alive active: Sets the active pipeline,if no <path> is passed:it returns the actual active pipeline seek: Moves current playing position to a new one skip: Skips a period, if period is positive: it moves forward, if negative: it moves backward speed: Changes playback rate: *rate>1.0: fast-forward playback, *rate<1.0: slow-forward playback, *rate=1.0: normal speed. When rate is negative: it enables fast|slow-reverse playback exit: Exit active console quit: Quit active console
You can ask for syntax help for a specific command, using:
gst-client help <command>
gst-client help set Command: set Description: Sets an element's property value of the pipeline(option -p needed) Syntax: -p <path> set <element_name> <property_name> <data_type> <value>
Where the supported <data_type>s include: boolean, integer, int64, and string.
Creating a pipeline leaves the GStreamer bus in the NULL state. The pipeline needs to be in the PLAYING state before anything happens.
gst-client create <gst-launch style pipeline>
gst-client --session create "videotestsrc ! warptv ! ffmpegcolorspace ! ximagesink"
gst-client --session create "audiotestsrc wave=8 ! audioecho delay=1000000 intensity = 0.2 feedback=1 ! audioconvert ! alsasink"
The response will be
Pipeline path created: /com/ridgerun/gstreamer/gstd/pipe0
Now, the pipeline you have just created, is a dbus-object, and its path is the one specified. You will need the path to manipulate a particular pipeline. You can create up to 20 pipelines.
When you create a pipeline, it is in the NULL state. To start the pipeline you need to set it to the PLAY. This is true for pipelines that record as well.
gst-client -p <path> play
gst-client -p <path_number> play
gst-client --session -p /com/ridgerun/gstreamer/gstd/pipe0 play
or, more simply
gst-client --session -p 0 play
Start GStreamer Daemon on the D-Bus session bus:
gstd --session &
Verify GStreamer Daemon is alive:
gst-client --session ping
You should get a pong response.
Create a pipline to play audio. Note that the mad decoder doesn't support trickplay, so ffdec_mp3 is used instead.
gst-client --session create "filesrc name=fsrc location=/opt/media/bbb.mp3 ! mp3parse ! ffdec_mp3 ! pulsesink"
Play and pause the pipeline a few times:
gst-client --session -p 0 play gst-client --session -p 0 pause gst-client --session -p 0 play
Jump around in the audio file:
gst-client --session -p 0 skip 1000 # time in ms gst-client --session -p 0 seek 0 # go to start of video
Adjust playback speed
gst-client --session -p 0 speed 1.5 # fast forward gst-client --session -p 0 speed 0.5 # slow motion gst-client --session -p 0 speed 1 # normal
Change which file is being played using the existing pipeline
gst-client --session -p 0 ready gst-client --session -p 0 set fsrc location string /opt/media/davincieffect.mp3 gst-client --session -p 0 play
Destroy the pipeline
gst-client --session -p 0 destroy
The gstd streaming media server daemon is not running.
Miss to run dbus-daemon --system
dbus-1.xx needs to be recompiled and installed