Missing gstreamer plugin - gstreamer

I've never used gstreamer before but I'm trying to use it and video4linuxloopback to turn my IPad into a jury-rigged webcam. I have an app that outputs the video from the camera to an IP on the local network but no matter what I did I kept getting an EOS from "pipeline0". When trying to run it with decodebin to see if it could auto-detect what it needed, it says that it needs a plugin for text/html but I can't seem to find it, assuming it exists. Here's the full log
$ gst-launch-1.0 souphttpsrc location=http://192.168.1.6/ ! decodebin ! videoconvert ! v4l2sink device=/dev/video0
libv4l2: error getting pixformat: Invalid argument
Setting pipeline to PAUSED ...
libv4l2: error getting pixformat: Invalid argument
Pipeline is PREROLLING ...
Got context from element 'souphttpsrc0': gst.soup.session=context, session=(SoupSession)NULL, force=(boolean)false;
Missing element: text/html decoder
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0: Your GStreamer installation is missing a plug-in.
Additional debug info:
../gst-plugins-base/gst/playback/gstdecodebin2.c(4678): gst_decode_bin_expose (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:
no suitable plugins found:
Missing decoder: text/html (text/html)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...

Related

Why gstreamer with vaapih264enc shows "context pad peer query failed"?

I would like to use hardware encoding to compress a raw video file using gstreamer and vaapi. I am getting Could not initialize supporting library, which does not allow encoder to open. Possibly context pad peer query failed is the root cause for this. But I am not sure. I use the following pipeline:
gst-launch-1.0 -v filesrc location=input.raw ! videoparse width=1280 height=1024 format=yuy2 framerate=20/1 ! vaapih264enc ! h264parse ! qtmux ! filesink location=compressed.mov
Pipeline fails with message:
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstVaapiEncodeH264:vaapiencodeh264-0: Could not initialize supporting library.
Additional debug info:
gstvideoencoder.c(1534): gst_video_encoder_change_state (): /GstPipeline:pipeline0/GstVaapiEncodeH264:vaapiencodeh264-0:
Failed to open encoder
Setting pipeline to NULL ...
Freeing pipeline ...
What am I doing wrong?
Using GST_DEBUG=3 gst-launch-1.0 --gst-debug-level=4 to start the pipeline gives me this:
INFO GST_STATES gstbin.c:2316:gst_bin_element_set_state:<vaapiencodeh264-0> current NULL pending VOID_PENDING, desired next READY
INFO GST_CONTEXT gstvaapivideocontext.c:106:context_pad_query:<vaapiencodeh264-0:src> context pad peer query failed
INFO GST_CONTEXT gstvaapivideocontext.c:106:context_pad_query:<vaapiencodeh264-0:sink> context pad peer query failed
INFO GST_CONTEXT gstvaapivideocontext.c:180:_gst_context_query:<vaapiencodeh264-0> posting `need-context' message
INFO vaapi gstvaapidisplay.c:119:libgstvaapi_init_once: gstreamer-vaapi version
WARN videoencoder gstvideoencoder.c:1534:gst_video_encoder_change_state:<vaapiencodeh264-0> error: Failed to open encoder
INFO GST_ERROR_SYSTEM gstelement.c:1879:gst_element_message_full:<vaapiencodeh264-0> posting message: Could not initialize supporting library.
INFO GST_ERROR_SYSTEM gstelement.c:1902:gst_element_message_full:<vaapiencodeh264-0> posted error message: Could not initialize supporting library.
INFO GST_STATES gstelement.c:2657:gst_element_change_state:<vaapiencodeh264-0> have FAILURE change_state return
INFO GST_STATES gstelement.c:2247:gst_element_abort_state:<vaapiencodeh264-0> aborting state from NULL to READY
INFO GST_STATES gstbin.c:2780:gst_bin_change_state_func:<pipeline0> child 'vaapiencodeh264-0' failed to go to state 2(READY)
My hardware should support this and driver seems to be installed properly:
shell:~$ vainfo
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Skylake - 1.7.0
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Simple : VAEntrypointEncSlice
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointEncSlice
VAProfileH264ConstrainedBaseline: VAEntrypointVLD
VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
VAProfileH264Main : VAEntrypointVLD
VAProfileH264Main : VAEntrypointEncSlice
VAProfileH264High : VAEntrypointVLD
VAProfileH264High : VAEntrypointEncSlice
VAProfileH264MultiviewHigh : VAEntrypointVLD
VAProfileH264MultiviewHigh : VAEntrypointEncSlice
VAProfileH264StereoHigh : VAEntrypointVLD
VAProfileH264StereoHigh : VAEntrypointEncSlice
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
VAProfileNone : VAEntrypointVideoProc
VAProfileJPEGBaseline : VAEntrypointVLD
VAProfileJPEGBaseline : VAEntrypointEncPicture
VAProfileVP8Version0_3 : VAEntrypointVLD
VAProfileVP8Version0_3 : VAEntrypointEncSlice
VAProfileHEVCMain : VAEntrypointVLD
VAProfileHEVCMain : VAEntrypointEncSlice
vaapi plugin seems to be properly installed as well:
gst-inspect-1.0 vaapih264enc
Factory Details:
Rank primary (256)
Long-name VA-API H.264 encoder
Klass Codec/Encoder/Video
Description A VA-API based H.264 video encoder
Author Wind Yuan <feng.yuan#intel.com>
Plugin Details:
Name vaapi
Description VA-API based elements
Filename /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvaapi.so
Version 1.8.3
License LGPL
Source module gstreamer-vaapi
Source release date 2016-06-09
Binary package gstreamer-vaapi
Origin URL http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer
...
Thank you for any suggestions.
I believe incorrect user configuration/permissions were the reason why the encoder library could not be initialized. It would be nice if knew how to find some log messages somewhere on my system to point me in that direction (it was a lucky stumble on my part).
I got hardware encoding working after changing two things: 1) the user under which I was running these command did not have the right permissions or configuration. I did not investigate what exactly yet. 2) Once I used proper user account I got an error message that suggested I use vaapipostproc before vaapih264enc to resolve chroma type that was not understood by the en.
The final pipeline command I used is: sudo -u proper_user gst-launch-1.0 filesrc location=input.raw ! videoparse width=1280 height=1024 format=yuy2 framerate=20/1 ! videoconvert ! vaapipostproc ! vaapih264enc ! qtmux ! filesink location=hardware.compressed.mov

Missing Plugin when using gst-discoverer

Getting error when using gst-discoverer script.
Is there any way to get the name?
When set the VERBOSE mode on (GST_DEBUG=3) , got the following msgs:
basesrc gstbasesrc.c:3583:gst_base_src_start_complete:<source> pad not activated yet
WARN basesrc gstbasesrc.c:3583:gst_base_src_start_complete:<source> pad not activated yet
0:00:00.106675435 140 0x75e01d50 WARN qtdemux qtdemux_types.c:233:qtdemux_type_get: unknown QuickTime node type pasp
0:00:00.106839132 140 0x75e01d50 WARN qtdemux qtdemux.c:3031:qtdemux_parse_trex:<qtdemux0> failed to find fragment defaults for stream 1
.....
uridecodebin gsturidecodebin.c:921:unknown_type_cb:<discoverer-uri> warning: No decoder available for type 'video/x-h264, stream-format=(string)avc,
....
uridecodebin gsturidecodebin.c:988:no_more_pads_full:<discoverer-uri> error: no suitable plugins found:
...
Tried installing libav as well
apt-get install gstreamer1.0-libav --no-install-recommends still no progress.
Not sure if I am missing anything. Can you guys please help me in solving the issue.
Thanks for your help.

gscam can't find plugin but gstreamer works fine

I'm trying to use gscam (http://wiki.ros.org/gscam) compiled with the gstreamer 1.0 flag with a camera connected via ethernet to my laptop running Ubuntu16.04, ROS kinetic and gstreamer 1.0.
I'm able to properly start gstreamer and see the stram window using the command:
gst-launch-1.0 udpsrc caps="application/x-rtp,media=video,clock-rate=90000,encoding-name=H264, payload=96" port=5002 ! rtph264depay ! video/x-h264,framerate=24/1,width=640,height=480 ! queue ! avdec_h264 ! videoconvert ! autovideosink sync=FALSE
but following the gscam instuction, running the command:
export GSCAM_CONFIG="udpsrc caps="application/x-rtp,media=video,clock-rate=90000,encoding-name=H264,payload=96" port=5002 ! rtph264depay ! video/x-h264,framerate=24/1,width=640,height=480 ! decodebin ! videoconvert"
and then:
rosrun gscam gscam
I get the error:
[FATAL] [1533651268.132080791]: no element "udpsrc"
[FATAL] [1533651268.132104353]: Failed to initialize gscam stream!
This happens both when installing gscam using:
sudo apt-get install ros-kinetic-gscam
and compiling it from source using catkin
Can anyone please help me?
Update:
A crucial missing information is that gscam was build from source with gstreamer-1.0 flags.
Thus, it is not the common application from the ROS ppa which uses gstreamer-0.10.
First the direct solution: It seems that you are missing some plugin packages.
udpsrc is part of gst-plugins-good-plugins-0.10, which you can install under Ubuntu 16.04 as follows (with necessary base plugins):
sudo apt-get install gstreamer0.10-plugins-base gstreamer0.10-plugins-base-apps gstreamer0.10-plugins-good
Second, some info about gstreamer: gscam does depend on gstreamer-0.10 and not gstreamer-1.0, which are completely disjunct versions.
You can check this out by typing
$ apt-cache depends ros-kinetic-gscam
...
libgstreamer0.10-0
...
You have to watch out when elaborating config strings with gstreamer-1.0 and then try to use these in gstreamer-0.10.
It might not always work, so try directly working with gstreamer-0.10.

GStreamer in OpenCV does not send video data over UDP

I'm trying to use GStreamer on Mac (10.12.6) to stream a video encoded from OpenCV frames via UDP. For some reason this does not work and I'm not getting any error output from GStreamer or OpenCV. This is how I open the writer in OpenCV:
cv::VideoWriter writer(
"appsrc ! videoconvert ! x264enc byte-stream=true threads=4 ! mpegtsmux ! udpsink host=localhost port=9999",
cv::CAP_GSTREAMER,
0,
(double) 5,
cv::Size(320, 240),
true);
This writer opens and I can feed frames into it but I don't get any output when listening to the port. The same pipeline works when compiled from (c++) source using the GStreamer API or when being launched via
/gst-launch-1.0 videotestsrc ! x264enc byte-stream=true threads=4 ! mpegtsmux ! udpsink host=localhost port=9999
I don't think OpenCV or GStreamer itself is at fault because I am able to stream video to the autovideosink in OpenCV when opening the writer via
cv::VideoWriter writer(
"appsrc ! autovideosink",
cv::CAP_GSTREAMER,
0,
(double) 5,
cv::Size(320, 240),
true);
For reference - I installed GStreamer via Brew and built OpenCV myself using the following CMake Flags:
-DOPENCV_ENABLE_NONFREE=ON
-DWITH_OPENGL=ON
-DWITH_OPENVX=ON
-DWITH_OPENCL=ON
-DBUILD_PNG=ON
-DBUILD_TIFF=ON
-DOPENCV_EXTRA_MODULES_PATH=~/src/opencv_contrib/modules
-DWITH_1394=OFF
-DWITH_CUDA=OFF
-DWITH_GSTREAMER=ON.
I'm relatively new to GStreamer so I could be missing something obvious. Any idea what I could be doing wrong here or what would help to track down the issue?
Finally got it. Turning on GStreamer Debug Output via setting GST_DEBUG=2 yielded that x264enc was not found by OpenCV. I didn't notice that as it was found when compiling the pipeline via the GStreamer C++ API.
The reason for that was that while the GStreamer install packages on OSX installed the x264enc element, brew on mac didn't. Having compiled OpenCV myself - it used the brew install of GStreamer and not the framework.
Solved the problem by reinstalling the x264enc element for GStreamer via brew (brew install gst-plugins-ugly --with-x264).

gstreamer 1.0 uninstalled link to & use external x264enc

I have installed latest gstreamer uninstalled via git and have it in,
/home/ec2-user/gst/master/
to launch GST I use, cd /home/ec2-user/gst; ./gst-master; myGstProg. When I test for x264enc I get not found.
[ec2-user#xxxxxx master]$ gst-inspect-1.0 x264enc
No such element or plugin 'x264enc'
As part of our normal dev build we have compiled and installed both gst and x264enc,
[ec2-user#xxxxxx ~]$ gst-inspect-1.0 x264enc
Factory Details:
Rank primary (256)
Long-name x264enc
Klass Codec/Encoder/Video
Description H264 Encoder
Author Josef Zlomek <josef.zlomek#itonis.tv>, Mark Nauwelaerts <mnauw#users.sf.net>
Plugin Details:
Name x264
Description libx264-based H264 plugins
Filename /home/myBin/lib/gstreamer-1.0/libgstx264.so
Compiling the source, no problems are reported, however when running the program at gst_element_factory_make ("x264enc", "myX264"); we get,
GStreamer-CRITICAL **: gst_bin_add: assertion 'GST_IS_ELEMENT (element)' failed
At first I copied /home/myBin/lib/gstreamer-1.0/libgstx264.so to /home/ec2-user/gst/test_libs/libgstx264.so and addedLD_LIBRARY_PATH=/home/ec2-user/gst/test_libs:$LD_LIBRARY_PATH to master/gstreamer/scripts/gst-uninstalled
How/what do I update under the /home/ec2-user/gst to include the x264enc element?
As I can't make comments, some remarks:
In my point of view the problem is that when trying to compile the GST_Head some library is missing and refuses to compile x264 plugin.
This plugin (x264->x264enc) is located at gst-plugins-ugly library.
In my computer, for example (gstreamer unninstaled 1.10.1 version), if I launch ./autogen.sh or ./configure, referring to the x264 plugin, it prints me the next stuff:
configure: *** checking feature: x264 plug-in ***
configure: *** for plug-ins: x264 ***
checking for X264... yes
configure: *** These plugins will be built: x264
checking that generated files are newer than configure... done
It is printing the same to you?
You should also check that x264 and libx264-* libraries are correctly installed on your system, otherwise the configure will not compile x264 plugin.
Hope this helps.