Closed SleepingPanda closed 1 month ago
@SleepingPanda looks like the build config step is failing to find the ffmpeg dependencies. Have you installed the ffmpeg development package?
Yup here are the packages I installed for building: git cmake gcc-c++ ffmpeg-free ffmpeg-free-devel libX11-devel pipewire-devel egl-wayland-devel libdrm-devel
Yes, the ffmpeg-free-devel
pacakge (and its dependencies) appear to provide the required headers. There's possibly a bug in Shadow Cast's configure step in that case.
Any chance you could paste the output of the following command?...
$ pkg-config --variable=includedir libavcodec
Sure,
# sudo pkg-config --variable=includedir libavcodec
/usr/include/ffmpeg
Ok, I think this is a silly typo bug on my part :facepalm:
If you're able to apply it then the following patch should fix it...
diff --git a/cmake/FindFFMpeg.cmake b/cmake/FindFFMpeg.cmake
index 89914bb..0f60fa0 100644
--- a/cmake/FindFFMpeg.cmake
+++ b/cmake/FindFFMpeg.cmake
@@ -11,7 +11,7 @@ function(try_find_ffmpeg_targets)
)
foreach(FFMPEG_COMPONENT ${EXPORT_FFMPEG_NAMES})
- pkg_check_modules(PC_${FFMPEG_COMPONENT}_CODEC QUIET "lib${FFMPEG_COMPONENT}")
+ pkg_check_modules(PC_${FFMPEG_COMPONENT} QUIET "lib${FFMPEG_COMPONENT}")
find_path(FFMpeg_${FFMPEG_COMPONENT}_INCLUDE_DIR
NAMES ${FFMPEG_COMPONENT}.h
You will have to reconfigure the project again after applying the patch, by either removing your ./build
directory, or by running the following...
$ cd ./build
$ cmake --fresh ..
If this works then I will apply the fix upstream
That worked!
# cmake --fresh ..
-- The CXX compiler identification is GNU 14.1.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Defaulting CMAKE_BUILD_TYPE to Release
-- IPO supported. Enabling
-- Found PkgConfig: /usr/bin/pkg-config (found version "2.1.1")
-- Pipewire_INCLUDE_DIR: /usr/include/pipewire-0.3
-- Pipewire_LIBRARY: /usr/lib64/libpipewire-0.3.so
-- SPA_INCLUDE_DIR: /usr/include/spa-0.2
-- Components: avcodec;avdevice;avfilter;avformat;avutil;swresample;swscale
-- FFMpeg_avcodec: FOUND
-- FFMpeg_avdevice: FOUND
-- FFMpeg_avfilter: FOUND
-- FFMpeg_avformat: FOUND
-- FFMpeg_avutil: FOUND
-- FFMpeg_swresample: FOUND
-- FFMpeg_swscale: FOUND
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib64/libX11.so
-- Looking for XOpenDisplay in /usr/lib64/libX11.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Found DRM: /usr/lib64/libdrm.so
-- DRM_INCLUDE_DIRS: /usr/include/libdrm;/usr/include
-- DRM_LIBRARY: /usr/include
-- Configuring done (5.7s)
-- Generating done (0.1s)
-- Build files have been written to: /root/shadow-cast/build
Great! Thank you for helping with that :+1:
Spoke too soon. There's a new issue.
# cmake --build .
[ 2%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/buffer.cpp.o
[ 4%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/buffer_pool.cpp.o
[ 6%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/codec.cpp.o
[ 8%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/format.cpp.o
[ 11%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/frame.cpp.o
[ 13%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/media_chunk.cpp.o
[ 15%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/packet.cpp.o
[ 17%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/av/sample_format.cpp.o
[ 20%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/display/display.cpp.o
[ 22%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/drm/messaging.cpp.o
[ 24%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/drm/planes.cpp.o
[ 26%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/handlers/audio_chunk_writer.cpp.o
[ 28%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/handlers/drm_video_frame_writer.cpp.o
[ 31%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/handlers/stream_finalizer.cpp.o
[ 33%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/handlers/video_frame_writer.cpp.o
[ 35%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/io/accept_handler.cpp.o
[ 37%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/io/process.cpp.o
[ 40%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/io/signals.cpp.o
[ 42%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/io/unix_socket.cpp.o
[ 44%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/platform/egl.cpp.o
In file included from /root/shadow-cast/src/platform/egl.cpp:1:
/root/shadow-cast/src/platform/egl.hpp:4:10: fatal error: EGL/egl.h: No such file or directory
4 | #include <EGL/egl.h>
| ^~~~~~~~~~~
compilation terminated.
gmake[2]: *** [src/CMakeFiles/shadow-cast-obj.dir/build.make:342: src/CMakeFiles/shadow-cast-obj.dir/platform/egl.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:102: src/CMakeFiles/shadow-cast-obj.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
Looks like the EGL headers can't be found. What does the following show?...
$ pkg-config --variable=includedir egl
Nothing. I'm not sure what package provides those. Any idea?
I believe it's provided by libglvnd-devel
. This probably needs adding to the README
That worked!
# pkg-config --variable=includedir egl
/usr/include
But then I got:
# cmake --build .
[ 2%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/platform/egl.cpp.o
[ 4%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/platform/wayland.cpp.o
In file included from /root/shadow-cast/src/platform/wayland.cpp:1:
/root/shadow-cast/src/platform/wayland.hpp:8:10: fatal error: wayland-client.h: No such file or directory
8 | #include <wayland-client.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
gmake[2]: *** [src/CMakeFiles/shadow-cast-obj.dir/build.make:356: src/CMakeFiles/shadow-cast-obj.dir/platform/wayland.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:102: src/CMakeFiles/shadow-cast-obj.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2
So I installed wayland-devel
and then it finally built:
# cmake --build .
[ 2%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/platform/wayland.cpp.o
[ 4%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/audio_service.cpp.o
[ 6%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/context.cpp.o
[ 8%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/drm_video_service.cpp.o
[ 11%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/encoder.cpp.o
[ 13%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/encoder_service.cpp.o
[ 15%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/metrics_service.cpp.o
[ 17%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/readiness.cpp.o
[ 20%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/service.cpp.o
[ 22%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/service_registry.cpp.o
[ 24%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/signal_service.cpp.o
[ 26%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/services/video_service.cpp.o
[ 28%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/utils/base64.cpp.o
[ 31%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/utils/cmd_line.cpp.o
[ 33%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/utils/contracts.cpp.o
[ 35%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/utils/elapsed.cpp.o
[ 37%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/utils/frame_time.cpp.o
[ 40%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/utils/result.cpp.o
[ 42%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/error.cpp.o
[ 44%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/logging.cpp.o
[ 46%] Building CXX object src/CMakeFiles/shadow-cast-obj.dir/nvidia.cpp.o
[ 91%] Built target shadow-cast-obj
[ 93%] Building CXX object src/CMakeFiles/shadow-cast.dir/main.cpp.o
[ 95%] Linking CXX executable shadow-cast
[ 95%] Built target shadow-cast
[ 97%] Building CXX object src/CMakeFiles/shadow-cast-kms.dir/kms.cpp.o
[100%] Linking CXX executable shadow-cast-kms
[100%] Built target shadow-cast-kms
That's great. Nice work. I suspect these pkgs are pulled in as dependencies of other pkgs on my system. I shall get these added to the README. Thank you for persevering :+1:
Thanks a lot for your help. I really did try so many different things but decided to finally try asking for your help when nothing else worked. Maybe I should have done that first haha.
No problem at all. I don't really have access to multiple distros to test these kinds of things, so this feedback is very welcome
@gmbeard I'm not sure this is entirely resolved. Here's what I'm facing:
$ shadow-cast -A ffmpeg -V h264_nvenc -f 60 -s 48000 Videos/Test.mp4
ERROR: Failed to find required audio codec
I definitely have ffmpeg installed as we've verified above so I'm unsure what's the deal here.
Hi @SleepingPanda,
You're asking shadow-cast to use an audio encoder called ffmpeg
here, which isn't a valid/available encoder name. You can get a list of the available audio encoders using the following command...
$ ffmpeg -encoders | grep -E '^ A'
On my system, this shows ...
A..... = Audio
A....D aac AAC (Advanced Audio Coding)
A....D ac3 ATSC A/52A (AC-3)
A....D ac3_fixed ATSC A/52A (AC-3) (codec ac3)
A....D adpcm_adx SEGA CRI ADX ADPCM
A....D adpcm_argo ADPCM Argonaut Games
A....D g722 G.722 ADPCM (codec adpcm_g722)
(... continued> ...)
The valid names you can use with the shadow-cast -A
option are listed in the second column (after the A...D
column)
NOTE: I haven't exhaustively tested all these audio encoders so YMMV. Also note this from the README about the sample rate...
(NOTE: Some encoders will only support certain sample rates. Shadow Cast will display an error if your chosen sample rate isn't supported)
EDIT: You can also view details about a particular encoder with the command...
$ ffmpeg -h encoder=<ENCODER_NAME>
Hi there, Fedora 40 is unable to build shadow-cast.
Can you tell me how to proceed?