gstreamer 1.0 uninstalled link to & use external x264enc - gstreamer

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.

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.

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.

C++ / Gstreamer - Using gst_buffer_get_reference_timestamp_meta function

I am trying to use alternative timestamp with an existing gstreamer based video acquisition code. I am not allowed to post the code and have little expertise with Gstreamer, to provide a minimal example for this case. I am currently looking for a method to use the function:
gst_buffer_get_reference_timestamp_meta (GstBuffer * buffer,
GstCaps * reference)
My code has the following line:
std::cout << "Ref timestamp meta: " << gst_buffer_get_reference_timestamp_meta(buf, sample_caps) << std::endl;
However, this throws the error:
'gst_buffer_get_reference_timestamp_meta' was not declared in this scope
I tried adding #include <gst/gstbuffer.h> other than gst.h, but this did not resolve the issue. I also tried reinstalling Gstreamer.
I suspect that sample_caps is not the appropriate kind of GstCaps element; but I don't think that it should throw a declaration error as it satisfies the type requirement for the second argument. Kindly provide suggestions.
Edit1:
When I check the version of Gstreamer using dpkg -l|grep gstreamer, it returns a few lines similar to:
ii gir1.2-gstreamer-1.0 1.8.3-1~ubuntu0.1 amd64 GObject introspection data for the GStreamer library
When I run gst-launch-1.0 --gst-version, it returns:
GStreamer Core Library version 1.8.3
As pointed out in comments, the above function requires API 1.14 or above. But I am not sure if it is referring to Core Library version. My installation command in Ubuntu was:
sudo apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools
I tried running the command with 1.14 instead of 1.0, but didn't work. Also, gst-inspect-1.0 --version returns:
gst-inspect-1.0 version 1.8.3
GStreamer 1.8.3
https://launchpad.net/distros/ubuntu/+source/gstreamer1.0

Linking VLC build to ffmpeg build libraries

I'm receiving the following error message when attempting to build VLC:
checking for mad_bit_init in -lmad... yes
checking for MPG123... yes
checking for libavutil variant... libav
checking for GST_APP... yes
checking for GST_VIDEO... yes
checking for AVCODEC... no
configure: error: Requested 'libavcodec >= 57.16.0' but version of libavcodec is 56.1.0. Pass --disable-avcodec to ignore this error.
I am running the command (first step of Configuration from link below, I did the contrib method and built everything else as well):
./configure
So let's get the obvious out of the way: I'm missing the most recent version of libavcodec (v57). Using --disable-avcodec is not a viable solution. Doing a quick apt-file search libavcodec I'm seeing that for debian/jessie the latest version published is libavcodec56, not 57. I did also notice that libavcodec57 was available for installation with ffmpeg here https://ffmpeg.org/download.html
I actually needed to also build ffmpeg from source. So I did that, worked my way through the dependencies without too much trouble using the guide linked to below.
So here is my issue: After building and doing a make install of ffmpeg, I still get that error above, despite having the latest libavcodec freshly compiled.
So my question is: since I used that guide, I am still getting the error when building vlc. I see that the lib exists her: /root/ffmpeg_build/lib/libavcodec.a, and I figured make install would put it where it needs to be. Is there some other compile flag I can set while compiling vlc to point it to that lib directory to look for libavcodec?
ffmpeg build: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
vlc build: https://wiki.videolan.org/UnixCompile/
UPDATE: tried this, still getting the error message: PKG_CONFIG_PATH="/root/ffmpeg_build/lib:$PKG_CONFIG_PATH" LD_LIBRARY_PATH="/root/ffmpeg_build/lib:$LD_LIBRARY_PATH" ./configure
UPDATE2: tried this, still getting the error message: ./configure --libdir="/root/ffmpeg_build/lib:$LIBDIR"
UPDATE3: I tried merging my ffmpeg libs into my vlc libs and may have made things worse. My ffmpeg libs lived here: /root/ffmpeg_build/lib
My vlc build (contrib builds as well) lived here: /opt/vlc/
So I merged them with my existing vlc contrib lib:
cp /root/ffmpeg_build/lib/* /opt/vlc/contrib/x86_64-linux-gnu/lib/
cp /root/ffmpeg_build/lib/pkgconfig/* /opt/vlc/contrib/x86_64-linux-gnu/lib/pkgconfig/
Then ran configure:
./configure --with-contrib=contrib/x86_64-linux-gnu
Which finally worked, but now I get this error when I try to make:
Now I get the error:
/usr/bin/ld: /opt/vlc/contrib/x86_64-linux-gnu/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object; recompile with -fPIC

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