openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.97k stars 2.55k forks source link

gstreamer - opencvExample is not working on Ubuntu #7516

Closed dimitre closed 1 year ago

dimitre commented 1 year ago

tested on 22.10 and 23.04 video image is black or some tiny glitches and terminal prints [warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded

dimitre commented 1 year ago

opencvPeopleDetection is only black screen. it is probably related to GStreamer

ofTheo commented 1 year ago

did you run install_codecs.sh from the same folder as install_dependcies?

dimitre commented 1 year ago

ow yes I forgot that! but now I've installed at least in 23.04 it has some glitches, and terminal outputs

[warning] ofGstUtils: getDurationNanos(): couldn't query time duration
[ error ] ofGstVideoPlayer: allocate(): cannot get pipeline caps
[ error ] ofGstUtils: gstHandleMessage(): embedded video playback halted for plugin, module qtdemux0  reported: Internal data stream error.
dimitre commented 1 year ago

now confirming in 22.04 too, black screen on opencvExample and output

[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded
ofTheo commented 1 year ago

Hmm it works for me with the nightly. Both openCvExample and videoPlayerExample

can you do dpkg -l gstreamer*

this is what I get:

+++-=====================================-========================-============-=======================================================
un  gstreamer0.10-gnomevfs                <none>                   <none>       (no description available)
un  gstreamer0.10-packagekit              <none>                   <none>       (no description available)
ii  gstreamer1.0-alsa:amd64               1.20.1-1                 amd64        GStreamer plugin for ALSA
un  gstreamer1.0-audiosink                <none>                   <none>       (no description available)
un  gstreamer1.0-audiosource              <none>                   <none>       (no description available)
ii  gstreamer1.0-clutter-3.0:amd64        3.0.27-2ubuntu1          amd64        Clutter PLugin for GStreamer 1.0
un  gstreamer1.0-doc                      <none>                   <none>       (no description available)
ii  gstreamer1.0-gl:amd64                 1.20.1-1                 amd64        GStreamer plugins for GL
ii  gstreamer1.0-gtk3:amd64               1.20.3-0ubuntu1          amd64        GStreamer plugin for GTK+3
ii  gstreamer1.0-libav:amd64              1.20.3-0ubuntu1          amd64        ffmpeg plugin for GStreamer
ii  gstreamer1.0-packagekit               1.2.5-2ubuntu2mint1+vera amd64        GStreamer plugin to install codecs using PackageKit
ii  gstreamer1.0-pipewire:amd64           0.3.48-1ubuntu2          amd64        GStreamer 1.0 plugin for the PipeWire multimedia server
ii  gstreamer1.0-plugins-bad:amd64        1.20.3-0ubuntu1          amd64        GStreamer plugins from the "bad" set
un  gstreamer1.0-plugins-bad-faad         <none>                   <none>       (no description available)
un  gstreamer1.0-plugins-bad-videoparsers <none>                   <none>       (no description available)
ii  gstreamer1.0-plugins-base:amd64       1.20.1-1                 amd64        GStreamer plugins from the "base" set
ii  gstreamer1.0-plugins-base:i386        1.20.1-1                 i386         GStreamer plugins from the "base" set
ii  gstreamer1.0-plugins-base-apps        1.20.1-1                 amd64        GStreamer helper programs from the "base" set
ii  gstreamer1.0-plugins-good:amd64       1.20.3-0ubuntu1          amd64        GStreamer plugins from the "good" set
ii  gstreamer1.0-plugins-good:i386        1.20.3-0ubuntu1          i386         GStreamer plugins from the "good" set
ii  gstreamer1.0-plugins-ugly:amd64       1.20.1-1                 amd64        GStreamer plugins from the "ugly" set
un  gstreamer1.0-plugins-ugly-amr         <none>                   <none>       (no description available)
ii  gstreamer1.0-pulseaudio:amd64         1.20.3-0ubuntu1          amd64        GStreamer plugin for PulseAudio (transitional package)
ii  gstreamer1.0-tools                    1.20.3-0ubuntu1          amd64        Tools for use with GStreamer
ii  gstreamer1.0-vaapi:amd64              1.20.1-1ubuntu1          amd64        VA-API plugins for GStreamer
un  gstreamer1.0-vaapi-doc                <none>                   <none>       (no description available)
un  gstreamer1.0-videosink                <none>                   <none>       (no description available)
un  gstreamer1.0-videosource              <none>                   <none>       (no description available)
un  gstreamer1.0-visualization            <none>                   <none>       (no description available)
ii  gstreamer1.0-x:amd64                  1.20.1-1                 amd64        GStreamer plugins for X11 and Pango
ii  gstreamer1.0-x:i386                   1.20.1-1                 i386         GStreamer plugins for X11 and Pango
dimitre commented 1 year ago
dpkg -l gstreamer*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                            Version         Architecture Description
+++-===============================-===============-============-=======================================================
un  gstreamer0.10-packagekit        <none>          <none>       (no description available)
ii  gstreamer1.0-alsa:amd64         1.22.1-1ubuntu1 amd64        GStreamer plugin for ALSA
un  gstreamer1.0-audiosink          <none>          <none>       (no description available)
un  gstreamer1.0-audiosource        <none>          <none>       (no description available)
ii  gstreamer1.0-clutter-3.0:amd64  3.0.27-3        amd64        Clutter PLugin for GStreamer 1.0
un  gstreamer1.0-doc                <none>          <none>       (no description available)
ii  gstreamer1.0-gl:amd64           1.22.1-1ubuntu1 amd64        GStreamer plugins for GL
ii  gstreamer1.0-gtk3:amd64         1.22.1-1ubuntu1 amd64        GStreamer plugin for GTK+3
un  gstreamer1.0-libav              <none>          <none>       (no description available)
ii  gstreamer1.0-packagekit         1.2.6-3         amd64        GStreamer plugin to install codecs using PackageKit
ii  gstreamer1.0-pipewire:amd64     0.3.65-3        amd64        GStreamer 1.0 plugin for the PipeWire multimedia server
un  gstreamer1.0-plugins-bad        <none>          <none>       (no description available)
ii  gstreamer1.0-plugins-base:amd64 1.22.1-1ubuntu1 amd64        GStreamer plugins from the "base" set
ii  gstreamer1.0-plugins-base-apps  1.22.1-1ubuntu1 amd64        GStreamer helper programs from the "base" set
ii  gstreamer1.0-plugins-good:amd64 1.22.1-1ubuntu1 amd64        GStreamer plugins from the "good" set
ii  gstreamer1.0-plugins-ugly:amd64 1.22.1-1        amd64        GStreamer plugins from the "ugly" set
un  gstreamer1.0-plugins-ugly-amr   <none>          <none>       (no description available)
un  gstreamer1.0-pulseaudio         <none>          <none>       (no description available)
ii  gstreamer1.0-tools              1.22.2-1        amd64        Tools for use with GStreamer
un  gstreamer1.0-videosink          <none>          <none>       (no description available)
un  gstreamer1.0-videosource        <none>          <none>       (no description available)
un  gstreamer1.0-visualization      <none>          <none>       (no description available)
ii  gstreamer1.0-x:amd64            1.22.1-1ubuntu1 amd64        GStreamer plugins for X11 and Pango
ofTheo commented 1 year ago

Hmm - I think you might be missing a couple of key packages.

Can you do: sudo apt-get -y install gstreamer1.0-libav sudo apt-get -y install gstreamer1.0-vaapi

dimitre commented 1 year ago

Yes it works after this. We have to update some scripts. install_codecs.sh ?

#!/bin/sh

if [ $(id -u) != 0 ]; then
    echo "this script must be run using sudo"
    echo ""
    echo "usage:"
    echo "sudo "$0
    exit $exit_code
   exit 1
fi

GSTREAMER_VERSION=0.10
apt-cache show libgstreamer1.0-dev && GSTREAMER_VERSION=1.0

apt-get install libmpg123-dev gstreamer${GSTREAMER_VERSION}-plugins-ugly gstreamer1.0-vaapi gstreamer1.0-libav
ofTheo commented 1 year ago

awesome @dimitre I did a PR for it with install_dependencies as its more of a core requirement than additional codecs.
see #7528