GStreamer: Difference between revisions
imported>Malteneuss Initial working gstreamer flake |
imported>Malteneuss Extend page |
||
| Line 1: | Line 1: | ||
[https://gstreamer.freedesktop.org/ GStreamer] is a popular multimedia framework to handle a variety of video and audio formats on different platforms in a uniform way through a powerful and convenient API in order to build multimedia apps, video/audio editors and streaming services. It consists of a huge amount low-level plugins like "videotestsrc", "videoconvert" and "autovideosink" as well as a few higher level test-and-combine framework tools like "gst-inspect", "gst-launch" etc. | |||
== Installing via nixpkgs == | |||
In Nix as in other Linux distributions those tools and plugins are split into separate packages, which you can bring together with a custom Nix shell environment: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
# file: flake.nix | |||
{ | { | ||
description = "A GStreamer development flake"; | description = "A GStreamer development flake"; | ||
| Line 14: | Line 19: | ||
# Common plugins like "filesrc" to combine within e.g. gst-launch | # Common plugins like "filesrc" to combine within e.g. gst-launch | ||
gst_all_1.gst-plugins-base | gst_all_1.gst-plugins-base | ||
# Specialized plugins separated by quality | |||
gst_all_1.gst-plugins-good | gst_all_1.gst-plugins-good | ||
gst_all_1.gst-plugins-bad | gst_all_1.gst-plugins-bad | ||
| Line 21: | Line 27: | ||
# Support the Video Audio (Hardware) Acceleration API | # Support the Video Audio (Hardware) Acceleration API | ||
gst_all_1.gst-vaapi | gst_all_1.gst-vaapi | ||
#... | |||
]; | ]; | ||
}; | }; | ||
| Line 27: | Line 34: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
To activate this environment in your terminal run | |||
<syntaxhighlight lang="nix"> | |||
$ nix develop | |||
</syntaxhighlight> | |||
You can find all available Nix package names through the [https://search.nixos.org/packages?query=gst_all_1. Nix search page]. | |||
== Test the installation == | |||
You can test that the <code>gst_all_1.gstreamer</code> tools are available by running a dummy pipeline | You can test that the <code>gst_all_1.gstreamer</code> tools are available by running a dummy pipeline | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink | $ gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink | ||
</syntaxhighlight> | </syntaxhighlight> | ||
which should open a colored video window. | which should open a colored video window. | ||
You can test that the plugins like from <code>gst_all_1.gst-plugins-base</code> are | You can test that the plugins like from <code>gst_all_1.gst-plugins-base</code> are available to the higher level tools by inspecting such a base plugin like <code>filesrc</code> with | ||
<syntaxhighlight lang="nix"> | |||
$ gst-inspect-1.0 filesrc | |||
Factory Details: | |||
... | |||
Long-name File Source | |||
Description Read from arbitrary point in a file | |||
... | |||
Plugin Details: | |||
Name coreelements | |||
Description GStreamer core elements | |||
Filename /nix/store/p39g1gmpymya3blmqxmf54bpvv3s9z61-gstreamer-1.20.3/lib/gstreamer-1.0/libgstcoreelements.so | |||
... | |||
</syntaxhighlight> | |||
or by using it in a pipeline. Here, we could play a video from the local machine with | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
gst-launch-1.0 filesrc location=my_video.mp4 ! videoconvert ! autovideosink | $ gst-launch-1.0 filesrc location=my_video.mp4 ! videoconvert ! autovideosink | ||
</syntaxhighlight> | </syntaxhighlight> | ||