Recherche avancée

Médias (91)

Autres articles (91)

Sur d’autres sites (14996)

  • Errors while ffmpeg compiling

    10 mai 2012, par iSun

    I trying to compile ffmpeg through the following script, but I got errors while compiling : (Using windows 7 - android ndk 7rb and cygwin)

    s@s-PC /cygdrive/f/export/ffmpeg-0.8.10
    $ ./setup.sh
    F:/Compiler/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/wind                                                                                                    ows/bin/arm-linux-androideabi-gcc is unable to create an executable file.
    C compiler test failed.

    If you think configure made a mistake, make sure you are using the latest
    version from Git.  If the latest version fails, report the problem to the
    ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
    Include the log file "config.log" produced by configure as this will help
    solving the problem.
    ./setup.sh: line 48: --extra-cflags=: command not found
    ./setup.sh: line 51: --extra-ldflags=: command not found
    ./setup.sh: line 53: --extra-ldflags=: command not found
    Makefile:1: config.mak: No such file or directory
    libavutil/Makefile:1: libavutil/../config.mak: No such file or directory
    libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
    libavutil/../subdir.mak:26: warning: ignoring old recipe for target `libavutil/'
    libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
    libavutil/../subdir.mak:96: warning: ignoring old recipe for target `libavutil/'
    Makefile:239: /tests/fate.mak: No such file or directory
    Makefile:240: /tests/fate2.mak: No such file or directory
    Makefile:242: /tests/fate/aac.mak: No such file or directory
    Makefile:243: /tests/fate/als.mak: No such file or directory
    Makefile:244: /tests/fate/fft.mak: No such file or directory
    Makefile:245: /tests/fate/h264.mak: No such file or directory
    Makefile:246: /tests/fate/mp3.mak: No such file or directory
    Makefile:247: /tests/fate/vorbis.mak: No such file or directory
    Makefile:248: /tests/fate/vp8.mak: No such file or directory
    make: *** No rule to make target `/tests/fate/vp8.mak'.  Stop.
    Makefile:1: config.mak: No such file or directory
    libavutil/Makefile:1: libavutil/../config.mak: No such file or directory
    libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
    libavutil/../subdir.mak:26: warning: ignoring old recipe for target `libavutil/'
    libavutil/../subdir.mak:96: warning: overriding recipe for target `libavutil/'
    libavutil/../subdir.mak:96: warning: ignoring old recipe for target `libavutil/'
    Makefile:239: /tests/fate.mak: No such file or directory
    Makefile:240: /tests/fate2.mak: No such file or directory
    Makefile:242: /tests/fate/aac.mak: No such file or directory
    Makefile:243: /tests/fate/als.mak: No such file or directory
    Makefile:244: /tests/fate/fft.mak: No such file or directory
    Makefile:245: /tests/fate/h264.mak: No such file or directory
    Makefile:246: /tests/fate/mp3.mak: No such file or directory
    Makefile:247: /tests/fate/vorbis.mak: No such file or directory
    Makefile:248: /tests/fate/vp8.mak: No such file or directory
    make: *** No rule to make target `/tests/fate/vp8.mak'.  Stop.

    Here is my script :

       #!/bin/bash

       export TMPDIR=C:/cygwin/tmp

       ANDROID_API=android-8
       export ANDROID_NDK=F:/Compiler/android-ndk-r7b
       export ANDROID_SDK=F:/Compiler/android-sdk
       SYSROOT=$ANDROID_NDK/platforms/$ANDROID_API/arch-arm
       ANDROID_BIN=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin
       CROSS_COMPILE=${ANDROID_BIN}/arm-linux-androideabi-
       export PATH=$PATH:$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools

       export ARM_ROOT=$ANDROID_NDK
       export ARM_INC=$ARM_ROOT/platforms/android-5/arch-arm/usr/include
       export ARM_LIB=$ARM_ROOT/platforms/android-5/arch-arm/usr/lib
       export LIB_INC=${HOME}/include
       export LIB_LIB=${HOME}/lib


       CFLAGS=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID  -Wa,--noexecstack -MMD -MP "
       LDFLAGS=" -nostdlib -Bdynamic  -Wl,--no-undefined -Wl,-z,noexecstack  -Wl,-z,nocopyreloc -Wl,-soname,/system/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -nostdlib $ARM_LIB/crtbegin_dynamic.o $ARM_LIB/crtend_android.o -lc -lm -ldl -lgcc "

       FLAGS="--target-os=linux
       --enable-cross-compile
       --cross-prefix=$CROSS_COMPILE
       --arch=arm --prefix=$HOME
       --disable-shared
       --enable-static
       --extra-libs=-static
       --extra-cflags=--static
       --enable-small
       --disable-asm
       --disable-yasm
       --disable-amd3dnow
       --disable-amd3dnowext
       --disable-mmx
       --disable-mmx2
       --disable-sse
       --disable-ssse3
       --disable-indevs"


       export CFLAGS=$EXTRA_CFLAGS
       export LDFLAGS=$EXTRA_LDFLAGS


    ./configure $FLAGS
    --extra-cflags="$CFLAGS"
    --extra-ldflags="$LDFLAGS" \
    --cc="${CROSS_COMPILE}gcc
    --sysroot=${SYSROOT}"
    --extra-ldflags="$LDFLAGS" \
    --cxx="${CROSS_COMPILE}g++ --sysroot=${SYSROOT}" \
    --nm="${CROSS_COMPILE}nm" \
    --ar="${CROSS_COMPILE}ar"


    make clean
    make -j4 || exit 1
    make install || exit 1

    Any ideas ?

  • FFmpeg Video Overlay Function Not Working (Flutter)

    30 août 2022, par Dennis Ashford

    I am simply trying to get a watermarked video from the Flutter FFmpeg package and cannot seem to get it to work. For right now, I am downloading the video from Firebase, storing it in cache, overlaying a watermark image using the Flutter FFmpeg Kit package. The original video file, image file, and output file are being created properly. However, the overlay function is not working properly. Can someone help me with the FFmpegKit.execute function string ? I am not seeing any obvious errors in the function, but it isn't working properly. I tried writing as a new File and asBytes but neither worked.

    


    Edit : I want to take the originalVideo and overlay it with the watermark image with the expected outcome being a new file that contains the new overlayed video. Not concerned with where the overlay is yet.

    


    Pubspec.yaml

    


    ffmpeg_kit_flutter: ^4.5.1


    


    The function is :

    


    import &#x27;package:ffmpeg_kit_flutter/ffmpeg_kit.dart&#x27;;&#xA;&#xA;Future<file> waterMarkVideo(String videoPath, String watermarkPath) async {&#xA;    //these calls are to load the video into temporary directory&#xA;    final response = await http.get(Uri.parse(videoPath));&#xA;    final originalVideo = File (&#x27;${(await getTemporaryDirectory()).path}/video.mp4&#x27;);&#xA;    await originalVideo.create(recursive: true);&#xA;    await originalVideo.writeAsBytes(response.bodyBytes);&#xA;    print(&#x27;video path&#x27; &#x2B; originalVideo.path);&#xA;&#xA;    //this grabs the watermark image from assets and decodes it&#xA;    final byteData = await rootBundle.load(watermarkPath);&#xA;    final watermark = File(&#x27;${(await getTemporaryDirectory()).path}/image.png&#x27;);&#xA;    await watermark.create(recursive: true);&#xA;    await watermark.writeAsBytes(byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));&#xA;    print(&#x27;watermark path&#x27; &#x2B; watermark.path);&#xA;&#xA;    //this creates temporary directory for new watermarked video&#xA;    var tempDir = await getTemporaryDirectory();&#xA;    final newVideoPath = &#x27;${tempDir.path}/${DateTime.now().microsecondsSinceEpoch}result.mp4&#x27;;&#xA;    final videoFile = await File(newVideoPath).create();&#xA;&#xA;//overlaying video using FFmpegkit where I need some help&#xA;    await FFmpegKit.executeAsync("-i $originalVideo -i $watermark -filter_complex &#x27;overlay=(W-w)/2:(H-h)/2&#x27; $videoFile")&#xA;    .then((session) async {&#xA;      final state = FFmpegKitConfig.sessionStateToString(await session.getState());&#xA;      final returnCode = await session.getReturnCode();&#xA;      final failStackTrace = await session.getFailStackTrace();&#xA;      final output = await session.getOutput();&#xA;      print(&#x27;FFmpeg process exited with state ${state} and rs ${returnCode}.If failed ${failStackTrace}&#x27;);&#xA;      print(&#x27;Last output $output&#x27;);&#xA;    } );&#xA;    print(&#x27;new video path&#x27; &#x2B; newVideoPath);&#xA;    Uint8List videoByteData = await videoFile.readAsBytes();&#xA;    return videoFile.writeAsBytes(videoByteData);&#xA;}&#xA;</file>

    &#xA;

    The output for the function above is

    &#xA;

    flutter: video path/Users/dennisashford/Library/Developer/CoreSimulator/Devices/FBFB4D51-EC31-47DF-8FE0-66B114806EA4/data/Containers/Data/Application/0EA3BB35-D364-4B98-A104-15CDB17AAD54/Library/Caches/video.mp4&#xA;flutter: watermark path/Users/dennisashford/Library/Developer/CoreSimulator/Devices/FBFB4D51-EC31-47DF-8FE0-66B114806EA4/data/Containers/Data/Application/0EA3BB35-D364-4B98-A104-15CDB17AAD54/Library/Caches/image.png&#xA;ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;  configuration: --cross-prefix=x86_64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-x86_64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=x86_64 --cpu=x86_64 --target-os=darwin --disable-neon --disable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;clang -arch x86_64 -target x86_64-apple-ios12.1-simulator -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -O2 -mios-simulator-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-mios-simulator-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;  libavutil      57. 13.100 / 57. 13.100&#xA;  libavcodec     59. 15.102 / 59. 15.102&#xA;  libavformat    59. 10.100 / 59. 10.100&#xA;  libavdevice    59.  1.100 / 59.  1.100&#xA;  libavfilter     8. 21.100 /  8. 21.100&#xA;  libswscale      6.  1.102 /  6.  1.102&#xA;  libswresample   4.  0.100 /  4.  0.100&#xA;File:: Protocol not found&#xA;Did you mean file:File:?&#xA;flutter: FFmpeg process exited with state RUNNING and rs 1.If failed null&#xA;flutter: Last output ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;flutter:   built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;flutter:   configuration: --cross-prefix=x86_64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-x86_64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=x86_64 --cpu=x86_64 --target-os=darwin --disable-neon --disable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;clang -arch x86_64 -target x86_64-apple-ios12.1-simulator -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -O2 -mios-simulator-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-mios-simulator-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;flutter:   libavutil      57. 13.100 / 57. 13.100&#xA;flutter:   libavcodec     59. 15.102 / 59. 15.102&#xA;flutter:   libavformat    59. 10.100 / 59. 10.100&#xA;flutter:   libavdevice    59.  1.100 / 59.  1.100&#xA;flutter:   libavfilter     8. 21.100 /  8. 21.100&#xA;flutter:   libswscale      6.  1.102 /  6.  1.102&#xA;flutter:   libswresample   4.  0.100 /  4.  0.100&#xA;flutter: File:: Protocol not found&#xA;flutter: Did you mean file:File:?&#xA;flutter: &#xA;flutter: new video path/Users/dennisashford/Library/Developer/CoreSimulator/Devices/FBFB4D51-EC31-47DF-8FE0-66B114806EA4/data/Containers/Data/Application/0EA3BB35-D364-4B98-A104-15CDB17AAD54/Library/Caches/1661892011213545result.mp4&#xA;

    &#xA;

    Update : So I built the code on a physical device and was able to get a little more information for what may be the problem. The error may be coming from

    &#xA;

    File:: Protocol not found&#xA;Did you mean file:File:?&#xA;

    &#xA;

    Complete logs from the physical device are given below

    &#xA;

    flutter: video path/var/mobile/Containers/Data/Application/70EA92CD-DF5D-440E-BBE1-C130BC7F0CC7/Library/Caches/video.mp4&#xA;flutter: watermark path/var/mobile/Containers/Data/Application/70EA92CD-DF5D-440E-BBE1-C130BC7F0CC7/Library/Caches/image.png&#xA;ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;  configuration: --cross-prefix=arm64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-arm64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8 --target-os=darwin --enable-neon --enable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;/Users/taner/Projects/ffmpeg-kit/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target arm64-apple-ios12.1 -march=armv8-a&#x2B;crc&#x2B;crypto -mcpu=generic -DFFMPEG_KIT_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -fembed-bitcode -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk -Oz -miphoneos-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-miphoneos-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;  libavutil      57. 13.100 / 57. 13.100&#xA;  libavcodec     59. 15.102 / 59. 15.102&#xA;  libavformat    59. 10.100 / 59. 10.100&#xA;  libavdevice    59.  1.100 / 59.  1.100&#xA;  libavfilter     8. 21.100 /  8. 21.100&#xA;  libswscale      6.  1.102 /  6.  1.102&#xA;  libswresample   4.  0.100 /  4.  0.100&#xA;File:: Protocol not found&#xA;Did you mean file:File:?&#xA;flutter: FFmpeg process exited with state RUNNING and rs 1.If failed null&#xA;flutter: Last output ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;  configuration: --cross-prefix=arm64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-arm64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8 --target-os=darwin --enable-neon --enable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;/Users/taner/Projects/ffmpeg-kit/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target arm64-apple-ios12.1 -march=armv8-a&#x2B;crc&#x2B;crypto -mcpu=generic -DFFMPEG_KIT_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -fembed-bitcode -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk -Oz -miphoneos-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-miphoneos-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;  libavutil      57. 13.100 / 57. 13.100&#xA;  libavcodec     59. 15.102 / 59. 15.102&#xA;  libavformat    59. 10.100 / 59. 10.100&#xA;  libavdevice    59.  1.100 / 59.  1.100&#xA;  libavfilter     8. 21.100 /  8. 21.100&#xA;  libswscale      6.  1.102 /  6.  1.102&#xA;  libswresample   4.  0.100 /  4.  0.100&#xA;File:: Protocol not found&#xA;Did you mean file:File:?&#xA;flutter: new video path/var/mobile/Containers/Data/Application/70EA92CD-DF5D-440E-BBE1-C130BC7F0CC7/Library/Caches/1661891272856433result.mp4&#xA;

    &#xA;

    Update #2 after a lot of help from @kesh below, this function was actually able to overlay the image on the video.

    &#xA;

    await FFmpegKit.executeAsync(&#x27;-i $videoPath -i ${watermark.path} -filter_complex "overlay=10:10" -y ${videoFile.path}&#x27;)&#xA;

    &#xA;

  • FFmpeg video overlay function not working

    5 novembre 2022, par Dennis Ashford

    I am simply trying to get a watermarked video from the Flutter FFmpeg package and cannot seem to get it to work. Right now, I am downloading the video from Firebase, storing it in cache, overlaying a watermark image using the Flutter FFmpeg Kit package. The original video file, image file, and output file are being created properly.

    &#xA;

    However, the overlay function is not working properly. How can I use the FFmpegKit.execute function string ? I am not seeing any obvious errors in the function, but it isn't working properly. I tried writing as a new File and asBytes but neither worked.

    &#xA;

    Edit : I want to take the originalVideo and overlay it with the watermark image with the expected outcome being a new file that contains the new overlayed video. Not concerned with where the overlay is yet.

    &#xA;

    Pubspec.yaml

    &#xA;

    ffmpeg_kit_flutter: ^4.5.1&#xA;

    &#xA;

    The function is :

    &#xA;

    import &#x27;package:ffmpeg_kit_flutter/ffmpeg_kit.dart&#x27;;&#xA;&#xA;Future<file> waterMarkVideo(String videoPath, String watermarkPath) async {&#xA;    //these calls are to load the video into temporary directory&#xA;    final response = await http.get(Uri.parse(videoPath));&#xA;    final originalVideo = File (&#x27;${(await getTemporaryDirectory()).path}/video.mp4&#x27;);&#xA;    await originalVideo.create(recursive: true);&#xA;    await originalVideo.writeAsBytes(response.bodyBytes);&#xA;    print(&#x27;video path&#x27; &#x2B; originalVideo.path);&#xA;&#xA;    //this grabs the watermark image from assets and decodes it&#xA;    final byteData = await rootBundle.load(watermarkPath);&#xA;    final watermark = File(&#x27;${(await getTemporaryDirectory()).path}/image.png&#x27;);&#xA;    await watermark.create(recursive: true);&#xA;    await watermark.writeAsBytes(byteData.buffer.asUint8List(byteData.offsetInBytes, byteData.lengthInBytes));&#xA;    print(&#x27;watermark path&#x27; &#x2B; watermark.path);&#xA;&#xA;    //this creates temporary directory for new watermarked video&#xA;    var tempDir = await getTemporaryDirectory();&#xA;    final newVideoPath = &#x27;${tempDir.path}/${DateTime.now().microsecondsSinceEpoch}result.mp4&#x27;;&#xA;    final videoFile = await File(newVideoPath).create();&#xA;&#xA;//overlaying video using FFmpegkit where I need some help&#xA;    await FFmpegKit.executeAsync("-i $originalVideo -i $watermark -filter_complex &#x27;overlay=(W-w)/2:(H-h)/2&#x27; $videoFile")&#xA;    .then((session) async {&#xA;      final state = FFmpegKitConfig.sessionStateToString(await session.getState());&#xA;      final returnCode = await session.getReturnCode();&#xA;      final failStackTrace = await session.getFailStackTrace();&#xA;      final output = await session.getOutput();&#xA;      print(&#x27;FFmpeg process exited with state ${state} and rs ${returnCode}.If failed ${failStackTrace}&#x27;);&#xA;      print(&#x27;Last output $output&#x27;);&#xA;    } );&#xA;    print(&#x27;new video path&#x27; &#x2B; newVideoPath);&#xA;    Uint8List videoByteData = await videoFile.readAsBytes();&#xA;    return videoFile.writeAsBytes(videoByteData);&#xA;}&#xA;</file>

    &#xA;

    The output for the function above is

    &#xA;

    flutter: video path/Users/dennisashford/Library/Developer/CoreSimulator/Devices/FBFB4D51-EC31-47DF-8FE0-66B114806EA4/data/Containers/Data/Application/0EA3BB35-D364-4B98-A104-15CDB17AAD54/Library/Caches/video.mp4&#xA;flutter: watermark path/Users/dennisashford/Library/Developer/CoreSimulator/Devices/FBFB4D51-EC31-47DF-8FE0-66B114806EA4/data/Containers/Data/Application/0EA3BB35-D364-4B98-A104-15CDB17AAD54/Library/Caches/image.png&#xA;ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;  configuration: --cross-prefix=x86_64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-x86_64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=x86_64 --cpu=x86_64 --target-os=darwin --disable-neon --disable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;clang -arch x86_64 -target x86_64-apple-ios12.1-simulator -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -O2 -mios-simulator-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-mios-simulator-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;  libavutil      57. 13.100 / 57. 13.100&#xA;  libavcodec     59. 15.102 / 59. 15.102&#xA;  libavformat    59. 10.100 / 59. 10.100&#xA;  libavdevice    59.  1.100 / 59.  1.100&#xA;  libavfilter     8. 21.100 /  8. 21.100&#xA;  libswscale      6.  1.102 /  6.  1.102&#xA;  libswresample   4.  0.100 /  4.  0.100&#xA;File:: Protocol not found&#xA;Did you mean file:File:?&#xA;flutter: FFmpeg process exited with state RUNNING and rs 1.If failed null&#xA;flutter: Last output ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;flutter:   built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;flutter:   configuration: --cross-prefix=x86_64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-x86_64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=x86_64 --cpu=x86_64 --target-os=darwin --disable-neon --disable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;clang -arch x86_64 -target x86_64-apple-ios12.1-simulator -march=x86-64 -msse4.2 -mpopcnt -m64 -DFFMPEG_KIT_X86_64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk -O2 -mios-simulator-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-mios-simulator-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;flutter:   libavutil      57. 13.100 / 57. 13.100&#xA;flutter:   libavcodec     59. 15.102 / 59. 15.102&#xA;flutter:   libavformat    59. 10.100 / 59. 10.100&#xA;flutter:   libavdevice    59.  1.100 / 59.  1.100&#xA;flutter:   libavfilter     8. 21.100 /  8. 21.100&#xA;flutter:   libswscale      6.  1.102 /  6.  1.102&#xA;flutter:   libswresample   4.  0.100 /  4.  0.100&#xA;flutter: File:: Protocol not found&#xA;flutter: Did you mean file:File:?&#xA;flutter: &#xA;flutter: new video path/Users/dennisashford/Library/Developer/CoreSimulator/Devices/FBFB4D51-EC31-47DF-8FE0-66B114806EA4/data/Containers/Data/Application/0EA3BB35-D364-4B98-A104-15CDB17AAD54/Library/Caches/1661892011213545result.mp4&#xA;

    &#xA;

    Update : So I built the code on a physical device and was able to get a little more information for what may be the problem. The error may be coming from

    &#xA;

    File:: Protocol not found&#xA;Did you mean file:File:?&#xA;

    &#xA;

    Complete logs from the physical device are given below

    &#xA;

    flutter: video path/var/mobile/Containers/Data/Application/70EA92CD-DF5D-440E-BBE1-C130BC7F0CC7/Library/Caches/video.mp4&#xA;flutter: watermark path/var/mobile/Containers/Data/Application/70EA92CD-DF5D-440E-BBE1-C130BC7F0CC7/Library/Caches/image.png&#xA;ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;  configuration: --cross-prefix=arm64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-arm64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8 --target-os=darwin --enable-neon --enable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;/Users/taner/Projects/ffmpeg-kit/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target arm64-apple-ios12.1 -march=armv8-a&#x2B;crc&#x2B;crypto -mcpu=generic -DFFMPEG_KIT_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -fembed-bitcode -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk -Oz -miphoneos-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-miphoneos-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;  libavutil      57. 13.100 / 57. 13.100&#xA;  libavcodec     59. 15.102 / 59. 15.102&#xA;  libavformat    59. 10.100 / 59. 10.100&#xA;  libavdevice    59.  1.100 / 59.  1.100&#xA;  libavfilter     8. 21.100 /  8. 21.100&#xA;  libswscale      6.  1.102 /  6.  1.102&#xA;  libswresample   4.  0.100 /  4.  0.100&#xA;File:: Protocol not found&#xA;Did you mean file:File:?&#xA;flutter: FFmpeg process exited with state RUNNING and rs 1.If failed null&#xA;flutter: Last output ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers&#xA;  built with Apple clang version 13.0.0 (clang-1300.0.29.30)&#xA;  configuration: --cross-prefix=arm64-ios-darwin- --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-ios-arm64/ffmpeg --pkg-config=/opt/homebrew/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8 --target-os=darwin --enable-neon --enable-asm --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang&#x2B;&#x2B; --as=&#x27;/Users/taner/Projects/ffmpeg-kit/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target arm64-apple-ios12.1 -march=armv8-a&#x2B;crc&#x2B;crypto -mcpu=generic -DFFMPEG_KIT_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -fembed-bitcode -DIOS -DFFMPEG_KIT_BUILD_DATE=20220114 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk -Oz -miphoneos-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk/usr/include&#x27; --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags=&#x27;-miphoneos-version-min=12.1&#x27; --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir=&#x27;@rpath&#x27; --enable-pthreads --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --disable-outdev=audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --disable-coreimage --disable-appkit --disable-opencl --disable-opengl&#xA;  libavutil      57. 13.100 / 57. 13.100&#xA;  libavcodec     59. 15.102 / 59. 15.102&#xA;  libavformat    59. 10.100 / 59. 10.100&#xA;  libavdevice    59.  1.100 / 59.  1.100&#xA;  libavfilter     8. 21.100 /  8. 21.100&#xA;  libswscale      6.  1.102 /  6.  1.102&#xA;  libswresample   4.  0.100 /  4.  0.100&#xA;File:: Protocol not found&#xA;Did you mean file:File:?&#xA;flutter: new video path/var/mobile/Containers/Data/Application/70EA92CD-DF5D-440E-BBE1-C130BC7F0CC7/Library/Caches/1661891272856433result.mp4&#xA;

    &#xA;

    Update #2 after a lot of help from @kesh below, this function was actually able to overlay the image on the video.

    &#xA;

    await FFmpegKit.executeAsync(&#x27;-i $videoPath -i ${watermark.path} -filter_complex "overlay=10:10" -y ${videoFile.path}&#x27;)&#xA;

    &#xA;