C++ / Gstreamer - Using gst_buffer_get_reference_timestamp_meta function - c++

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

Related

Compiling native node addon with c++ 17 inside fails during npm install on ubuntu

I have native add-on for nodejs that uses c++17 features, specifically "shared_mutex".
When I call npm install which downloads and compiles the add-on i get an error:
The linux machine has GCC 6.0 installed.
My Binding.gyp uses the following config to catch os type and add flags accordingly:
'conditions': [
['OS=="linux"', {
'CXXFLAGS': [
'-std=c++1z'
]}],
** i've also tried with '-std=c++17', '-std=c++1z'.
What am I missing?
Update:
1. Updated ubuntu 16.04 to GCC 16.04 and made it default.
2. It seems that when i try to compile it manualy using node-gyp rebuild "CXXFLAGS='-std=c++17'" it works and brings only one error:
"shared_,utex in namespace std does not name a type std::shared_mutex file mutex" (the last error)
Problem solved. For anyone who has the same issue, bind.gyp should use cflags_cc instead of cxxflags.

g++-4.9 on Raspberry Pi 2: undefined reference to `boost::atomics::detail::lockpool::get_lock_for when linking

I used
sudo apt-get install libboost1.55-all
to install the boost library on a Raspberry Pi 2. When I try to link the object files of my application, I get the following error:
In function `scoped_lock':
/usr/include/boost/atomic/detail/lockpool.hpp:36: undefined reference to boost::atomics::detail::lockpool::get_lock_for(void const volatile*)'
I read that this is a bug and that there are patches available:
https://svn.boost.org/trac/boost/ticket/9041
However, I don't really know how to apply the patch (a step by step explanation would be helpful, i tried "patch p0 < ...") and whether there is a more "elegant" solution.
A patch is applied to the source code before it's build. In your case you are downloading pre-built binaries so the step to apply a patch has passed.
For detailed information on how to apply a patch I found an article apply patch file using patch command

OpenCV: libdc1394 error: Failed to initialize libdc1394

I installed OpenCV correctly on Ubuntu 14.04. However, when I run: import cv2 I get this error message:
>>> import cv2
libdc1394 error: Failed to initialize libdc1394
I read the answers to this question (and the different links posted there such as this interesting but finally useless one for my case) but no solution worked for me. I have no such file /dev/raw1394. So I installed the library:
sudo apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils
But still get the same error.
Note that this answer is the only one that works for me, however I can not pick it because I need to use camera in my application.
How can I resolve this ?
Maybe disabling the driver isn't the best solution, but so far this hasn't given me any problems and was the easiest way I found to solve the issue:
sudo ln /dev/null /dev/raw1394
Attention: It is not a permanent solution.
I vaguely remember a similar problem I once had. It has something to do with user-level permission to firewire devices. You need to add a new udev rule. Create a file /etc/udev/rules.d/raw1394.rules and add the following line:
KERNEL=="raw1394", GROUP="video"
Details can be found here and here.

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

sox still doesn't support mp3 after its source is recompiled with mp3 support

I am trying to re-compile sox source with mp3 support on CentOS 5. Note sox-12.18.1-1.el5_5.1 has been installed on my CentOS machine for a while.
Following http://techblog.netwater.com/?p=4, I installed the following packages using yum.
yum install gcc-c++ libmad libmad-devel libid3tag libid3tag-devel lame lame-devel flac-devel libvorbis-devel make
./configure shows the following.
BUILD OPTIONS
Debugging build............no
Distro name ...............not specified!
Dynamic loading support....no
Pkg-config location........$(libdir)/pkgconfig
Play and rec symlinks......yes
Symlinks enabled...........yes
OPTIONAL DEVICE DRIVERS
ao (Xiph)..................no
alsa (Linux)...............no
coreaudio (Mac OS X).......no
sndio (OpenBSD)............no
oss........................yes
pulseaudio.................no
sunaudio...................no
OPTIONAL FILE FORMATS
amrnb......................no
amrwb......................no
ffmpeg.....................no
flac.......................yes
gsm........................yes (in-tree)
lpc10......................yes (in-tree)
mp3........................yes
id3tag....................yes
lame......................yes
dlopen lame...............no
mad.......................yes
dlopen mad................no
oggvorbis..................yes
sndfile....................no
wavpack....................no
OTHER OPTIONS
ladspa effects.............no
magic support..............yes
png support................no
GOMP support...............yes
But after executing "make && make install", issuing
sox test.mp3 tmp1.mp3 reverse
returns
sox: Failed reading test.mp3: Do not understand format type: mp3
What am I missing here? Thanks.
I had the same issue.
Make sure that there is no other Sox installed on the server:
yum remove sox
Next:
make uninstall
make clean
./configure
make
make install