Git Product home page Git Product logo

ffmpeg_helper's People

Contributors

abhay-s-rawat avatar giacathuy avatar jcarvalho-ptech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ffmpeg_helper's Issues

parse Statistics causes a crash

current code

process.stdout.transform(utf8.decoder).listen((String event) {
      print("stdout: $event");
      List<String> data = event.split("\n");
      for (String element in data) {
        List<String> kv = element.split("=");
        Map<String, dynamic> temp = {};
        if (kv.length == 2) {
          temp[kv.first] = kv.last;
        }
        if (temp.isNotEmpty) {
          try {
            print('try');
            statisticsCallback?.call(Statistics(
              process.pid,
              int.parse(temp['frame']),
              double.parse(temp['fps']),
              double.parse(temp['stream_0_0_q']),
              int.parse(temp['total_size']),
              int.parse(temp['out_time_ms']),
              double.parse(temp['bitrate']),
              double.parse(temp['speed']),
            ));
          } catch (e) {
            print(e);
          }
        }
      }
    });

console log



flutter: stdout: frame=420
fps=229.65
stream_0_0_q=-1.0
bitrate= 443.2kbits/s
total_size=387241
out_time_us=6989206
out_time_ms=6989206
out_time=00:00:06.989206
dup_frames=0
drop_frames=0
speed=3.82x
progress=end

flutter: try
flutter: type 'Null' is not a subtype of type 'String'
flutter: try
flutter: type 'Null' is not a subtype of type 'String'
flutter: try
flutter: type 'Null' is not a subtype of type 'String'
flutter: try
flutter: type 'Null' is not a subtype of type 'String'
flutter: try

so statisticsCallback not called

solution: use int/double.tryParse and put default value if it is null.
I am going to make a pull request to fix it. maybe default value will be 0 or 0.0

/Volumes/Macintosh: No such file or directory

I am trying to implement your ffmpeg plugin and reduce video size but I am getting a path error. Here is my code and the output.

static Future<File?> reduceVideoSize(
    File file,
  ) async {
    final Directory appDocumentsDir = await getApplicationDocumentsDirectory();
    final FFMpegCommand cliCommand = FFMpegCommand(
      inputs: [
        FFMpegInput.asset(file.path),
      ],
      args: [
        const LogLevelArgument(LogLevel.info),
      ],
      filterGraph: FilterGraph(
        chains: [
          FilterChain(
            inputs: [],
            filters: [
              RawFilter(
                "ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4",
              ),
            ],
            outputs: [],
          ),
        ],
      ),
      outputFilepath: "${appDocumentsDir.path}ffmpegtest.mp4",
    );

    File? outputFile = await ffmpeg.runSync(
      cliCommand,
      statisticsCallback: (Statistics statistics) {
        debugPrint('bitrate: ${statistics.getBitrate()}');
      },
    );

    return outputFile;
  }
configuration: --cross-prefix=arm64-apple-darwin- --sysroot=/Applications/Xcode-v13.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk --prefix=/Users/taner/Projects/ffmpeg-kit/prebuilt/apple-macos-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-v13.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang++ --as='/Users/taner/Projects/ffmpeg-kit/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target arm64-apple-macos10.15 -march=armv8-a+crc+crypto -mcpu=generic -DFFMPEG_KIT_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -DMACOSX -DFFMPEG_KIT_BUILD_DATE=20220929 -isysroot /Applications/Xcode-v13.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -Oz -mmacosx-version-min=10.15 -I/Applications/Xcode-v13.4.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include' --ranlib=/Applications/Xcode-v13.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode-v13.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --nm=/Applications/Xcode-v13.4.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm --extra-ldflags='-mmacosx-version-min=10.15' --disable-autodetect --enable-cross-compile --enable-pic --enable-inline-asm --enable-optimizations --enable-swscale --enable-shared --disable-static --install-name-dir='@rpath' --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-libx264 --enable-libxvid --enable-libx265 --enable-libvidstab --disable-sdl2 --disable-openssl --enable-zlib --enable-audiotoolbox --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv --enable-coreimage --enable-appkit --enable-opencl --enable-opengl --enable-gpl
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
/Volumes/Macintosh: No such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.