Vargol / ffmpeg-apple-arm64-build

Build script for ffmpeg targeting the latest open source video codecs running on macOS using Apple's M1 processor.
235 stars 42 forks source link

MacBook Pro M1 Max - error compiling FFmpeg - libpng16.dylib arm64 but attempting to link with file built for macOS-x86_64 #12

Closed DJRMPY closed 1 year ago

DJRMPY commented 1 year ago

warning: ignoring file /usr/local/lib/libpng16.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64

ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [ffmpeg_g] Error 1 rm libavfilter/metal/vf_yadif_videotoolbox.metal.air libavfilter/metal/vf_yadif_videotoolbox.metallib libavfilter/metal/vf_yadif_videotoolbox.metallib.c check failed: build of ffmpeg failed

Vargol commented 1 year ago

I'n not getting the same error but a different one but it seems that either libass have changed the png decency or libpng have changed their file naming so that the ffmpeg check for libass fails as libpng16.a has not been created.

I suspect for you as the linker doesn't find libpng16.a in /tool/lib and continues searching and finds an old x86 version elsewhere in the search path where as for me there is no other version so mine fails with no library found for -lpng16 instead

a quick fix for this would to create a link and build using the skip option so it doesn't rebuild everything (assuming to haven't deleted the build directory)

cd tool/lib 
ln -s png16.a libpng16.a
cd ../..
rm -rf ffmpeg
../ffmpeg-apple-arm64-build/build.sh skip

While I've been typing this a quick test of the above fix has finished compiling, so now I need to add the linking into the libpng build script and build from scratch again.

Vargol commented 1 year ago

okay I've now committed the change the repo's master branch to fix the issue I had, can you see if that fixes your issue too.

https://github.com/Vargol/ffmpeg-apple-arm64-build/commit/ee3a71aaa66759fafa62cf3afeb985673391b1e2

DJRMPY commented 1 year ago

I have an encode going on in the background so this may take a bit, but I'll post back shortly.

DJRMPY commented 1 year ago

This is odd. I'm getting a failure on libass now. It looks like it's failing to simply create teh subfolders? The permissions on the folder are correct.

100 361k 100 361k 0 0 662k 0 --:--:-- --:--:-- --:--:-- 662k

Vargol commented 1 year ago

I'll need libass/libass-0.15.1/config.log to check what that issue is.

DJRMPY commented 1 year ago

See attached. config.log

Vargol commented 1 year ago

look in ffmpeg-apple-arm64-build/build/build-libass.sh for this section

  # prepare build
  LDFLAGS="-L$3/lib -lc++ -lpng -lbz2 -lz -lbrotlidec -lbrotlicommon"  ./configure --prefix="$3" --enable-static --disable-shared --disable-fontconfig --disable-dependency-tracking
  checkStatus $? "configuration of ${SOFTWARE} failed"

it seems you've may have an old build-libass.sh that has -lbrotlidec-static -lbrotlicommon-static in the LD_FLAGS. If so how did you download the script ?

DJRMPY commented 1 year ago

I do see that in the build script.

LDFLAGS="-L$3/lib -lc++ -lpng -lbz2 -lz -lbrotlidec-static -lbrotlicommon-static" ./configure --prefix="$3" --enable-static --disable-shared --disable-fontconfig --disable-dependency-tracking checkStatus $? "configuration of ${SOFTWARE} failed"

I just downloaded this from the "Code" section, and then clicked 'Latest' and then downloaded source.

https://github.com/Vargol/ffmpeg-apple-arm64-build/archive/refs/tags/2.5.zip

Vargol commented 1 year ago

okay the 2.5 you've just linked is brand new as in 1 minute after my previous reply, so it would have been 2.0 when you last downloaded. 2.5 should have the latest fixes in but I haven't tested it yet as I'm working on a standard M1 so the build hasn't finished :-)

DJRMPY commented 1 year ago

Lol. Point taken. I’ll wait a bit and download it again and start with a new folder.

Vargol commented 1 year ago

okay, so thats random, the testing failed as this time the png build actually built libpng16.a ???

DJRMPY commented 1 year ago

Running the 2.5 download now to see what I get. I verified the downloaded zip is actually 2.5. I'll post the results shortly.

Vargol commented 1 year ago

Ah, they've backed out a change, I guessing it broke more than my build, give me a minute and I'll knock up release 2.5.1

Vargol commented 1 year ago

I'll see what you get first before I check it in

DJRMPY commented 1 year ago

Mine failed in libpng16.a

Install the project... -- Install configuration: "" -- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng16.a -- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng.a -- Installing: /Users/Ron/desktop/tmp/tool/include/png.h -- Installing: /Users/Ron/desktop/tmp/tool/include/pngconf.h -- Installing: /Users/Ron/desktop/tmp/tool/include/pnglibconf.h -- Installing: /Users/Ron/desktop/tmp/tool/include/libpng16/png.h -- Installing: /Users/Ron/desktop/tmp/tool/include/libpng16/pngconf.h -- Installing: /Users/Ron/desktop/tmp/tool/include/libpng16/pnglibconf.h -- Installing: /Users/Ron/desktop/tmp/tool/bin/libpng-config -- Installing: /Users/Ron/desktop/tmp/tool/bin/libpng16-config -- Installing: /Users/Ron/desktop/tmp/tool/share/man/man3/libpng.3 -- Installing: /Users/Ron/desktop/tmp/tool/share/man/man3/libpngpf.3 -- Installing: /Users/Ron/desktop/tmp/tool/share/man/man5/png.5 -- Installing: /Users/Ron/desktop/tmp/tool/lib/pkgconfig/libpng.pc -- Up-to-date: /Users/Ron/desktop/tmp/tool/bin/libpng-config -- Installing: /Users/Ron/desktop/tmp/tool/lib/pkgconfig/libpng16.pc -- Up-to-date: /Users/Ron/desktop/tmp/tool/bin/libpng16-config -- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng/libpng16.cmake -- Installing: /Users/Ron/desktop/tmp/tool/lib/libpng/libpng16-noconfig.cmake ln: /Users/Ron/desktop/tmp/tool/lib/libpng16.a: File exists check failed: linking libpng16.a failed

Vargol commented 1 year ago

Yep..matches what I got, I'm compiling with original fix removed

Vargol commented 1 year ago

Okay 2.5.1 released and tested to "works for me" level :-)

DJRMPY commented 1 year ago

Executed successfully here too. Excellent :)

DJRMPY commented 1 year ago

Thank you for getting this resolved. A very timely fix as my fallback encode was not handling 10-0bit color properly for some reason on a handful of encodes.

I wanted to ask, is there a way to increase the audio gain when down mixing 7.1 audio or 5.1 audio into 2 channel or 2.1 channel audio? You tend to lose volume. I was looking through the settings but didn’t find an option to do that.

I do see the audio peak nomalization, but wasn’t sure if that would normalize the audio before down mixing or after.

On the AAC Stereo Coding Method under advanced, it always defaults to Disabled, but I wasn’t sure what each option does ( “disable mid/side coding” and “force Mid/Side for whole frame”).

Last the FFmpeg AAC encoder method offers some options “Two loop searching (TLS) method” is the default, but there are no help pop-ups as to the advantages or disadvantages of each. Are those documented somewhere?

Thanks!

On Feb 8, 2023, at 4:12 AM, Vargol @.***> wrote:

Closed #12 https://github.com/Vargol/ffmpeg-apple-arm64-build/issues/12 as completed.

— Reply to this email directly, view it on GitHub https://github.com/Vargol/ffmpeg-apple-arm64-build/issues/12#event-8467044881, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5WF7OOATJ3ISSEQBXMBBXTWWNWP3ANCNFSM6AAAAAAUSEK7OI. You are receiving this because you authored the thread.

Vargol commented 1 year ago

I don't really do much audio stuff, other than -c:a copy

Maybe this will help

https://www.reddit.com/r/ffmpeg/comments/s7scqu/audio_loudness_after_downmixing_from_51_to_stereo/

DJRMPY commented 1 year ago

How would I apply this only to the first audio track? Enable the encoding options and put it directly in the command line pipeline?

-af "lowpass=c=LFE:f=120,volume=1.6,pan=stereo|FL=0.5FC+0.707FL+0.707BL+0.5LFE|FR=0.5FC+0.707FR+0.707BR+0.5LFE"

On Feb 13, 2023, at 7:44 AM, Vargol @.***> wrote:

I don't really do much audio stuff, other than -c:a copy

Maybe this will help

https://www.reddit.com/r/ffmpeg/comments/s7scqu/audio_loudness_after_downmixing_from_51_to_stereo/

— Reply to this email directly, view it on GitHub https://github.com/Vargol/ffmpeg-apple-arm64-build/issues/12#issuecomment-1427965869, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5WF7OMNITLAV6ASKGVHDNTWXI3EDANCNFSM6AAAAAAUSEK7OI. You are receiving this because you authored the thread.

Vargol commented 1 year ago

I think you start the -af argument with [0:a:0 ] (Video 0, audio track 0, yes ffmpeg indexing starts at 0 :-) )

"[0:a:0]lowpass=c=LF....