Open cdavidyoung opened 2 years ago
I have had some partial success. I was using Laerdal.FFmpeg.Full.Gpl but I uninstalled it and installed Laerdal.FFmpeg.Audio instead. It works now on iOS!
I am initially doing audio conversions but soon I will want to convert images to video clips of the same length as the associated audio clips. I assume I'll just add Laerdal.FFmpeg.Video but I'll cross that bridge when I get there.
If you have any suggestions I would appreciate it!
I tried installing Laerdal.FFmpeg.Video along with Laerdal.FFmpeg.Audio but now the acodec libmp3lame is not found. How does installing Laerdal.FFmpeg.Video cause libmp3lame to not be available?
So I tried uninstalling both of those and installing Laerdal.FFmpeg.Full. Once again that works great on Android but gives the same error on iOS.
So how do I get Laerdal.FFmpeg.Video to work with Laerdal.FFmpeg.Audio? Is there another acodec I should be using instead of libmp3lame that would allow me to use the video conversion as well?
Eventually I want to be able to covert a jpg image into a video clip and add audio something like this:
ffmpeg -loop 1 -i img.jpg -i audio.wav -c:v libx264 -c:a aac -b:a 192k -shortest out.mp4
When I try to build for iOS using anything but Laerdal.FFmpeg.Audio the build output has error messages of the form
error MT5210: Native linking failed, undefined symbol: _Web*
Note that I have tried the advice "Add
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error : warning: '/Users/charlesyoung/Library/Caches/Xamarin/mtbs/builds/BLE.Client.iOS/c66023cfc8392fbe6ddc30e522a370539837b5d9302c9e7933efd539cda57fd1/obj/iPhone/Debug/device-builds/iphone13.3-15.5/mtouch-cache/arm64/Xamarin.iOS.dll.o' was built with class_ro_t pointer signing enabled, but previous .o files were not 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPAnimEncoderAdd. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPAnimEncoderAssemble. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPAnimEncoderDelete. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPAnimEncoderNewInternal. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPAnimEncoderOptionsInitInternal. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPCleanupTransparentArea. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPConfigInitInternal. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPEncode. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPMemoryWrite. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPMemoryWriterClear. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPMemoryWriterInit. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPPictureFree. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPPictureInitInternal. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5210: Native linking failed, undefined symbol: _WebPValidateConfig. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): warning MT5215: References to 'System.Net.Security' might require additional -framework=XXX or -lXXX instructions to the native linker 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): warning MT5215: References to 'dl' might require additional -framework=XXX or -lXXX instructions to the native linker 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): warning MT5215: References to 'kernel32' might require additional -framework=XXX or -lXXX instructions to the native linker 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): warning MT5215: References to 'kernel32' might require additional -framework=XXX or -lXXX instructions to the native linker 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error MT5202: Native linking failed. Please review the build log. 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): warning : '/Users/charlesyoung/Library/Caches/Xamarin/mtbs/builds/BLE.Client.iOS/c66023cfc8392fbe6ddc30e522a370539837b5d9302c9e7933efd539cda57fd1/obj/iPhone/Debug/device-builds/iphone13.3-15.5/mtouch-cache/arm64/Xamarin.iOS.dll.o' was built with class_ro_t pointer signing enabled, but previous .o files were not 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(254,3): error : linker command failed with exit code 1 (use -v to see invocation) ========== Build: 0 succeeded, 1 failed, 5 up-to-date, 0 skipped ==========
I need to throw in the towel on this one. The only thing that I have been able to get to work on both Android and iOS is the Laerdal.FFmpeg.Audio. Everything else gives me the linking errors on iOS.
So for now I can covert wav to mp3 and that is better than nothing.
rc = FFmpeg.Execute($"-i {file} {mp3File}");
On Android (using Laerdal.FFmpeg.Full) I can also convert my images and their associated audio to mp4 clips.
rc = FFmpeg.Execute($"-loop 1 -i {jpgFile} -i {wavFile} -c:a aac -shortest {mp4File}");
However, until I can get this working on both platforms I'll have to leave it out of the production code.
Looks like the Laerdal.FFmpeg.Min.GPL v 4.4.27 on nuget compiles on IOS and Android. Did not have luck with any of the FULL versions (getting the missing libWebP linking.
Laerdal.FFmpeg.Audio initially worked for both Android and iOS on Xamarin. On Maui it stopped working for iOS and throws an exception "No FFmpeg assembly for shared .NET, Did you forget to add a reference in your native project too ?" Is there a reason this project could not be targeted for Maui to work on both Android and iOS?
I have done some more investigation as to why this nuget is not working for iOS with Maui. This nuget was built for Xamarin and as such its folders in ..\packages\laerdal.ffmpeg.audio\4.4.27\lib are monoandroid10.0, netstandard2.0, and xamarinios10.
When VS builds for Maui it happily finds monoandroid10.0 for Android, but for some reason does not like xamarinios10 for iOS and instead opts for netstandard2.0. The latter is implemented to throw the exception we are seeing when we try to run this with iOS.
I have spent a considerable amount of time trying to force the build to use the xamarinios10 instead of netstandard2.0 to no avail. If somebody has an idea please let me know. I think this may solve the problem.
I also looked into rebuilding the nuget without netstandard2.0 but unfortunately the source files are not packaged with the ffmpeg native libraries necessary to build. Instead it points to @tanersener's Mobile-FFmpeg, which is not maintained and looks like it is leading down a rabbit hole where I do not want to go. If someone is successful at recuperating the ffmpeg native libraries and adding them to this nuget please let me know.
I had the idea of replacing the contents of the netstandard2.0 folder with the contents of the xamarinios10 folder. Now it is giving me a different exception because it can't find Xamarin.iOS.
023-07-27 11:45:52.502 CacheAll[78421:17726415] warning: Could not load signature of Laerdal.FFmpeg.BaseFFmpegConfigImplementation:set_FFmpegLogDelegate due to: Could not load file or assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' or one of its dependencies. 2023-07-27 11:45:52.503 CacheAll[78421:17726415] trimMp3: The type initializer for 'Laerdal.FFmpeg.FFmpegConfig' threw an exception.
Oh well, I guess this nuget really needs to be rebuilt for Maui starting with recreating the native ffmpeg libraries. A possible upside to this effort would be that it might be possible to include Windows and MacCatalyst as well. I have not built a nuget from scratch yet. Does anyone want to join me in that effort?
Laerdal.FFmpeg.Audio initially worked for both Android and iOS on Xamarin. On Maui it stopped working for iOS and throws an exception "No FFmpeg assembly for shared .NET, Did you forget to add a reference in your native project too ?" Is there a reason this project could not be targeted for Maui to work on both Android and iOS?
Hi, did you finally get it working ? I got the same issue. Working fine on android, but not in iOS
No I did not get this working. Sorry. I don't know why there would be any difference between Maui and Xamarin so it seems like it should be possible.
El El mié, ene 3, 2024 a la(s) 10:37 p.m., harima34 < @.***> escribió:
Laerdal.FFmpeg.Audio initially worked for both Android and iOS on Xamarin. On Maui it stopped working for iOS and throws an exception "No FFmpeg assembly for shared .NET, Did you forget to add a reference in your native project too ?" Is there a reason this project could not be targeted for Maui to work on both Android and iOS?
Hi, did you finally get it working ? I got the same issue. Working fine on android, but not in iOS
— Reply to this email directly, view it on GitHub https://github.com/Laerdal/Laerdal.FFmpeg/issues/10#issuecomment-1876360385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHE7K6S5LI5FK6TUFXXJ73YMY52NAVCNFSM53FOCY6KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXGYZTMMBTHA2Q . You are receiving this because you authored the thread.Message ID: @.***>
Thanks for your fast answer ! You said it's working with xamarin ? Because even with xamarin isn't working for me, i didn't get error but the process of FFmpeg.Execute($"{parameters}"); seems doing nothing and i directly reach the Success without got any outpout file. You was using XamarinForm ?
I used xamarin but only the audio version of this library. I was converting to mp3 and trimming mp3. Now this just works on Android after I moved to Maui.
El El jue, ene 4, 2024 a la(s) 2:45 p.m., harima34 @.***> escribió:
Thanks for your fast answer ! You said it's working with xamarin ? Because even with xamarin isn't working for me, i didn't get error but the process of FFmpeg.Execute($"{parameters}"); seems doing nothing and i directly reach the Success without got any outpout file. You was using XamarinForm ?
— Reply to this email directly, view it on GitHub https://github.com/Laerdal/Laerdal.FFmpeg/issues/10#issuecomment-1877802657, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHE7K764UQPL2MPNLUQWSDYM4PIBAVCNFSM53FOCY6KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBXG44DAMRWGU3Q . You are receiving this because you authored the thread.Message ID: @.***>
I see thanks for your reply. On android i got issue, when ffmpeg finish to transcode, the app crash, did this happen to you ?
I can't remember exactly. I do remember that I could not get the video to work on either mobile platform where I was trying to add audio to a still image. I finally gave up and used just the audio version of Laerdal.FFmpeg on Android to convert from wav to mp3.
I have Windows and Mac versions of my app where I do the heavy video and audio processing and use another FFmpeg library. If you are interested you can check out CacheAll for iPhone/Mac, Windows, and Samsung Galaxy.
On Tue, Jan 9, 2024 at 11:53 PM harima34 @.***> wrote:
I see thanks for your reply. On android i got issue, when ffmpeg finish to transcode, the app crash, did this happen to you ?
— Reply to this email directly, view it on GitHub https://github.com/Laerdal/Laerdal.FFmpeg/issues/10#issuecomment-1884287461, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHE7K4WQRKRWMKLT7374GTYNY3IPAVCNFSM53FOCY6KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBYGQZDQNZUGYYQ . You are receiving this because you authored the thread.Message ID: @.***>
Describe the bug Severity Code Description Project File Line Suppression State Error The command "/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-stdlib-tool --copy --verbose --scan-executable 'bin/iPhone/Debug/device-builds/iphone13.3-15.5/BLEClientiOS.app/' --scan-folder 'bin/iPhone/Debug/device-builds/iphone13.3-15.5/BLEClientiOS.app/Frameworks/' --scan-folder 'bin/iPhone/Debug/device-builds/iphone13.3-15.5/BLEClientiOS.app/PlugIns/' --platform 'iphoneos' --toolchain '/../../../../../Toolchains/XcodeDefault.xctoolchain/' --destination 'bin/iPhone/Debug/device-builds/iphone13.3-15.5/BLEClientiOS.app/Frameworks/' --resource-destination 'bin/iPhone/Debug/device-builds/iphone13.3-15.5/BLEClientiOS.app/' --resource-library libswiftRemoteMirror.dylib --unsigned-destination 'obj/iPhone/Debug/device-builds/iphone13.3-15.5/SwiftSupport' --strip-bitcode --strip-bitcode-tool '/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip' --emit-dependency-info 'obj/iPhone/Debug/device-builds/iphone13.3-15.5/SwiftStdLibToolInputDependencies.dep' --source-libraries '/../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-5.0/iphoneos'" exited with code 127. BLE.Client.iOS
To Reproduce Steps to reproduce the behavior:
Test with a simple mp3 conversion - this works fine on Android. It gives above error when try to build for iOS. namespace BLE.Client.ViewModels { public class FFmpegHelper { public FFmpegHelper() { }
public static string toMp3(string file) { string mp3File = $"{file}.mp3"; if (File.Exists(mp3File)) File.Delete(mp3File); FFmpegConfig.IgnoreSignal(24); // int rc = FFmpeg.Execute($"-i {file} {mp3File}"); int rc = FFmpeg.Execute($"-fflags +discardcorrupt -i {file} -vn -ar 44100 -ac 2 -b:a 192k {mp3File}"); if (rc == 0) return mp3File; else return string.Empty; } } }
Expected behavior I should not get this error which prevents the app from being deployed to iPhone 12.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.