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_get_context_defaults3 from ffmpeg is deprecated #24772

Open
3 of 4 tasks
ywangwxd opened this issue Dec 26, 2023 · 4 comments
Open
3 of 4 tasks

avcodec_get_context_defaults3 from ffmpeg is deprecated #24772

ywangwxd opened this issue Dec 26, 2023 · 4 comments

Comments

@ywangwxd
Copy link

System Information

I am compiling the 4.8.1 version of opencv, it complains about missing function avcodec_get_context_defaults3 from ffmpeg. I found that ffmpeg has already removed this function since 2021 commit. So should the using of this function be removed in opencv source?

Detailed description

 in function `CvVideoWriter_FFMPEG::open(char const*, int, double, int, int, cv::VideoWriterParameters const&)':
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiiRKN2cv21VideoWriterParametersE+0xcec): undefined reference to `avcodec_get_context_defaults3'

Steps to reproduce

1, compile ffmpeg from source (because I need a third-party hardware encoder/decoder)
2, compile opencv 4.8.1 with ffmpet support

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)
@ywangwxd ywangwxd added the bug label Dec 26, 2023
@ywangwxd
Copy link
Author

The deprecration notice says this:


This because avcodec_get_context_defaults3 was removed in ffmpeg.
https://github.com/FFmpeg/FFmpeg/commit/ff8f9fcbe558db69f804417d4e9aa2ef9445f304
Reference:

Deprecated:
This function should not be used, as closing and opening a codec context multiple time is not supported.
A new codec context should be allocated for each new use.

@asmorkalov
Copy link
Contributor

The fact that compile stage passed, but linkage failed gives me idea, that header files and binaries of FFMpeg does not match.

@sriramsowmithri9807
Copy link

**_

in function CvVideoWriter_FFMPEG::open(char const*, int, double, int, int, cv::VideoWriterParameters const&)': cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiiRKN2cv21VideoWriterParametersE+0xcec): undefined reference to avcodec_get_context_defaults3'

_**

i think it was a syntax error

@sriramsowmithri9807
Copy link

 in function `CvVideoWriter_FFMPEG::open(char const*, int, double, int, int, cv::VideoWriterParameters const&)':
cap_ffmpeg.cpp:(.text._ZN20CvVideoWriter_FFMPEG4openEPKcidiiRKN2cv21VideoWriterParametersE+0xcec): undefined reference to `avcodec_get_context_defaults3'

Steps to reproduce
1, compile ffmpeg from source (because I need a third-party hardware encoder/decoder)
2, compile opencv 4.8.1 with ffmpet support

Issue submission checklist
I report the issue, it's not a question
I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
I updated to the latest OpenCV version and the issue is still there
There is reproducer code and related data files (videos, images, onnx, etc) [Done]

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

No branches or pull requests

3 participants