How to watch Youtube videos with Gstreamer

3 min. read |

Youtube is a great platform with useful video content. With Gstreamer capabilities and your creativity you can watch same Youtube videos but with original filters (blurring, sharpening), transformations (style transfer), enhancements (coloring, super resolution).


Learn how to?

  • use souphttpsrc plugin to stream video via HTTP/HTTPS protocols
  • convert youtube link to HTTP/HTTPS URI
  • play both video and audio within Gstreamer pipeline



Youtube-dl is a useful package that allows user to download video from Youtube. It can be installed as pip-package and used with Python.

Let create own virtual environment and install youtube-dl library there

Use the next command in order to get URL from youtube link

For example, lets take a sample video from Youtube (The Witcher | Netflix) and get best

Note: In following case we requesting HTTPS URL for best quality video in MPEG-4 media container. To explore more options check official documentation

Previous command produces similar output

Video streaming using HTTPS

Souphttpsrc is a plugin that allows to read buffers from HTTP/HTTPS stream specified by URL. Let’s build a simple pipeline and run it from command line:

You should see something like this

Note: To play both video and audio use next command.

  • qtdemux parses MPEG-4 video container
    • pay attention qtdemux has dynamic number of outputs, so you can extract with it both audio and video streams
  • avdec_h264 decodes video stream from H264 compression format
  • avdec_aac decodes audio stream from Advanced Audio Conding (AAC) format

Explore gstreamer commands cheatsheet so you can play with different pipeline and check different effects on Youtube videos.


Record video from Youtube

  • use filesink to record video into a single video file.

Note: Add -e flag so the video can be closed correctly in case of any interruption (system or user)

List available formats

  • for a specific Youtube video


  • Now, you can play video from Youtube using Gstreamer souphttpsrc plugin.
  • Also, we checked both audio and video play with Gstreamer

Hope the information was useful and everything worked as expected 😉


Add a Comment

Your email address will not be published. Required fields are marked *