패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.7

export_video_frame

비디오 파일에서 이미지를 내보내기 위한 iOS 및 Android용 Flutter 플러그인입니다.

AndroidiOS
30일 다운로드
66
좋아요
41
Pub 점수
130

패키지 설치

flutter pub add export_video_frame

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Android 및 iOS 플랫폼에서 비디오 파일에서 정적 이미지를 추출할 수 있도록 해주는 플러터 플러그인입니다. 특정 타임스탬프에서 프레임을 캡처할 수 있는 간단한 API를 제공하여 썸네일 또는 미리보기 생성에 유용합니다. 멀티미디어 애플리케이션에 원활하게 통합되도록 설계되었으며, 최소한의 설정으로 네이티브 비디오 처리를 지원합니다. 플랫폼별 기능을 활용하여 다양한 디바이스에서 높은 성능과 호환성을 보장합니다.

사용 사례

  • 비디오 썸네일 생성
  • 미리보기 이미지 만들기
  • 분석을 위한 프레임 추출
  • 비디오 편집 도구 구축
  • 비디오 스냅샷 표시

주요 기능

  • 크로스 플랫폼 지원 (iOS 및 안드로이드)
  • 지정된 타임스탬프에서 프레임 추출
  • 간단한 API 통합
  • 고성능 렌더링
  • 네이티브 비디오 처리

적합한 대상

  • 비디오 앱 개발자
  • 미디어 콘텐츠 창작자
  • 섬네일 생성 도구
  • 비디오 분석 기능이 있는 교육용 앱
  • 프레임 단위 비디오 검사를 필요로 하는 앱

고려 사항

  • 플랫폼별 권한이 필요합니다
  • 이미지 내보내기만 가능(비디오 편집 불가)
  • 성능은 장치 하드웨어에 따라 다릅니다
  • 큰 비디오에서는 메모리 제약이 있을 수 있습니다
  • 내장된 UI 컴포넌트 제공 없음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Export Video frame for Flutter

A Flutter plugin for iOS and Android for exporting picture from video file.

Installation

add export_video_frame as a dependency in your pubspec.yaml file.

Usage


/// Returns whether clean success
  static Future<bool> cleanImageCache() async {
    final String result = await _channel.invokeMethod('cleanImageCache');
    if (result == "success") {
      return true;
    }
    return false;
  }

  /// Save image to album
  ///
  /// - parameters:
  ///    - file: file of video
  ///    - albumName: save the album name
  ///    - waterMark:assetName "images/water_mark.png"
  ///    - alignment: [0,0]represents the center of the rectangle. 
  ///      from -1.0 to +1.0 is the distance from one side of the rectangle to the other side of the rectangle.
  ///      Default value [1,1] repesent right bottom
  ///    - scale: the scale ratio with respect water image size.Default value is 1.0
  /// Returns whether save success
  static Future<bool> saveImage(File file, String albumName,{String waterMark,Alignment alignment,double scale}) async {
    Map<String,dynamic> para = {"filePath":file.path,"albumName":albumName};
    if (waterMark != null) {
      para.addAll({"waterMark":waterMark});
      if (alignment != null) {
        para.addAll({"alignment":{"x":alignment.x,"y":alignment.y}});
      } else {
        para.addAll({"alignment":{"x":1,"y":1}});
      }
      if (scale != null) {
        para.addAll({"scale":scale});
      } else {
        para.addAll({"scale":1.0});
      }
    }
    final bool result =
        await _channel.invokeMethod('saveImage', para);
    return result;
  }

  /// Returns the file list of the exporting image
  ///
  /// - parameters:
  ///    - filePath: file path of video
  ///    - number: export the number of frames
  ///    - quality: scale of export frame."0" is lowest,"1" is origin.("0" is scale for 0.1 in android) 
  static Future<List<File>> exportImage(String filePath, int number,double quality) async {
    var para = {"filePath":filePath,"number":number,"quality":quality};
    final List<dynamic> list =
        await _channel.invokeMethod('exportImage', para);
    var result = list
        .cast<String>()
        .map((path) => File.fromUri(Uri.file(path)))
        .toList();
    return result;
  }

  /// Returns the file list of the exporting image
  ///
  /// - parameters:
  ///    - file: file of video
  ///    - duration: export the duration of frames
  ///    - radian: rotation the frame ,which will export frame.Rotation is clockwise.
  static Future<File> exportImageBySeconds(File file, Duration duration,double radian) async {
    var milli = duration.inMilliseconds;
    var para = {"filePath":file.path,"duration":milli,"radian":radian};
    final String path = await _channel
        .invokeMethod('exportImageBySeconds', para);
    try {
      var result = File.fromUri(Uri.file(path));
      return result;
    } catch (e) {
      throw e;
    }
  }

  /// Returns the file list of the exporting frame for gif file
  ///
  /// - parameters:
  ///    - filePath: file path of video
  ///    - quality: scale of export frame."0" is lowest,"1" is origin.("0" is scale for 0.1 in android) 
  static Future<List<File>> exportGifImage(String filePath, double quality) async {
    var para = {"filePath":filePath,"quality":quality};
    final List<dynamic> list =
        await _channel.invokeMethod('exportGifImagePathList', para);
    var result = list
        .cast<String>()
        .map((path) => File.fromUri(Uri.file(path)))
        .toList();
    return result;
  }

ios

If there will be an error when compile ios app.Because flutter use swift is 4.0. located in ios/Podfile Edit your Podfile as follows:


target 'Runner' do
  use_frameworks! # <--- add this
  ...
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
      config.build_settings['SWIFT_VERSION'] = '4.2' # <--- add this
    end
  end
end

If you use saveAblum api,you need add the add the following keys to your Info.plist file, located ios/Runner/Info.plist:


<key>NSPhotoLibraryUsageDescription</key>
<string>Use Ablum For your purpose</string>

Android

Make sure you add the needed permissions to your Android Manifest Permission.

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Example Demo

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.