gscam can't find plugin but gstreamer works fine - gstreamer

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.

Related

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.

gstreamer WARNING: erroneous pipeline

I am currently getting the following error
WARNING: erroneous pipeline: no element "Qtdemux" when I run the following command
gst-launch-1.0 -v filesrc location=~/Desktop/Dog.mp4 ! Qtdemux ! h264parse ! ffdec_h264 ! ffmpegcolorspace ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5000
I have tried making sure I have gstreamer-plugin-good and get the following response
gstreamer1.0-plugins-good is already the newest version (1.8.3-1ubuntu0.4).
However when I look at gst-inspect-1.0 Qtdemux I get the following response No such element or plugin 'Qtdemux'.
Any thoughts on what may be the problem I am facing?
It is qtdemux, with a samll q.

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.

Gstreamer Error: pipeline could not be constructed: no element "v4l2src"

Am using Ubuntu(14.04) and I am getting this error while trying to use gstreamer.
gst-launch-1.0 v4l2src ! video/x-raw,width=640,height=480 ! x264enc ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=5000
I have checked the gst-inspect-1.0 v4l2src
It say element not found "No such element or plugin 'v4l2src'"
What should I do ? From where can I get this element or plugin. I have tried resinstalling entire gstreamer. But am unable to do so.
the v4l2src plugin belongs to the gstreamer-plugins-good package; so
sudo apt-get install gstreamer1.0-plugins-good
should help you out
Gstreamer packages most of its plugins in separate packages; you have
gst-plugins-base
gst-plugins-good
gst-plugins-ugly
and more. They are pluggable; so just updating gstreamer won't auto-select gst-plugins-good for you...
I had this same issue a while back, and what caused it for me was the fact that Anaconda was installed and had its base environment active. The solution was to run the command:
conda deactivate
And then try again.
Note: In my particular case it was harder to spot because I also had Oh-My-Bash installed and it removed Anaconda's environment indicator in the terminal.
Does
gst-inspect-1.0 -b
list any blacklisted plugins? If not check the the pluging pysically exists:
locate libgstvideo4linux2.so
There should be one under e.g.
/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstvideo4linux2.so
or
/usr/lib/gstreamer-1.0/libgstvideo4linux2.so
Then remove the registry cache again and run
GST_DEBUG="*:5" gst-inspect-1.0 2>debug.log
Search the log for v4l2 and check if gstreamer reports a reason why it won't load the plugin.
I'm using a gstreamer-1.0 on Raspberry and I was having the same issue. As I was running out of options I've tried to install also the 0.10 plugins and unexpectedly it works.
sudo apt-get install gstreamer0.10-plugins-good
my 2 cent ^_^
EDIT:
Well, actually it doen't work yet, but at least it's giving me a different error :)
EDIT 2:
It was a syntax error, It actually works for me :)
For my case the short answer is:
Run export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
Long answer:
Following the steps from #ensonic, I saw that most of my libraries were blacklisted.
Did rm -rf ~/.cache/gstreamer-1.0/ to clean the cache
Did gst-launch-1.0 v4l2src and got many errors like this:
(gst-plugin-scanner:5082): GStreamer-WARNING **: 19:41:22.907: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstttmlsubs.so': librga.so: cannot open shared object file: No such file or directory
Which showed that I didn't have the librga.so file
I could find librga.so on my system by running locate librga.so, but it seems that it was not on my dynamic shared libraries path. To do that I only had to run export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/usr/lib:/usr/local/lib
My error was due to Anaconda virtual environment and other missing plug-in. I solved by [this][1]:
conda deactivate
sudo apt-get install gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly libxml2 libpcap0.8 libaudit1 libnotify4
On Ubuntu you can install with just:
sudo apt-get install v4l-utils