Describe the bug
Cannot use plugin_ffmpeg
when exporting a video on macOS even whenplugin_ffmpeg.dylib
exists at nanoem.app/Contents/PlugIns
.
To Reproduce
- Open nanoem.app
- Select "動画" menu via "ファイル→書き出し→動画"
- See available plugin list
Expected behavior
plugin_ffmpeg
appears in plugin list at step 3.
Screenshots
Desktop (please complete the following information):
- OS: macOS 13.0.1
- Hardware: Macbook Air M1, 2020
- Version: nanoem.app 34.8.1
Additional context
It seems that the reason is that some paths of the shared libraries which plugin_ffmpeg.dylib
depends on are incorrect:
$ cd /Applications/nanoem.app/Contents/PlugIns
$ otool -L ./plugin_ffmpeg.dylib
./plugin_ffmpeg.dylib (architecture x86_64):
@rpath/plugin_ffmpeg.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libavutil.56.dylib (compatibility version 56.0.0, current version 56.31.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libavformat.58.dylib (compatibility version 58.0.0, current version 58.29.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libavcodec.58.dylib (compatibility version 58.0.0, current version 58.54.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libswresample.3.dylib (compatibility version 3.0.0, current version 3.5.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libswscale.5.dylib (compatibility version 5.0.0, current version 5.5.100)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.255.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
./plugin_ffmpeg.dylib (architecture arm64):
@rpath/plugin_ffmpeg.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libavutil.56.dylib (compatibility version 56.0.0, current version 56.31.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libavformat.58.dylib (compatibility version 58.0.0, current version 58.29.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libavcodec.58.dylib (compatibility version 58.0.0, current version 58.54.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libswresample.3.dylib (compatibility version 3.0.0, current version 3.5.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libswscale.5.dylib (compatibility version 5.0.0, current version 5.5.100)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.255.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
Probably, for libavutil.56.dylib
, libavformat.58.dylib
, libavcodec.58.dylib
, libswresample.3.dylib
and libswscale.5.dylib
shared libraries, nanoem.app/Contents/Frameworks
directory should be their parent directory, but another directory is there.
Note that I tried a workaround that modifies these paths, and this successfully fixed this problem just for arm64:
#!/bin/bash
# Run this script at nanoem.app/Contents/PlugIns directory.
install_name_tool -change "/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libavutil.56.dylib" "@executable_path/../Frameworks/libavutil.56.dylib" ./plugin_ffmpeg.dylib
install_name_tool -change "/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libavformat.58.dylib" "@executable_path/../Frameworks/libavformat.58.dylib" ./plugin_ffmpeg.dylib
install_name_tool -change "/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libavcodec.58.dylib" "@executable_path/../Frameworks/libavcodec.58.dylib" ./plugin_ffmpeg.dylib
install_name_tool -change "/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libswresample.3.dylib" "@executable_path/../Frameworks/libswresample.3.dylib" ./plugin_ffmpeg.dylib
install_name_tool -change "/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/arm64/install-root/lib/libswscale.5.dylib" "@executable_path/../Frameworks/libswscale.5.dylib" ./plugin_ffmpeg.dylib
otool -L ./plugin_ffmpeg.dylib
result after running script:
./plugin_ffmpeg.dylib (architecture x86_64):
@rpath/plugin_ffmpeg.dylib (compatibility version 0.0.0, current version 0.0.0)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libavutil.56.dylib (compatibility version 56.0.0, current version 56.31.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libavformat.58.dylib (compatibility version 58.0.0, current version 58.29.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libavcodec.58.dylib (compatibility version 58.0.0, current version 58.54.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libswresample.3.dylib (compatibility version 3.0.0, current version 3.5.100)
/Users/hkrn/Library/Developer/build/nanoem/main/dependencies/ffmpeg/out/darwin/clang/ub/release/interm/x86_64/install-root/lib/libswscale.5.dylib (compatibility version 5.0.0, current version 5.5.100)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.255.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1953.255.0)
./plugin_ffmpeg.dylib (architecture arm64):
@rpath/plugin_ffmpeg.dylib (compatibility version 0.0.0, current version 0.0.0)
@executable_path/../Frameworks/libavutil.56.dylib (compatibility version 56.0.0, current version 56.31.100)
@executable_path/../Frameworks/libavformat.58.dylib (compatibility version 58.0.0, current version 58.29.100)
@executable_path/../Frameworks/libavcodec.58.dylib (compatibility version 58.0.0, current version 58.54.100)
@executable_path/../Frameworks/libswresample.3.dylib (compatibility version 3.0.0, current version 3.5.100)
@executable_path/../Frameworks/libswscale.5.dylib (compatibility version 5.0.0, current version 5.5.100)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1953.255.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.36.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.0.0)
plugin_ffmpeg
appeared in plugin list and a video with transparent background is successfully exported.
P.S. I report this on issue because I don't know much about dylibs and what is the proper fix. Sorry.