dmlc / decord

An efficient video loader for deep learning with smart shuffling that's super easy to digest
Apache License 2.0
1.81k stars 158 forks source link

fail to build decord with ffmpeg due to ‘AVBSFContext’ was not declared #257

Closed hubutui closed 6 months ago

hubutui commented 1 year ago

Errors:

In file included from /home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/audio_interface.h:9,
                 from /home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/audio_reader.h:10,
                 from /home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/audio_interface.cc:5:
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:5: error: ‘AVBSFContext’ was not declared in this scope; did you mean ‘AVIOContext’?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |     ^~~~~~~~~~~~
      |     AVIOContext
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:28: error: ‘AVBSFContext’ was not declared in this scope; did you mean ‘AVIOContext’?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                            ^~~~~~~~~~~~
      |                            AVIOContext
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:48: error: ‘av_bsf_free’ was not declared in this scope; did you mean ‘av_opt_free’?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                                                ^~~~~~~~~~~
      |                                                av_opt_free
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:59: error: template argument 1 is invalid
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                                                           ^
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:59: error: template argument 3 is invalid
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:61: error: template argument 1 is invalid
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                                                             ^
/home/hubutui/Projects/archlinuxcn-repo/archlinuxcn/python-decord/src/decord-0.6.0/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:61: error: template argument 2 is invalid
make[2]: *** [CMakeFiles/decord.dir/build.make:76: CMakeFiles/decord.dir/src/audio/audio_interface.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: CMakeFiles/decord.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

quick fix, we need to add #include <libavcodec/bsf.h> to https://github.com/dmlc/decord/blob/d2e56190286ae394032a8141885f76d5372bd44b/src/video/ffmpeg/ffmpeg_common.h

hubutui commented 6 months ago

It would be better to build with ffmpeg 4. ArchLinux users see also AUR.

milahu commented 3 months ago

this patch works with ffmpeg 6

https://github.com/dmlc/decord/issues/186#issuecomment-1171882325

karthik111 commented 2 months ago

Resolved and now working in Mac as described in https://github.com/dmlc/decord/issues/186#issuecomment-2217166376

BigFishMaster commented 2 months ago

change cmake version to ffmpeg@4, then use command below: cmake .. -DCMAKE_BUILD_TYPE=Release -DFFMPEG_DIR=/opt/homebrew/opt/ffmpeg@4/