LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Blender and ffmpeg4 (https://www.linuxquestions.org/questions/slackware-14/blender-and-ffmpeg4-4175692913/)

timsoft 03-31-2021 08:37 AM

Blender and ffmpeg4
 
Has anyone had success building Blender (sbo slackbuild) with ffmpeg4 instead of ffmpeg3?

It is the only slackbuild I use which so far is refusing to play ball. All the others (qt5, audacity, vlc,kicad, shotcut, obs-studio) seem to be okay with ffmpeg4.

for me it gets as far as....
Quote:

[ 6%] Building C object source/blender/makesrna/intern/CMakeFiles/makesrna.dir/rna_scene.c.o
In file included from /tmp/SBo/blender-2.83.8/source/blender/makesrna/intern/rna_scene.c:64:0:
/tmp/SBo/blender-2.83.8/intern/ffmpeg/ffmpeg_compat.h:23:34: fatal error: libavformat/avformat.h: No such file or directory
compilation terminated.
source/blender/makesrna/intern/CMakeFiles/makesrna.dir/build.make:1238: recipe for target 'source/blender/makesrna/intern/CMakeFiles/makesrna.dir/rna_scene.c.o' failed
make[2]: *** [source/blender/makesrna/intern/CMakeFiles/makesrna.dir/rna_scene.c.o] Error 1
CMakeFiles/Makefile2:6976: recipe for target 'source/blender/makesrna/intern/CMakeFiles/makesrna.dir/all' failed
make[1]: *** [source/blender/makesrna/intern/CMakeFiles/makesrna.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
and in my environment i have
Code:

PKG_CONFIG_PATH=/usr/lib64/ffmpeg4/pkgconfig:/usr/local/lib64/pkgconfig:/usr/local/share/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig

mumahendras3 03-31-2021 09:41 AM

I don't use blender so I can't help further than pointing out below message
Quote:

In file included from /tmp/SBo/blender-2.83.8/source/blender/makesrna/intern/rna_scene.c:64:0:
/tmp/SBo/blender-2.83.8/intern/ffmpeg/ffmpeg_compat.h:23:34: fatal error: libavformat/avformat.h: No such file or directory
So it seems libavformat/avformat.h was missing.

timsoft 03-31-2021 10:55 AM

Quote:

ls /usr/include/ffmpeg4/libavformat/
produces
Quote:

avformat.h avio.h version.h
which can also be seen from
Quote:

cat /var/log/packages/ffmpeg4-4.3.2-x86_64-1_SBo
package.
so it is there, it is blender that is not finding it.
It must be hard coded where it looks, because pkgconfig finds it thanks to the PKG_CONFIG_PATH env variable for all the other software that uses ffmpeg4 as mentioned in the first post.

I am attempting to create the package with CUDA=no and EMBREE=no

because the build process is large, it is hard to figure out what configuration is created by cmake, and what is not, but all I can say is it doesn't work with ffmpeg4 for me. If anyone has got it to go (with ffmpeg4), please comment how :-)

bassmadrigal 03-31-2021 11:15 AM

Blender isn't designed to look for the header files where the ffmpeg4 SlackBuild packages them (/usr/include/ffmpeg4/ to prevent clashing with ffmpeg3). You would need to modify the Blender source to look in the proper locations, or, if you don't intend to have ffmpeg3 installed at all, you could probably symlink the locations or rebuild ffmpeg4 to use just /usr/include).

If you want to change the blender source to point to the correct header locations, it might be quite the hunt. There are probably more ffmpeg headers that blender is going to look for in the wrong location. Just checking for #include <libavformat/avformat.h> shows the following files:

Code:

intern/ffmpeg/ffmpeg_compat.h:#include <libavformat/avformat.h>
extern/audaspace/plugins/ffmpeg/FFMPEGWriter.h:#include <libavformat/avformat.h>
extern/audaspace/plugins/ffmpeg/FFMPEGReader.h:#include <libavformat/avformat.h>
source/blender/imbuf/intern/util.c:#  include <libavformat/avformat.h>
source/blender/imbuf/intern/IMB_anim.h:#  include <libavformat/avformat.h>
source/blender/imbuf/intern/anim_movie.c:#  include <libavformat/avformat.h>
source/blender/python/intern/bpy_app_ffmpeg.c:#  include <libavformat/avformat.h>
source/blender/makesrna/intern/rna_scene.c:#  include <libavformat/avformat.h>
source/blender/blenkernel/intern/writeffmpeg.c:#  include <libavformat/avformat.h>

For your error here, you'd need to add the following into the SlackBuild after you cd into the source directory but before compilation, but you might need to do this with every file listed above:

Code:

sed -i 's|libavformat/avformat.h|ffmpeg4/libavformat/avformat.h|' intern/ffmpeg/ffmpeg_compat.h
In reality, if you don't intend to use ffmpeg3 at all, you could simply change the SlackBuild for ffmpeg4 to remove the --incdir=/usr/include/ffmpeg4 \ line in the ./configure command. It might also be possible to tell blender where to expect the headers for ffmpeg, but I didn't see anything for it in the CMakeLists.txt.

timsoft 04-01-2021 08:53 AM

thanks bassmadrigal. I'm chatting with chris on #slackbuilds (the slackbuild maintainer) and he has come up with some stuff and is looking at it. If we get it going, I'll post the info here for everyone, although it might make it into the slackbuild - you never know :-)
If all fails, I might take up your last suggestion of fixing ffmpeg4 slackbuild. I am only really interested in having one version on my system, provided that all the packages I use will work with that version.

chris.willing 04-01-2021 11:00 PM

I've pushed a new iteration of the SlackBuild for Blender to use ffmpeg4 (from SBo's ffmpeg4 SlackBuild). This applies only to Slackware 14.2 (not -current, which has its own ffmpeg4 package). To try it before the next SBo public update, see: https://git.slackbuilds.org/slackbui...illing/updates

It assumes the builder has taken care of any ffmpeg4-related requirements of the prerequisites. Use of ffmpeg4 in the Blender build is dictated by the FORCE_FFMPEG4 environment variable. Enable it with something like:
Code:

    FORCE_FFMPEG4=yes sh Blender.SlackBuild
chris

bassmadrigal 04-01-2021 11:33 PM

Quote:

Originally Posted by chris.willing (Post 6236387)
I've pushed a new iteration of the SlackBuild for Blender to use ffmpeg4 (from SBo's ffmpeg4 SlackBuild). This applies only to Slackware 14.2 (not -current, which has its own ffmpeg4 package). To try it before the next SBo public update, see: https://git.slackbuilds.org/slackbui...illing/updates

It assumes the builder has taken care of any ffmpeg4-related requirements of the prerequisites. Use of ffmpeg4 in the Blender build is dictated by the FORCE_FFMPEG4 environment variable. Enable it with something like:
Code:

    FORCE_FFMPEG4=yes sh Blender.SlackBuild
chris

Much better idea than mine!

Minor suggestion if you want to make your sed a bit shorter... You can use the & symbol to duplicate your search in the replacement, meaning you could have the line be:

Code:

sed -i -e "s|env={\"ASAN_OPTIONS\": \"exitcode=0\"|&,\"LD_LIBRARY_PATH\":\"/usr/lib$LIBDIRSUFFIX/ffmpeg4\"}|g" \
  doc/manpage/blender.1.py

Instead of:

Code:

sed -i -e "s|env={\"ASAN_OPTIONS\": \"exitcode=0\"}|env={\"ASAN_OPTIONS\": \"exitcode=0\",\"LD_LIBRARY_PATH\":\"/usr/lib$LIBDIRSUFFIX/ffmpeg4\"}|g" \
  doc/manpage/blender.1.py

In fact, because "exitcode=0" is only used the two times in the file that you need to update, you can simplify the sed even more:

Code:

sed "s|\"exitcode=0\"|&,\"LD_LIBRARY_PATH\":\"/usr/lib$LIBDIRSUFFIX/ffmpeg4\"|g" blender.1.py

chris.willing 04-02-2021 02:48 AM

Quote:

Originally Posted by bassmadrigal (Post 6236392)
Minor suggestion if you want to make your sed a bit shorter... You can use the & symbol to duplicate your search in the replacement

Thanks for the tip - I'll try it out and update the update.

[edit: the shortened sed was good so SlackBuild updated. Thanks @bassmadrigal]

chris

timsoft 04-06-2021 05:48 AM

many thanks chris.willing and bassmadrigal for solving the problem and adding the ffmpeg4 support to the Blender slackbuild.


All times are GMT -5. The time now is 05:16 AM.