Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avcodec_find_encoder(AV_CODEC_ID_H264); #2833

Closed
frankbuijze opened this issue Dec 12, 2021 · 8 comments
Closed

avcodec_find_encoder(AV_CODEC_ID_H264); #2833

frankbuijze opened this issue Dec 12, 2021 · 8 comments

Comments

@frankbuijze
Copy link

frankbuijze commented Dec 12, 2021

Platform: CentOS Stream 8
Janus: Latest version
Libraries: Latest versions are compiled, and can be found by configure.

I've have found an issue with compiling post processing on CentOS Stream 8. I've used the following configure command:

./configure --disable-websockets --disable-rabbitmq --disable-mqtt --disable-unix-sockets --disable-nanomsg --disable-sample-event-handler --disable-websockets-event-handler --disable-rabbitmq-event-handler --disable-mqtt-event-handler -disable-nanomsg-event-handler --disable-gelf-event-handler --disable-plugin-audiobridge --disable-plugin-echotest --disable-plugin-recordplay --disable-plugin-sip --disable-plugin-nosip --disable-plugin-streaming --disable-plugin-textroom --disable-plugin-videocall --disable-plugin-voicemail --enable-post-processing --prefix=/opt/janus

This runs without any issues. make results in the following error. Janus compiles just fine without --enable-post-processing.

  CC       janus-version.o
  CCLD     janus
  CC       janus_cfgconv-version.o
  CCLD     janus-cfgconv
  CC       postprocessing/janus_pp_rec-pp-h264.o
postprocessing/pp-h264.c: In function ‘janus_pp_h264_create’:
postprocessing/pp-h264.c:70:19: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264);
                   ^~~~~~~~~~~~~~~~~~~~
postprocessing/pp-h264.c:77:29: error: assignment of member ‘video_codec’ in read-only object
  fctx->oformat->video_codec = codec->id;
                             ^
make[2]: *** [Makefile:2800: postprocessing/janus_pp_rec-pp-h264.o] Error 1
make[2]: Leaving directory '/usr/local/src/janus-gateway'
make[1]: *** [Makefile:3400: all-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/janus-gateway'
make: *** [Makefile:1553: all] Error 2

It seems that the av is not fully initiated, and that constants are not filled or loaded. Similar issues are present for h265 and other 'codecs' post processor files.

Did I forget a switch, or is this truly a bug?

Side note: ffmpeg compiles just fine with the latest libraries.

@lminiero
Copy link
Member

The codec ID is irrelevant, it looks like it's complaining about this:

postprocessing/pp-h264.c:77:29: error: assignment of member ‘video_codec’ in read-only object
  fctx->oformat->video_codec = codec->id;

What version of the library is this?

@frankbuijze
Copy link
Author

A fresh compile, so my guess is the latest version is used.

@lminiero
Copy link
Member

I'm not on CentOS 8 so I don't know what the latest version is 😉
If you installed it from some rpm, could you let us know the version from there? e.g.,

rpm -qi ffmpeg-devel

@lminiero
Copy link
Member

On Fedora 34 I have 4.4.1 and I'm not getting this error, so I have to figure out if it's an upcoming API change that needs to be addressed.

@frankbuijze
Copy link
Author

No rpm's are used. As CentOs 8 Stream does not provide those libraries. I've used the latest source code from the respective sites, to compile the libraries. They compile without errors, Janus configure script does not throw any error that libraries are missing/ wrong version.

The problem seems to be a change, where a value cannot be assigned to an object anymore, read only.

My temporary solution is a debian/ubuntu based docker container with the post processor to process the mjr-files.

@lminiero
Copy link
Member

Looks like this is the commit that made oformat a const: FFmpeg/FFmpeg@56450a0
I'll have to think about how to change the way we use it.

@lminiero
Copy link
Member

Looks like that line was unneeded, as removing it got me a valid mkv file anyway. Please let me know if it compiles for you now.

@frankbuijze
Copy link
Author

Source code compiles without errors, but some small warnings. I will test janus-pp-rec next week

CC       postprocessing/janus_pp_rec-pp-g722.o
postprocessing/pp-g722.c: In function ‘janus_pp_g722_create’:
postprocessing/pp-g722.c:68:12: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  dec_codec = avcodec_find_decoder(codec);
            ^
  CC       postprocessing/janus_pp_rec-pp-h264.o
postprocessing/pp-h264.c: In function ‘janus_pp_h264_create’:
postprocessing/pp-h264.c:70:19: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264);
                   ^~~~~~~~~~~~~~~~~~~~
  CC       postprocessing/janus_pp_rec-pp-av1.o
  CC       postprocessing/janus_pp_rec-pp-avformat.o
  CC       postprocessing/janus_pp_rec-pp-h265.o
postprocessing/pp-h265.c: In function ‘janus_pp_h265_create’:
postprocessing/pp-h265.c:70:19: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H265);
                   ^~~~~~~~~~~~~~~~~~~~
  CC       postprocessing/janus_pp_rec-pp-opus.o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants