Last edited 6 months ago

Gst-play: Difference between revisions

Registered User
Registered User
Tag: 2017 source edit
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{ApplicableFor
<noinclude>
|MPUs list=STM32MP13x, STM32MP15x
{{ApplicableFor
|MPUs checklist=STM32MP13x,STM32MP15x
|MPUs list=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x
}}</noinclude>
|MPUs checklist=STM32MP13x, STM32MP15x, STM32MP21x, STM32MP23x, STM32MP25x
}}
</noinclude>
== Overview ==
== Overview ==
{{highlight|'''gst-play'''}} (gst-play-1.0) is a GStreamer command line utility available with GStreamer-1.X.
{{highlight|'''gst-play'''}} (gst-play-1.0) is a GStreamer command line utility available with GStreamer-1.X.
Line 10: Line 12:
== Usage ==
== Usage ==
gst-play accepts the following options:
gst-play accepts the following options:
  {{Board$}} gst-play-1.0 --help
  {{Board$}}gst-play-1.0 {{Highlight|--help}}
<pre>
<syntaxhighlight lang="shell-session">
Usage:
Usage:
   gst-play-1.0 [OPTION?] FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...
   gst-play-1.0 [OPTION?] FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...
Line 27: Line 29:
   --audiosink                      Audio sink to use (default is autoaudiosink)
   --audiosink                      Audio sink to use (default is autoaudiosink)
   --gapless                        Enable gapless playback
   --gapless                        Enable gapless playback
  --instant-uri                    Enable instantaneous uri changes (only with playbin3)
   --shuffle                        Shuffle playlist
   --shuffle                        Shuffle playlist
   --no-interactive                  Disable interactive control via the keyboard
   --no-interactive                  Disable interactive control via the keyboard
   --volume                          Volume
   --volume                          Volume
  -s, --start-position              Start position in seconds.
  -a, --accurate-seeks              Enable accurate seeking
   --playlist                        Playlist file containing input media files
   --playlist                        Playlist file containing input media files
  -i, --instant-rate-changes        Use the experimental instant-rate-change flag when changing rate
   -q, --quiet                      Do not print any output (apart from errors)
   -q, --quiet                      Do not print any output (apart from errors)
</pre>
  --use-playbin3                    Use playbin3 pipeline (default varies depending on 'USE_PLAYBIN' env variable)
  --wait-on-eos                    Keep showing the last frame on EOS until quit or playlist change command (gapless is ignored)
  --no-position                    Do not print current position of pipeline


The user can control the playback through the host terminal keyboard. Press {{highlight|'''k'''}} to list the available keyboard shortcuts once the content is playing:
</syntaxhighlight>
<pre>
      <space>   Pause/Resume playback


      <up/down arrows>
              Volume up/down


      <left/right arrows>
              Seek back/forward


      +/-     Increase/decrease playback rate
The user can control the playback through the host terminal keyboard. Press {{highlight|'''k'''}} to list the available keyboard shortcuts once the content is playing:
{{Board$}}gst-play-1.0  /usr/local/demo/media/* # then press {{highlight|'''k'''}} while playing to enter into '''Interactive mode'''
<syntaxhighlight lang="shell-session">
Interactive mode - keyboard controls:


       d       Reverse playback direction
        space    : pause/unpause
        q or ESC : quit
        > or n  : play next
        < or b  : play previous
        ?       : seek forward
        ?        : seek backward
        ?        : volume up
        ?        : volume down
        m        : toggle audio mute on/off
        +        : increase playback rate
        -        : decrease playback rate
        d       : change playback direction
        t        : enable/disable trick modes
        A/a      : change to previous/next audio track
        V/v      : change to previous/next video track
        S/s      : change to previous/next subtitle track
        0        : seek to beginning
        k        : show keyboard shortcuts


      t      Cycle through trick modes
</syntaxhighlight>


      a      Switch audio track
Please read [http://manpages.ubuntu.com/manpages/latest/man1/gst-play-1.0.1.html gst-play Ubuntu manual] for more details.


      s      Switch subtitle track
{{WestonLaunch|gst-play-1.0 --help}}
 
      v      Switch video track
 
      >      Skip to next item in playlist
 
      <      Go back to previous item in playlist
 
      q, ESC  Quit
</pre>
Information provided by [http://manpages.ubuntu.com/manpages/latest/man1/gst-play-1.0.1.html gst-play Ubuntu manual]
 
{{Warning | If Weston is configured with a "weston" user instead of a "root" user, please use the following commands:
{{Board$}} su -l "weston" -c "your_weston_command"
{{Board$}} su -l "weston" -c "gst-play-1.0 ..."
{{Board$}} su -l "weston" -c "pacmd ..."
}}


== Examples ==
== Examples ==
Line 78: Line 84:


=== Basic audio/video playback ===
=== Basic audio/video playback ===
  {{Board$}} gst-play-1.0 {{av_ref_file}}
  {{Board$}}gst-play-1.0 {{av_ref_file}}


=== Video only playback ===
=== Video only playback ===
  {{Board$}} gst-play-1.0 {{av_ref_file}} --audiosink=fakesink
  {{Board$}}gst-play-1.0 {{av_ref_file}} --audiosink=fakesink
Audio rendering is disabled, but audio decoding continues.
Audio rendering is disabled, but audio decoding continues.


=== Playlist playback ===
=== Playlist playback ===
  {{Board$}} gst-play-1.0 {{av_ref_file}} {{av_ref_file}} {{av_ref_file}} {{av_ref_file}}
  {{Board$}}gst-play-1.0 {{av_ref_file}} {{av_ref_file}} {{av_ref_file}} {{av_ref_file}}
Press {{highlight|'''">" key'''}} to play the next file, {{highlight|'''"<" key'''}} to play the previous one.
Press {{highlight|'''">" key'''}} to play the next file, {{highlight|'''"<" key'''}} to play the previous one.


Line 91: Line 97:
This option is not currently available within gst-play but here are some alternatives:
This option is not currently available within gst-play but here are some alternatives:
* Playlist with the same video over and over. In the example below, the same video file is played 3 times. The video file can be added as many times as needed:
* Playlist with the same video over and over. In the example below, the same video file is played 3 times. The video file can be added as many times as needed:
  {{Board$}} gst-play-1.0 {{av_ref_file}} {{av_ref_file}}  {{av_ref_file}}
  {{Board$}}gst-play-1.0 {{av_ref_file}} {{av_ref_file}}  {{av_ref_file}}
* For loop (here 1000 times):
* For loop (here 1000 times):
  {{Board$}} for i in `seq 1 1000`;do gst-play-1.0 {{av_ref_file}}; done
  {{Board$}}for i in `seq 1 1000`;do gst-play-1.0 {{av_ref_file}}; done


=== Seek while playing ===
=== Seek while playing ===
  {{Board$}} gst-play-1.0 {{av_ref_file}} {{av_ref_file}} {{av_ref_file}} {{av_ref_file}}
  {{Board$}}gst-play-1.0 {{av_ref_file}} {{av_ref_file}} {{av_ref_file}} {{av_ref_file}}
Press {{highlight|'''"right arrow key"'''}} to seek forward, {{highlight|'''"left arrow key"'''}} to seek backward.
Press {{highlight|'''"right arrow key"'''}} to seek forward, {{highlight|'''"left arrow key"'''}} to seek backward.


=== Change playback speed ===
=== Change playback speed ===
  {{Board$}} gst-play-1.0 {{av_ref_file}}
  {{Board$}}gst-play-1.0 {{av_ref_file}}
Press {{highlight|'''"+" key'''}} to increase rate and {{highlight|'''"-" key'''}} to decreased it.
Press {{highlight|'''"+" key'''}} to increase rate and {{highlight|'''"-" key'''}} to decreased it.


Line 110: Line 116:
{{InternalInfo|
{{InternalInfo|
When connected on ST internal network, http requests must be redirected to appgw.gnb.st.com ST proxy using command:
When connected on ST internal network, http requests must be redirected to appgw.gnb.st.com ST proxy using command:
  {{Board$}} export http_proxy{{=}}<nowiki>http://</nowiki><login>:<pwd>@10.129.92.5:8080
  {{Board$}}export http_proxy{{=}}<nowiki>http://</nowiki><login>:<pwd>@10.129.92.5:8080
See [[How to avoid proxy issues]] article for more details.
See [[How to avoid proxy issues]] article for more details.


Line 116: Line 122:
}}
}}


  {{Board$}} gst-play-1.0 {{av_ref_http}}
  {{Board$}}gst-play-1.0 {{av_ref_http}}




Line 124: Line 130:


Switch audio output on HDMI:
Switch audio output on HDMI:
  {{Board$}} pacmd set-card-profile 0 output:hdmi-stereo
  {{Board$}}pacmd set-card-profile 0 output:hdmi-stereo


Than play the video:
Than play the video:
  {{Board$}} gst-play-1.0 {{av_ref_file}}
  {{Board$}}gst-play-1.0 {{av_ref_file}}


=== Audio/video playback in background ===
=== Audio/video playback in background ===
Option {{highlight|'''--no-interactive'''}} must be set in order to be able to play in background:
Option {{highlight|'''--no-interactive'''}} must be set in order to be able to play in background:
  {{Board$}} gst-play-1.0 {{av_ref_file}} {{highlight|'''--no-interactive'''}} &
  {{Board$}}gst-play-1.0 {{av_ref_file}} {{highlight|'''--no-interactive'''}} &
  [1] 14998
  [1] 14998
  root@stm32mp1:~# Now playing /av_h264_main_640x480_30fps_1000kbps_aac-lc_192kbps.mp4
  root@stm32mp1:~# Now playing /av_h264_main_640x480_30fps_1000kbps_aac-lc_192kbps.mp4


Then to stop playback:
Then to stop playback:
  {{Board$}} killall gst-play-1.0
  {{Board$}}killall gst-play-1.0


or  
or  
  {{Board$}} fg
  {{Board$}}fg
  <CTRL+C>
  <CTRL+C>



Latest revision as of 17:34, 24 October 2024

Applicable for STM32MP13x lines, STM32MP15x lines, Unknown MPU, Unknown MPU, Unknown MPU

1. Overview[edit | edit source]

gst-play (gst-play-1.0) is a GStreamer command line utility available with GStreamer-1.X.

This utility plays multimedia content using the Playbin element as a basic player. It takes as an input either individual files, URLs or a whole directories (in this case it will recurse into sub-directories as well).

2. Usage[edit | edit source]

gst-play accepts the following options:

gst-play-1.0 --help
Usage:
  gst-play-1.0 [OPTION?] FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...

Help Options:
  -h, --help                        Show help options
  --help-all                        Show all help options
  --help-gst                        Show GStreamer Options

Application Options:
  -v, --verbose                     Output status information and property notifications
  --flags                           Control playback behaviour setting playbin 'flags' property
  --version                         Print version information and exit
  --videosink                       Video sink to use (default is autovideosink)
  --audiosink                       Audio sink to use (default is autoaudiosink)
  --gapless                         Enable gapless playback
  --instant-uri                     Enable instantaneous uri changes (only with playbin3)
  --shuffle                         Shuffle playlist
  --no-interactive                  Disable interactive control via the keyboard
  --volume                          Volume
  -s, --start-position              Start position in seconds.
  -a, --accurate-seeks              Enable accurate seeking
  --playlist                        Playlist file containing input media files
  -i, --instant-rate-changes        Use the experimental instant-rate-change flag when changing rate
  -q, --quiet                       Do not print any output (apart from errors)
  --use-playbin3                    Use playbin3 pipeline (default varies depending on 'USE_PLAYBIN' env variable)
  --wait-on-eos                     Keep showing the last frame on EOS until quit or playlist change command (gapless is ignored)
  --no-position                     Do not print current position of pipeline


The user can control the playback through the host terminal keyboard. Press k to list the available keyboard shortcuts once the content is playing:

gst-play-1.0  /usr/local/demo/media/* # then press k while playing to enter into Interactive mode
Interactive mode - keyboard controls:

        space    : pause/unpause
        q or ESC : quit
        > or n   : play next
        < or b   : play previous
        ?        : seek forward
        ?        : seek backward
        ?        : volume up
        ?        : volume down
        m        : toggle audio mute on/off
        +        : increase playback rate
        -        : decrease playback rate
        d        : change playback direction
        t        : enable/disable trick modes
        A/a      : change to previous/next audio track
        V/v      : change to previous/next video track
        S/s      : change to previous/next subtitle track
        0        : seek to beginning
        k        : show keyboard shortcuts

Please read gst-play Ubuntu manual for more details.


3. Examples[edit | edit source]

Info white.png Information
Don't have /usr/local/demo/media/ST2297_visionv3.webm ? Follow instructions in this article.
Info white.png Information
To hear audio track, depending on the considered board, an audio headset must be plugged on

3.1. Basic audio/video playback[edit | edit source]

gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm

3.2. Video only playback[edit | edit source]

gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm --audiosink=fakesink

Audio rendering is disabled, but audio decoding continues.

3.3. Playlist playback[edit | edit source]

gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm /usr/local/demo/media/ST2297_visionv3.webm /usr/local/demo/media/ST2297_visionv3.webm /usr/local/demo/media/ST2297_visionv3.webm

Press ">" key to play the next file, "<" key to play the previous one.

3.4. Loop or repeat the same video[edit | edit source]

This option is not currently available within gst-play but here are some alternatives:

  • Playlist with the same video over and over. In the example below, the same video file is played 3 times. The video file can be added as many times as needed:
gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm /usr/local/demo/media/ST2297_visionv3.webm  /usr/local/demo/media/ST2297_visionv3.webm
  • For loop (here 1000 times):
for i in `seq 1 1000`;do gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm; done

3.5. Seek while playing[edit | edit source]

gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm /usr/local/demo/media/ST2297_visionv3.webm /usr/local/demo/media/ST2297_visionv3.webm /usr/local/demo/media/ST2297_visionv3.webm

Press "right arrow key" to seek forward, "left arrow key" to seek backward.

3.6. Change playback speed[edit | edit source]

gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm

Press "+" key to increase rate and "-" key to decreased it.

3.7. HTTP streaming[edit | edit source]

Info white.png Information
An internet connection is required, for example by plugging an Ethernet cable on


gst-play-1.0  https://github.com/STMicroelectronics/meta-st-openstlinux/blob/thud/recipes-samples/demo/demo-launcher/media/ST2297_visionv3.webm?raw=true


3.8. Audio/video playback on HDMI TV[edit | edit source]

Info white.png Information
Plug first HDMI TV cable as described in How to display on HDMI article


Switch audio output on HDMI:

pacmd set-card-profile 0 output:hdmi-stereo

Than play the video:

gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm

3.9. Audio/video playback in background[edit | edit source]

Option --no-interactive must be set in order to be able to play in background:

gst-play-1.0 /usr/local/demo/media/ST2297_visionv3.webm --no-interactive &
[1] 14998
root@stm32mp1:~# Now playing /av_h264_main_640x480_30fps_1000kbps_aac-lc_192kbps.mp4

Then to stop playback:

killall gst-play-1.0

or

fg
<CTRL+C>