centricular / gstcefsrc

A simple gstreamer wrapper around Chromium Embedded Framework
87 stars 45 forks source link

trying to build for jetson nano #71

Closed lblabr closed 1 year ago

lblabr commented 1 year ago

i have ubuntu 20.04 running on jetson nano and try to use it for livestreaming. i would like to make an overlay with an webpage...

so i tried to use gstcefsrc for that i compiled and try to run, but get the following error:

No such element or plugin 'cefsrc' jetson@nano:~/.sources/gstcefsrc/build/Release$ gst-launch-1.0 cefsrc

(gst-plugin-scanner:67316): GStreamer-WARNING **: 23:45:03.954: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libcef.so': /usr/lib/aarch64-linux-gnu/gstreamer-1.0/libcef.so: cannot allocate memory in static TLS block

(gst-plugin-scanner:67316): GStreamer-WARNING **: 23:45:04.022: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstcef.so': ./libcef.so: cannot allocate memory in static TLS block ERROR: pipeline could not be constructed: no element "cefsrc". jetson@nano:~/.sources/gstcefsrc/build/Release$

any idea/hint ??

thanks in advance

Lars

MathieuDuponchelle commented 1 year ago

That doesn't sound like a cefsrc issue to be honest, have you tried simply googling for the error?

lblabr commented 1 year ago

yes i did, i had this kind of error also with obs. building with a libcef provided by obs (repo) helped there

any hints for doing similar with this project would be great

MathieuDuponchelle commented 1 year ago

You can build with your own CEF version with such a command:

CEF_ROOT=/path/to/chromium/src/out/Release_GN_x64/ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..

I don't think there is much more I can do here, please propose a MR if you have a fix :)

lblabr commented 1 year ago

@MathieuDuponchelle just to have it correct for my build ...

`jetson@nano:~/.sources$ ls obs-build-dependencies/cef_binary_5060_linuxarm64 build cmake CMakeCache.txt CMakeFiles cmake_install.cmake CMakeLists.txt include libcef_dll libcef_dll_wrapper LICENSE.txt Makefile README.txt Release Resources

jetson@nano:~/.sources$ ls obs-build-dependencies/cef_binary_5060_linuxarm64/Release/ chrome-sandbox libcef.so libEGL.so libGLESv2.so libvk_swiftshader.so libvulkan.so.1 snapshot_blob.bin v8_context_snapshot.bin vk_swiftshader_icd.json`

CEF_ROOT=~/.sources/obs-build-dependencies/cef_binary_5060_linuxarm64 or a subdir of ~/.sources/obs-build-dependencies/cef_binary_5060_linuxarm64 ??

lblabr commented 1 year ago

with the provied command i get:

jetson@nano:~/.sources/gstcefsrc/build$ CEF_ROOT=~/.sources/obs-build-dependencies/cef_binary_5060_linuxarm64/Release/ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. -- The C compiler identification is GNU 8.4.0 -- The CXX compiler identification is GNU 8.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Downloading /home/jetson/.sources/gstcefsrc/third_party/cef/cef_binary_103.0.9%2Bgd0bbcbb%2Bchromium-103.0.5060.114_linuxarm64.tar.bz2.sha1... -- Downloading /home/jetson/.sources/gstcefsrc/third_party/cef/cef_binary_103.0.9%2Bgd0bbcbb%2Bchromium-103.0.5060.114_linuxarm64.tar.bz2... -- [download 0% complete] -- [download 1% complete] -- [download 2% complete] -- [download 3% complete]

it seems not to take the provided libcef

lblabr commented 1 year ago

with absolute paths:

`jetson@nano:~/.sources/gstcefsrc$ mkdir build && cd build jetson@nano:~/.sources/gstcefsrc/build$ CEF_ROOT=/home/jetson/.sources/obs-build-dependencies/cef_binary_5060_linuxarm64/Release cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. -- The C compiler identification is GNU 8.4.0 -- The CXX compiler identification is GNU 8.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Error at CMakeLists.txt:49 (find_package): By not providing "FindCEF.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "CEF", but CMake did not find one.

Could not find a package configuration file provided by "CEF" with any of the following names:

CEFConfig.cmake
cef-config.cmake

Add the installation prefix of "CEF" to CMAKE_PREFIX_PATH or set "CEF_DIR" to a directory containing one of the above files. If "CEF" provides a separate development package or SDK, be sure it has been installed.

-- Configuring incomplete, errors occurred! See also "/home/jetson/.sources/gstcefsrc/build/CMakeFiles/CMakeOutput.log". jetson@nano:~/.sources/gstcefsrc/build$ mc

jetson@nano:~/.sources/gstcefsrc/build$ cd /home/jetson/.sources/obs-build-dependencies/ jetson@nano:~/.sources/obs-build-dependencies$ find . | grep cmake ./cef_binary_5060_linuxarm64/CMakeFiles/Makefile.cmake ./cef_binary_5060_linuxarm64/CMakeFiles/3.25.2/CMakeSystem.cmake ./cef_binary_5060_linuxarm64/CMakeFiles/3.25.2/CMakeCXXCompiler.cmake ./cef_binary_5060_linuxarm64/CMakeFiles/3.25.2/CMakeCCompiler.cmake ./cef_binary_5060_linuxarm64/CMakeFiles/cmake.check_cache ./cef_binary_5060_linuxarm64/CMakeFiles/CMakeDirectoryInformation.cmake ./cef_binary_5060_linuxarm64/cmake ./cef_binary_5060_linuxarm64/cmake/cef_macros.cmake ./cef_binary_5060_linuxarm64/cmake/FindCEF.cmake ./cef_binary_5060_linuxarm64/cmake/cef_variables.cmake ./cef_binary_5060_linuxarm64/libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/cmake_clean.cmake ./cef_binary_5060_linuxarm64/libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/DependInfo.cmake ./cef_binary_5060_linuxarm64/libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/cmake_clean_target.cmake ./cef_binary_5060_linuxarm64/libcef_dll_wrapper/CMakeFiles/CMakeDirectoryInformation.cmake ./cef_binary_5060_linuxarm64/libcef_dll_wrapper/cmake_install.cmake ./cef_binary_5060_linuxarm64/build/CMakeFiles/Makefile.cmake ./cef_binary_5060_linuxarm64/build/CMakeFiles/3.25.1/CMakeSystem.cmake ./cef_binary_5060_linuxarm64/build/CMakeFiles/3.25.1/CMakeCXXCompiler.cmake ./cef_binary_5060_linuxarm64/build/CMakeFiles/3.25.1/CMakeCCompiler.cmake ./cef_binary_5060_linuxarm64/build/CMakeFiles/cmake.check_cache ./cef_binary_5060_linuxarm64/build/CMakeFiles/CMakeDirectoryInformation.cmake ./cef_binary_5060_linuxarm64/build/libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/cmake_clean.cmake ./cef_binary_5060_linuxarm64/build/libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/DependInfo.cmake ./cef_binary_5060_linuxarm64/build/libcef_dll_wrapper/CMakeFiles/libcef_dll_wrapper.dir/cmake_clean_target.cmake ./cef_binary_5060_linuxarm64/build/libcef_dll_wrapper/CMakeFiles/CMakeDirectoryInformation.cmake ./cef_binary_5060_linuxarm64/build/libcef_dll_wrapper/cmake_install.cmake ./cef_binary_5060_linuxarm64/build/cmake_install.cmake ./cef_binary_5060_linuxarm64/cmake_install.cmake jetson@nano:~/.sources/obs-build-dependencies$ `

MathieuDuponchelle commented 1 year ago

@lblabr I don't know, just try to do as the error tells you? :)

lblabr commented 1 year ago

i'm not that expert.... (sry) played with the vaules for path but nothing solved the problem

lblabr commented 1 year ago

the named files

CEFConfig.cmake cef-config.cmake

are not there...

lblabr commented 1 year ago

with:

jetson@nano:~/.sources/gstcefsrc/build$ CEF_ROOT=/home/jetson/.sources/obs-build-dependencies/cef_binary_5060_linuxarm64/ cmake -G "Unix Makefiles" -DCMAKE_MODULE_PATH=/home/jetson/.sources/obs-build-dependencies/cef_binary_5060_linuxarm64/cmake -DCMAKE_BUILD_TYPE=Release ..

CMake Error at /home/jetson/.sources/obs-build-dependencies/cef_binary_5060_linuxarm64/cmake/FindCEF.cmake:33 (message): No CMake bootstrap found for CEF binary distribution at: /home/jetson/.sources/gstcefsrc/third_party/cef/cef_binary_103.0.9+gd0bbcbb+chromium-103.0.5060.114_linuxarm64. Call Stack (most recent call first): CMakeLists.txt:49 (find_package)

-- Configuring incomplete, errors occurred!

why it looks again to third-party.

i do not ahve the knowledge to solve by my own

lblabr commented 1 year ago

Maybe this helps...

works: image

does not work image

Thanks a lot!

MathieuDuponchelle commented 1 year ago

@lblabr can you expand on what worked and what didn't? I can't tell by the images tbh

lblabr commented 1 year ago

obs-browser plugin is used to "stream" a webpage more or less the same what i try to achive with gstreamer and your plugin.

obs-browser: as you can see the library is not referenced by a link... (how ever this was achieved) build static?

libgstcef.so libcef.so is referenced by an library (shared??) does not work

but as i sayed, i'm not a dev just have basic knwoledge about how to build... trying a lot sometimes it works some not

lblabr commented 1 year ago

might this help? https://bitbucket.org/chromiumembedded/java-cef/issues/377/runsh-should-know-its-directory

according to this description: https://stackoverflow.com/questions/34428037/how-to-interpret-the-output-of-the-ldd-program

for obs-browser the libcef is already in the memory, that's why there is no path in ldd output

how do achive that for cefsrc plugin?

lblabr commented 1 year ago

tried:

jetson@nano:~/.sources/gstcefsrc/build$ export LD_PRELOAD="/home/jetson/.sources/gstcefsrc/build/Release/libcef.so"

jetson@nano:~/.sources/gstcefsrc/build$ env | grep LD
LD_PRELOAD=/home/jetson/.sources/gstcefsrc/build/Release/libcef.so
LD_LIBRARY_PATH=/opt/ffmpeg-42/bin:/opt/ffmpeg-42/lib:
OLDPWD=/home/jetson

jetson@nano:~/.sources/gstcefsrc/build$ GST_PLUGIN_PATH=Release:$GST_PLUGIN_PATH gst-launch-1.0 cefsrc url="https://soundcloud.com/platform/sama" ! video/x-raw, width=1920, height=1080, framerate=60/1 ! cefdemux name=d d.video ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! videoconvert ! xvimagesink audiotestsrc do-timestamp=true is-live=true  volume=0.00 ! audiomixer name=mix ! queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! audioconvert ! pulsesink d.audio ! mix.
WARNING: erroneous pipeline: no element "cefsrc"

jetson@nano:~/.sources/gstcefsrc/build$ ls Release/
chrome_100_percent.pak  chrome-sandbox    icudtl.dat  libEGL.so     libgstcef.so          libvulkan.so.1  resources.pak      v8_context_snapshot.bin
chrome_200_percent.pak  gstcefsubprocess  libcef.so   libGLESv2.so  libvk_swiftshader.so  locales         snapshot_blob.bin  vk_swiftshader_icd.json
lblabr commented 1 year ago

i started from ...... /gstcefsrc/build$

needed to change GST_PLUGIN_PATH=Release => GST_PLUGIN_PATH=./Release

lblabr commented 1 year ago

with: ` jetson@nano:~/.sources/gstcefsrc/build$ export LD_PRELOAD="/home/jetson/.sources/gstcefsrc/build/Release/libcef.so"

` test:

GST_PLUGIN_PATH=./Release:$GST_PLUGIN_PATH gst-launch-1.0 \
    cefsrc url="https://soundcloud.com/platform/sama" ! \
    video/x-raw, width=1920, height=1080, framerate=60/1 ! cefdemux name=d d.video ! \
    queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! videoconvert ! \
    xvimagesink audiotestsrc do-timestamp=true is-live=true  volume=0.00 ! audiomixer name=mix ! \
    queue max-size-bytes=0 max-size-buffers=0 max-size-time=3000000000 ! audioconvert ! pulsesink \
    d.audio ! mix.

works!!

lblabr commented 1 year ago

is it possible to do an overlay to an video with that plugin like they do in:

https://www.youtube.com/watch?v=QNZJYOuVGiE https://www.youtube.com/watch?v=no7rvUk8GqM (5:45)

?

MathieuDuponchelle commented 1 year ago

yes it is, for overlays you would usually mix things together with a compositor element.

lblabr commented 1 year ago

i'm new with gstreamer, could you pls. share an example?

MathieuDuponchelle commented 1 year ago

@lblabr I advise reading GStreamer's documentation.