Any plan for ffmpeg-5?

jiapei100

New Member
I'm trying to build the most recent obs-studio (say, 27.2.4 ) under Ubuntu 22.04, with ffmpeg 5.0 . But failed with the following ERROR messages:
So, when will obs-studio be compatible with ffmpeg-5.0?


Bash:
[ 12%] Building C object libobs/CMakeFiles/libobs.dir/util/base.c.o
cd ....../obs-studio/build/libobs && /usr/bin/cc -DHAVE_OBSCONFIG_H -DLIBOBS_EXPORTS -DUSE_XDG -Dlibobs_EXPORTS -I/usr/include/glib-2.0/gio -I....../obs-studio/deps/libcaption -I....../obs-studio/libobs -I....../obs-studio/build/config -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers  -std=gnu99 -fno-strict-aliasing -O3 -DNDEBUG -fPIC   -pthread -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -mmmx -msse -msse2 -MD -MT libobs/CMakeFiles/libobs.dir/util/base.c.o -MF CMakeFiles/libobs.dir/util/base.c.o.d -o CMakeFiles/libobs.dir/util/base.c.o -c ....../obs-studio/libobs/util/base.c
....../obs-studio/libobs/media-io/media-remux.c: In function ‘init_output’:
....../obs-studio/libobs/media-io/media-remux.c:91:49: error: ‘AVStream’ has no member named ‘codec’
   91 |                         job->ofmt_ctx, in_stream->codec->codec);
      |                                                 ^~
....../obs-studio/libobs/media-io/media-remux.c:103:23: error: implicit declaration of function ‘avcodec_copy_context’ [-Werror=implicit-function-declaration]
  103 |                 ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
      |                       ^~~~~~~~~~~~~~~~~~~~
....../obs-studio/libobs/media-io/media-remux.c:103:54: error: ‘AVStream’ has no member named ‘codec’
  103 |                 ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
      |                                                      ^~
....../obs-studio/libobs/media-io/media-remux.c:103:72: error: ‘AVStream’ has no member named ‘codec’
  103 |                 ret = avcodec_copy_context(out_stream->codec, in_stream->codec);
      |                                                                        ^~
....../obs-studio/libobs/media-io/media-remux.c:117:27: error: ‘AVStream’ has no member named ‘codec’
  117 |                 out_stream->codec->codec_tag = 0;
      |                           ^~
....../obs-studio/libobs/media-io/media-remux.c:118:51: error: ‘AVStream’ has no member named ‘codec’
  118 |                 out_stream->time_base = out_stream->codec->time_base;
      |                                                   ^~
....../obs-studio/libobs/media-io/media-remux.c:120:35: error: ‘AVStream’ has no member named ‘codec’
  120 |                         out_stream->codec->flags |= CODEC_FLAG_GLOBAL_H;
      |                                   ^~
....../obs-studio/libobs/media-io/media-remux.c:30:29: error: ‘AV_CODEC_FLAG_GLOBAL_HEADER’ undeclared (first use in this function); did you mean ‘CODEC_FLAG_GLOBAL_H’?
   30 | #define CODEC_FLAG_GLOBAL_H AV_CODEC_FLAG_GLOBAL_HEADER
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
....../obs-studio/libobs/media-io/media-remux.c:120:53: note: in expansion of macro ‘CODEC_FLAG_GLOBAL_H’
  120 |                         out_stream->codec->flags |= CODEC_FLAG_GLOBAL_H;
      |                                                     ^~~~~~~~~~~~~~~~~~~
....../obs-studio/libobs/media-io/media-remux.c:30:29: note: each undeclared identifier is reported only once for each function it appears in
   30 | #define CODEC_FLAG_GLOBAL_H AV_CODEC_FLAG_GLOBAL_HEADER
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
....../obs-studio/libobs/media-io/media-remux.c:120:53: note: in expansion of macro ‘CODEC_FLAG_GLOBAL_H’
  120 |                         out_stream->codec->flags |= CODEC_FLAG_GLOBAL_H;
      |                                                     ^~~~~~~~~~~~~~~~~~~
....../obs-studio/libobs/media-io/media-remux.c: In function ‘media_remux_job_create’:
....../obs-studio/libobs/media-io/media-remux.c:163:9: error: implicit declaration of function ‘av_register_all’ [-Werror=implicit-function-declaration]
  163 |         av_register_all();
      |         ^~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [libobs/CMakeFiles/libobs.dir/build.make:513: libobs/CMakeFiles/libobs.dir/media-io/media-remux.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 12%] Building C object libobs/CMakeFiles/libobs.dir/util/platform.c.o
cd ....../obs-studio/build/libobs && /usr/bin/cc -DHAVE_OBSCONFIG_H -DLIBOBS_EXPORTS -DUSE_XDG -Dlibobs_EXPORTS -I/usr/include/glib-2.0/gio -I....../obs-studio/deps/libcaption -I....../obs-studio/libobs -I....../obs-studio/build/config -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers  -std=gnu99 -fno-strict-aliasing -O3 -DNDEBUG -fPIC   -pthread -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -mmmx -msse -msse2 -MD -MT libobs/CMakeFiles/libobs.dir/util/platform.c.o -MF CMakeFiles/libobs.dir/util/platform.c.o.d -o CMakeFiles/libobs.dir/util/platform.c.o -c ....../obs-studio/libobs/util/platform.c
[ 13%] Linking C shared library libobsglad.so
cd ....../obs-studio/build/deps/glad && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/glad.dir/link.txt --verbose=1
/usr/bin/cc -fPIC -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers  -std=gnu99 -fno-strict-aliasing -O3 -DNDEBUG -shared -Wl,-soname,libobsglad.so.0 -o libobsglad.so.0 CMakeFiles/glad.dir/src/glad.c.o CMakeFiles/glad.dir/src/glad_egl.c.o CMakeFiles/glad.dir/src/glad_glx.c.o  /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libEGL.so -ldl
cd ....../obs-studio/build/deps/glad && /usr/local/bin/cmake -E cmake_symlink_library libobsglad.so.0 libobsglad.so.0 libobsglad.so
cd ....../obs-studio/build/deps/glad && /usr/local/bin/cmake -E copy ....../obs-studio/build/deps/glad/libobsglad.so.0 ....../obs-studio/build/rundir/Release/bin/64bit/libobsglad.so.0
make[2]: Leaving directory '....../obs-studio/build'
[ 13%] Built target glad
make[2]: Leaving directory '....../obs-studio/build'
make[1]: *** [CMakeFiles/Makefile2:997: libobs/CMakeFiles/libobs.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '....../obs-studio/build'
[ 13%] Built target obspython_swig_compilation
make[1]: Leaving directory '....../obs-studio/build'
make: *** [Makefile:159: all] Error 2


Cheers
Pei
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
You'll probably want the master branch instead of 27.2.4. We've only recently been adding support for 5.0.
 

jiapei100

New Member
You'll probably want the master branch instead of 27.2.4. We've only recently been adding support for 5.0.
Hi, Jim:

I'm actually building the master branch... The entire info I got is:

Bash:
➜  build git:(master) ✗ git show-branch

[master] Merge branch 'master' of https://github.com/obsproject/obs-studio

➜  build git:(master) ✗ make -j16

/usr/local/bin/cmake -S....../obs-studio -B....../obs-studio/build --check-build-system CMakeFiles/Makefile.cmake 0

/usr/local/bin/cmake -E cmake_progress_start ....../obs-studio/build/CMakeFiles ....../obs-studio/build//CMakeFiles/progress.marks

make  -f CMakeFiles/Makefile2 all

make[1]: Entering directory '....../obs-studio/build'

make  -f deps/glad/CMakeFiles/glad.dir/build.make deps/glad/CMakeFiles/glad.dir/depend

make  -f deps/media-playback/CMakeFiles/media-playback.dir/build.make deps/media-playback/CMakeFiles/media-playback.dir/depend

make  -f deps/libcaption/CMakeFiles/caption.dir/build.make deps/libcaption/CMakeFiles/caption.dir/depend

make  -f deps/obs-scripting/obspython/CMakeFiles/obspython_swig_compilation.dir/build.make deps/obs-scripting/obspython/CMakeFiles/obspython_swig_compilation.dir/depend

make[2]: Entering directory '....../obs-studio/build'

......

[  9%] Building C object libobs/CMakeFiles/libobs.dir/util/platform-nix.c.o

[  9%] Building C object libobs/CMakeFiles/libobs.dir/util/pipe-posix.c.o

cd ....../obs-studio/build/libobs && /usr/bin/cc -DHAVE_OBSCONFIG_H -DLIBOBS_EXPORTS -DUSE_XDG -Dlibobs_EXPORTS -I/usr/include/glib-2.0/gio -I....../obs-studio/deps/libcaption -I....../obs-studio/libobs -I....../obs-studio/build/config -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers  -std=gnu99 -fno-strict-aliasing -O3 -DNDEBUG -fPIC   -pthread -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -mmmx -msse -msse2 -MD -MT libobs/CMakeFiles/libobs.dir/util/platform-nix.c.o -MF CMakeFiles/libobs.dir/util/platform-nix.c.o.d -o CMakeFiles/libobs.dir/util/platform-nix.c.o -c ....../obs-studio/libobs/util/platform-nix.c

cd ....../obs-studio/build/libobs && /usr/bin/cc -DHAVE_OBSCONFIG_H -DLIBOBS_EXPORTS -DUSE_XDG -Dlibobs_EXPORTS -I/usr/include/glib-2.0/gio -I....../obs-studio/deps/libcaption -I....../obs-studio/libobs -I....../obs-studio/build/config -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers  -std=gnu99 -fno-strict-aliasing -O3 -DNDEBUG -fPIC   -pthread -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -mmmx -msse -msse2 -MD -MT libobs/CMakeFiles/libobs.dir/util/pipe-posix.c.o -MF CMakeFiles/libobs.dir/util/pipe-posix.c.o.d -o CMakeFiles/libobs.dir/util/pipe-posix.c.o -c ....../obs-studio/libobs/util/pipe-posix.c

....../obs-studio/libobs/media-io/media-remux.c: In function ‘init_output’:

....../obs-studio/libobs/media-io/media-remux.c:91:49: error: ‘AVStream’ has no member named ‘codec’

   91 |                         job->ofmt_ctx, in_stream->codec->codec);

      |                                                 ^~

[  9%] Building C object libobs/CMakeFiles/libobs.dir/obs-nix-wayland.c.o

cd ....../obs-studio/build/libobs && /usr/bin/cc -DHAVE_OBSCONFIG_H -DLIBOBS_EXPORTS -DUSE_XDG -Dlibobs_EXPORTS -I/usr/include/glib-2.0/gio -I....../obs-studio/deps/libcaption -I....../obs-studio/libobs -I....../obs-studio/build/config -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers  -std=gnu99 -fno-strict-aliasing -O3 -DNDEBUG -fPIC   -pthread -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -mmmx -msse -msse2 -MD -MT libobs/CMakeFiles/libobs.dir/obs-nix-wayland.c.o -MF CMakeFiles/libobs.dir/obs-nix-wayland.c.o.d -o CMakeFiles/libobs.dir/obs-nix-wayland.c.o -c ....../obs-studio/libobs/obs-nix-wayland.c

....../obs-studio/libobs/media-io/media-remux.c:103:23: error: implicit declaration of function ‘avcodec_copy_context’ [-Werror=implicit-function-declaration]

  103 |                 ret = avcodec_copy_context(out_stream->codec, in_stream->codec);

      |                       ^~~~~~~~~~~~~~~~~~~~

....../obs-studio/libobs/media-io/media-remux.c:103:54: error: ‘AVStream’ has no member named ‘codec’

  103 |                 ret = avcodec_copy_context(out_stream->codec, in_stream->codec);

      |                                                      ^~

....../obs-studio/libobs/media-io/media-remux.c:103:72: error: ‘AVStream’ has no member named ‘codec’

  103 |                 ret = avcodec_copy_context(out_stream->codec, in_stream->codec);

      |                                                                        ^~

....../obs-studio/libobs/media-io/media-remux.c:117:27: error: ‘AVStream’ has no member named ‘codec’

  117 |                 out_stream->codec->codec_tag = 0;

      |                           ^~

....../obs-studio/libobs/media-io/media-remux.c:118:51: error: ‘AVStream’ has no member named ‘codec’

  118 |                 out_stream->time_base = out_stream->codec->time_base;

      |                                                   ^~

....../obs-studio/libobs/media-io/media-remux.c:120:35: error: ‘AVStream’ has no member named ‘codec’

  120 |                         out_stream->codec->flags |= CODEC_FLAG_GLOBAL_H;

      |                                   ^~

....../obs-studio/libobs/media-io/media-remux.c:30:29: error: ‘AV_CODEC_FLAG_GLOBAL_HEADER’ undeclared (first use in this function); did you mean ‘CODEC_FLAG_GLOBAL_H’?

   30 | #define CODEC_FLAG_GLOBAL_H AV_CODEC_FLAG_GLOBAL_HEADER

      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

....../obs-studio/libobs/media-io/media-remux.c:120:53: note: in expansion of macro ‘CODEC_FLAG_GLOBAL_H’

  120 |                         out_stream->codec->flags |= CODEC_FLAG_GLOBAL_H;

      |                                                     ^~~~~~~~~~~~~~~~~~~

....../obs-studio/libobs/media-io/media-remux.c:30:29: note: each undeclared identifier is reported only once for each function it appears in

   30 | #define CODEC_FLAG_GLOBAL_H AV_CODEC_FLAG_GLOBAL_HEADER

      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~

....../obs-studio/libobs/media-io/media-remux.c:120:53: note: in expansion of macro ‘CODEC_FLAG_GLOBAL_H’

  120 |                         out_stream->codec->flags |= CODEC_FLAG_GLOBAL_H;

      |                                                     ^~~~~~~~~~~~~~~~~~~

....../obs-studio/libobs/media-io/media-remux.c: In function ‘media_remux_job_create’:

....../obs-studio/libobs/media-io/media-remux.c:163:9: error: implicit declaration of function ‘av_register_all’ [-Werror=implicit-function-declaration]

  163 |         av_register_all();

      |         ^~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

make[2]: *** [libobs/CMakeFiles/libobs.dir/build.make:513: libobs/CMakeFiles/libobs.dir/media-io/media-remux.c.o] Error 1

make[2]: *** Waiting for unfinished jobs....

[  9%] Building C object libobs/CMakeFiles/libobs.dir/util/platform-nix-dbus.c.o

cd ....../obs-studio/build/libobs && /usr/bin/cc -DHAVE_OBSCONFIG_H -DLIBOBS_EXPORTS -DUSE_XDG -Dlibobs_EXPORTS -I/usr/include/glib-2.0/gio -I....../obs-studio/deps/libcaption -I....../obs-studio/libobs -I....../obs-studio/build/config -Wall -Wextra -Wvla -Wno-unused-function -Werror-implicit-function-declaration -Wno-missing-braces -Wno-missing-field-initializers  -std=gnu99 -fno-strict-aliasing -O3 -DNDEBUG -fPIC   -pthread -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -mmmx -msse -msse2 -MD -MT libobs/CMakeFiles/libobs.dir/util/platform-nix-dbus.c.o -MF CMakeFiles/libobs.dir/util/platform-nix-dbus.c.o.d -o CMakeFiles/libobs.dir/util/platform-nix-dbus.c.o -c ....../obs-studio/libobs/util/platform-nix-dbus.c

make[2]: Leaving directory '....../obs-studio/build'

make[1]: *** [CMakeFiles/Makefile2:997: libobs/CMakeFiles/libobs.dir/all] Error 2

make[1]: Leaving directory '....../obs-studio/build'

make: *** [Makefile:159: all] Error 2
 

jiapei100

New Member
I got it... it looks
C++:
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
is NOT working properly...

I can tell that
C++:
LIBAVCODEC_VERSION_MAJOR is equal to 59
, but the above code doesn't work at all..


It's actually this defintion
C++:
#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
brings the problem?

Anyway, my ENV:

Bash:
➜  ~ uname -r
5.15.0-27-generic
➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:    jammy
➜  ~ gcc --version
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Temparorily, I just modify the above code to:

C++:
//#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101)
#if (LIBAVCODEC_VERSION_MAJOR > 57) || \
    ((LIBAVCODEC_VERSION_MAJOR == 57) && (LIBAVCODEC_VERSION_MINOR > 48)) || \
    ((LIBAVCODEC_VERSION_MAJOR == 57) && (LIBAVCODEC_VERSION_MINOR == 48) && (LIBAVCODEC_VERSION_MICRO >= 101))

And problem solved...
 

Gabrisover

New Member
Okay... The direct solution seems to be add
C++:
#include "../obs-ffmpeg-compat.h"
in file
C++:
....../obs-studio/libobs/media-io/media-remux.c
Hi, sorry for reviving the topic.
But I didn't understand, well how does adding this dependency solve the problem?

I use Disto base Manjaro and the ffmpeg I have installed is 4.

By the way thanks, I added the dependency and it compiled I used version 27 the last one, because my laptop is old and doesn't have any necessary instructions for version 28.
 
Top