gstreamer tutorial 1 playbin error on windows - gstreamer

I’m having a problem with gstreamer tutorial 1. It is failing to open a pipeline. I am running Windows 10 on a Surface Book, using Visual Studio 2019 Community.
I installed the following:
gstreamer-1.0-devel-msvc-x86_64-1.16.2.msi
gstreamer-1.0-msvc-x86_64-1.16.2.msi
I downloaded the tutorials. I copied all of the dlls from C:\gstreamer\1.0\x86_64\bin to the Debug directory where the example builds are copied. I am able to build 16 of the 19 tutorials. The 3 remaining tutorials are missing references. When I run tutorial 1, it has a problem with playbin. I added an error type to the call to get the error info. The source code is as follows:
main (int argc, char *argv[])
{
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
GError* error = NULL;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline =
gst_parse_launch
("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm",
&error);
Using a breakpoint, the error code is 1 and the message is "no element \"playbin\""
enter image description here
When I use the following at the command line, the video streams fine:
C:\gstreamer\1.0\x86_64\bin>gst-launch-1.0 -v playbin
uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm
WARNING: no real random source present!
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
After that, the video plays fine. Any idea why I’m having a problem with playbin when used in code, but not at the command line with gst-launch? It feels like I’m still missing a link to a dll or something.
Thanks,
Mark

Related

How to use Gstreamer OpenCV plugin on Windows

I am trying to build a simple program using GStreamer using the faceblur plugin that can be found in https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad on Windows.
As a starting point I used the first tutorial : https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html?gi-language=c
I have modified the pipeline as follows :
GError* error = NULL;
pipeline = gst_parse_launch("autovideosrc ! videoconvert ! faceblur ! videoconvert ! autovideosink", &error);
// print errors
if (error != NULL) {
g_error("Could not create pipeline: %s\n", error->message);
g_error_free(error);
}
As you can see, I'm trying to use the faceblur plugin here.
However, at runtime, the following error is thrown :
ERROR **: 12:09:56.343: Could not create pipeline: no element "faceblur"
My question is : how to make this work on Windows ?
How to "install" the required plugin ?
I am using Visual studio for linking/compiling.
Thank you for your help
When installing gstreamer on windows, you should select ALL plugins (or have a complete installation).

libvpx "Codec does not implement requested capability" (decoder)

I'm currently facing an issue on a project using libvpx v1.10.0 ( https://github.com/webmproject/libvpx/releases ).
I have successfully built the library for Visual Studio 16 on Windows 10 (PC x64).[I must build libvpx by my own since I need it to run on a Windows 10 ARM64 / VS16 as well (Hololens 2) and a such build is not officially provided]
I've made a C++ DLL that uses the static libs from libvpx (to be used as a native plugin in Unity).
While the VP9 encoding part seems to work correctly in a sample app using my DLL, I cannot initialize the VP9 decoder. Maybe I am missing something in the configuration step of libvpx?
To build the libvpx static libraries, I have launched MSYS2 from the x64 Native Tools Command Prompt of Visual Studio 2019.
Then, I have set the configuration as follows, inspired by what we can find in an ArchLinux AUR package ( https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=libvpx-git ):
./configure --target=x86_64-win64-vs16 --enable-libyuv \
--enable-vp8 --enable-vp9 --enable-postproc --enable-vp9-postproc \
--enable-vp9-highbitdepth --enable-vp9-temporal-denoising
make -j
At the end of the compilation, the build succeeds with 0 error but 2 warnings. The --help of the configure scripts indicates that the --enable-vp9 option enables both the VP9 encoder and decoder.
Then, when I run my app using the C++ DLL that performs the encoding and decoding stuff, I get this error message from libvpx:
Codec does not implement requested capability .
It occurs when I call the vpx_codec_dec_init() function. I don't understand why it cannot be initialized as I think that the VP9 codec is fully built. The error appears as well when I add the --enable-vp9-encoder and --enable-vp9-decoder` options and all other VP9 related options to the configuration.
Is there something to do in the code itself before initializing the VP9 decoder? I have not seen a such thing in the samples of code. Notice that the problem occurs if I use VP8 as well (encoding OK / decoding KO, same error).
Here is the beginning of my function for decoding a frame:
vpx_codec_err_t resultError;
vpx_codec_ctx_t codec;
const vpx_codec_iface_t* decoderInterface = vpx_codec_vp9_cx(); // >>> OK!
if (!decoderInterface)
{
return "libvpx: unsupported codec (decoder)";
}
resultError = vpx_codec_dec_init(&codec, decoderInterface, nullptr, 0); // >>> KO...
if (resultError)
{
std::cout << vpx_codec_error(&codec) << std::endl; // outputs "Codec does not implement requested capability"
return "libvpx: failed to initialize decoder";
}
vpx_codec_iter_t iter = nullptr;
vpx_image_t* yuvFrame = nullptr;
resultError = vpx_codec_decode(&codec, compressedFrame, (unsigned int)compressedFrameSize, nullptr, 0);
if (resultError)
{
return "libvpx: failed to decode frame";
}
// ....
Any help would be great! Thank you. :)
OK, I've figured it out! :)
The line:
const vpx_codec_iface_t* decoderInterface = vpx_codec_vp9_cx();
must be replaced by (+ #include <vpx/vp8dx.h>):
const vpx_codec_iface_t* decoderInterface = vpx_codec_vp9_dx();
The reason I have made this error is due to a previous experience in encoding/decoding videos. I've developed a webcam streaming app using the H.264 codec, which needs a set up "context" structure. So, because of the name of the vpx_codec_vp9_cx() function, I've thought it was creating a such context for VP9. In fact, cx matches for encoding and dx for decoding... Not really obvious though. I don't like this kind of function names.
Anyway, I hope it will help anybody in a same situation. ;)

Initializing SDL_Mixer gives error "Can't setup PulseAudio stream"

I'm coding an app on my raspberry-pi 3 running on Ubuntu-MATE.
I use C++ on code::blocks with SDL and SDL_Mixer to play mp3 files (I'm still using the v1.2 of the SDL libs).
I get no error when I init SDL, but when I init SDL_Mixer with this line :
Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 1, 1024)
It returns -1, so I get the error message with the Mix_GetError() method, and it gives me a "Can't setup PulseAudio stream" message.
I'm not aware of what PulseAudio is, so after some research I understood it's used for network streaming audio streams.
Why this module is needed at the init of the lib, and is there a way to go around it ? I don't intend to use network features in my app.
Also, I checked with a "sudo apt-get install pulseaudio" to make sure I wasn't missing some libs, but my packet manager seems to indicate that I have the latest update...
Any clues would really help me a lot !
Thanks
I finally resolved it myself... it was a fricking typo.
I wrote 444100 instead of 44100 for the frequency init parameter :/
Everything now load correctly (for SDL, I just used SDL_INIT_EVERYTHING for the ones who asked).
By the way, I only use SDL to use SDL_Mixer; I suppose SDL_Mixer can't run as standalone, so which module can I load in SDL to only init the basics ?
Also, now I'm curious : why does SDL_Mixer needs PulseAudio to init ?
Thanks

LibVlc : It miss DCWRBS00176.O

I try to use libvlc inside my project, so i created a sample project with a few line of code :
libvlc_instance_t *libvlc;
libvlc_media_player_t *mp;
libvlc_media_t *m;
libvlc = libvlc_new (0, NULL);
libvlc_media_t *m = libvlc_media_new_location (libvlc, "rtsp://192.168.1.10:8554");
libvlc_media_player_t *mp;
/* Create a media player playing environement */
mp = libvlc_media_player_new_from_media(m);
Sleep(10000); /* Let it play a bit */
/* Stop playing */
libvlc_media_player_stop (mp);
/* Free the media_player */
libvlc_media_player_release (mp);
libvlc_release(libvlc);
This code compile well with with version 2.1.3 of sdk included in the VLC installer.
My problem is after compile when the program stat, an alert says :
Programm can't start,... it miss DCWRBS00176.O
If i comment out from line libvlc = libvlc_new (0, NULL); to the end, this error doesn't appear.
On time i see DCWRBS00179.O (9 not 6) by commented different lines.
I copy all dll and plugins folder in my project folder same thing...
Whats wrong ? Do i need to include something else ?
Thank you.
EDIT : With last debug version 3.0.0 from git it miss DSZBS00190.O !!!
Ps : I use embarcadero C++ XE3.
So i finally found,
I was using the library included in the vlc installer, after a coff2omf the new .lib generated contains all theses dszb000xxx.o and the problems come from here.
So i used implib :
C:\Program Files (x86)\VideoLAN\VLC>implib -a libvlc.lib libvlc.dll
C:\Program Files (x86)\VideoLAN\VLC>implib -a libvlccore.lib libvlccore.dll
After linking theses libs to my project everything went fine !!!
I hope it helps someones else...

How to use LibVLC with Qt 5

I'm trying to use LibVLC in a Qt 5 program to open a VLC instance and play a video.
The following code comes from https://wiki.videolan.org/LibVLC_Tutorial/
I'm using Linux.
.pro :
TEMPLATE = app
TARGET = projectLoic
INCLUDEPATH += . vlc
QT += widgets
# Input
HEADERS +=
SOURCES += main.cpp
LIBS +=-lvlc
main :
#include <vlc/vlc.h>
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
libvlc_instance_t * inst;
libvlc_media_player_t *mp;
libvlc_media_t *m;
// Load the VLC engine
inst = libvlc_new(0, NULL);
// Create a new item
m = libvlc_media_new_path (inst, "/home/........mp3");
// Create a media player playing environement
mp = libvlc_media_player_new_from_media (m);
// play the media_player
libvlc_media_player_play (mp);
return app.exec();
}
The compilation is fine. But the program immediatly crashes when I build it (with Qt Creator). Any idea?
Many thanks
Many things could cause this crash. The best is to get VLC source code to trace back the issue. Passing the option '--verbose=2' when initializing libVLC can help as well.
In my case the cause of the crash was due to this bug in the ubuntu package of vlc:
https://bugs.launchpad.net/ubuntu/+source/vlc/+bug/1328466
When calling libvlc_new() vlc modules and their dependent libraries are loaded into memory. The qt module of LibVLC was searching for Qt4 shared objects instead of Qt5 (manually installed).
The solution was to rebuild the module cache which was outdated an pointing to Qt4 binaries. You can reset it on the command line:
sudo /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins/
Or pass to vlc the option:
--reset-plugins-cache
I have never used this library, but Are you using exactly this code?
m = libvlc_media_new_path (inst, "/home/........mp3");
This path may be the problem.
What distribution of Linux are you using?
I ran into this same problem with Qt5 and LibVLC, and the primary cause (Ubuntu 12.04 LTS and 14.04 LTS), was that LibVLC was loading the qt4 interface plugin, which conflicted with Qt5. If you check your call stack, you'll most likely see that at a Qt4 library was being loaded, causing the crash.
If this is the problem, there are only 3 options (tested with LibVLC 2.2 and Qt5 on Ubuntu 12.04 and 14.04 LTS 64 bit).
The first (worst) is to delete the qt4 user interface plugin. You can test this is the problem by moving and running and then setting it back. Deleting will break your regular VLC player most likely.
Second option is to create a copy of the plugins directory and set that in your runtime path using VLC_PLUGIN_PATH, environment variable. but I've had trouble getting that to work without changing the original plugin path folder also (which will break your VLC player unless you modify your shortcuts, etc. to also set VLC_PLUGIN_PATH.
The third option, and what I ended up doing, was to custom build my own static LibVLC binary with a few edits to the source code so that it will not load the qt4 interface plugin installed with VLC. You can follow these steps to do this.
1) Download VLC Source Code for your platforms distribution.
http://download.videolan.org/pub/videolan/vlc/
Make sure you download the version matching your distribution. For
example, match the VLC version to what is installed with Ubuntu.
2) Extract source code to folder
3) Install dependencies for the OS distribution
sudo apt-get build-dep vlc
4) Modify src/modules/bank.c
Edit the module_InitDynamic function
Add the following code at the top of the function:
// HACK TO DISABLE QT4 PLUGIN
if(strstr(path, "qt4") != NULL)
return NULL;
// END HACK
3) From terminal
./bootstrap
./configure --disable-qt --disable-skins2 --enable-xcb --prefix=/home/$USER/vlc-custom_build_output_folder_name
./make
./make install
4) Copy/Save the resulting files in the install folder.
Then just link against this library instead.