Compile OBS on Debian with NVENC support

Knogle

New Member
Ahoy ahoy friends.
Currently i am struggeling a lot. I have purchased recently a GeForce RTX 3070Ti, and everything is running fine now using my own ffmpeg, so rendering works already.
Unfortunately to get NVENC support in OBS i think i have to compile it form the git. I did so and followed the instructions.
I had to add set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic") because i had some trouble with the .a files, which were used instead of the shared .so libraries.
Now, i get this error, and i didn't find anything useful and related to my issue.
How may i proceed in this case?

Thanks in advance!

Code:
[ 41%] Built target obs-x264
[ 42%] Built target obs-libfdk
[ 43%] Building C object plugins/obs-ffmpeg/CMakeFiles/obs-ffmpeg.dir/obs-ffmpeg-audio-encoders.c.o
In file included from /tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:27:
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-formats.h:3:47: error: unknown type name ‘AVCodecContext’; did you mean ‘AVFormatContext’?
    3 | static inline int64_t rescale_ts(int64_t val, AVCodecContext *context,
      |                                               ^~~~~~~~~~~~~~
      |                                               AVFormatContext
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c: In function ‘convert_speaker_layout’:
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:65:10: error: ‘AV_CH_LAYOUT_MONO’ undeclared (first use in this function)
   65 |   return AV_CH_LAYOUT_MONO;
      |          ^~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:65:10: note: each undeclared identifier is reported only once for each function it appears in
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:67:10: error: ‘AV_CH_LAYOUT_STEREO’ undeclared (first use in this function)
   67 |   return AV_CH_LAYOUT_STEREO;
      |          ^~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:69:10: error: ‘AV_CH_LAYOUT_SURROUND’ undeclared (first use in this function)
   69 |   return AV_CH_LAYOUT_SURROUND;
      |          ^~~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:71:10: error: ‘AV_CH_LAYOUT_4POINT0’ undeclared (first use in this function)
   71 |   return AV_CH_LAYOUT_4POINT0;
      |          ^~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:73:10: error: ‘AV_CH_LAYOUT_4POINT1’ undeclared (first use in this function)
   73 |   return AV_CH_LAYOUT_4POINT1;
      |          ^~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:75:10: error: ‘AV_CH_LAYOUT_5POINT1_BACK’ undeclared (first use in this function)
   75 |   return AV_CH_LAYOUT_5POINT1_BACK;
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:77:10: error: ‘AV_CH_LAYOUT_7POINT1’ undeclared (first use in this function)
   77 |   return AV_CH_LAYOUT_7POINT1;
      |          ^~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c: In function ‘convert_ff_channel_layout’:
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:88:7: error: ‘AV_CH_LAYOUT_MONO’ undeclared (first use in this function)
   88 |  case AV_CH_LAYOUT_MONO:
      |       ^~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:90:7: error: ‘AV_CH_LAYOUT_STEREO’ undeclared (first use in this function)
   90 |  case AV_CH_LAYOUT_STEREO:
      |       ^~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:92:7: error: ‘AV_CH_LAYOUT_SURROUND’ undeclared (first use in this function)
   92 |  case AV_CH_LAYOUT_SURROUND:
      |       ^~~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:94:7: error: ‘AV_CH_LAYOUT_4POINT0’ undeclared (first use in this function)
   94 |  case AV_CH_LAYOUT_4POINT0:
      |       ^~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:96:7: error: ‘AV_CH_LAYOUT_4POINT1’ undeclared (first use in this function)
   96 |  case AV_CH_LAYOUT_4POINT1:
      |       ^~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:98:7: error: ‘AV_CH_LAYOUT_5POINT1_BACK’ undeclared (first use in this function)
   98 |  case AV_CH_LAYOUT_5POINT1_BACK:
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:100:7: error: ‘AV_CH_LAYOUT_7POINT1’ undeclared (first use in this function)
  100 |  case AV_CH_LAYOUT_7POINT1:
      |       ^~~~~~~~~~~~~~~~~~~~
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c: In function ‘enc_create’:
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:205:13: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  205 |  enc->codec = avcodec_find_encoder_by_name(type);
      |             ^
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:209:14: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  209 |   enc->codec = avcodec_find_encoder_by_name(alt);
      |              ^
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c: In function ‘do_encode’:
/tmp/obs-studio/plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c:343:16: error: implicit declaration of function ‘rescale_ts’ [-Werror=implicit-function-declaration]
  343 |  packet->pts = rescale_ts(avpacket.pts, enc->context, time_base);
      |                ^~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [plugins/obs-ffmpeg/CMakeFiles/obs-ffmpeg.dir/build.make:95: plugins/obs-ffmpeg/CMakeFiles/obs-ffmpeg.dir/obs-ffmpeg-audio-encoders.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1381: plugins/obs-ffmpeg/CMakeFiles/obs-ffmpeg.dir/all] Error 2
make: *** [Makefile:171: all] Error 2
 
Top