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

패키지 상세v1.0.0

native_audio_trimmer

FFmpeg를 사용하지 않고 안드로이드 및 iOS에서 오디오 파일을 자르는 데 사용할 수 있는 플러터 플러그인입니다.

AndroidiOS
30일 다운로드
225
좋아요
6
Pub 점수
150

패키지 설치

flutter pub add native_audio_trimmer

패키지 개요

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

NativeAudioTrimmer은 FFmpeg에 의존하지 않고 안드로이드 및 iOS 기기에서 오디오 파일 자르기를 가능하게 하는 플러터 플러그인입니다. 원격 플랫폼 기능을 활용하여 앱 내에서 효율적이고 가벼운 오디오 처리를 제공합니다. 일반적인 오디오 형식을 지원하며, 원하는 세그먼트를 추출하기 위해 시작 시간과 종료 시간을 설정할 수 있는 간단한 API를 제공합니다. 음성 메모 자르기 또는 팟캐스트 클리핑과 같은 기본 오디오 편집 기능이 필요한 앱에 적합합니다.

사용 사례

  • 음성 메모 자르기
  • 짧은 오디오 클립 편집
  • 공유를 위해 오디오 조각 준비
  • 녹음 앱에서 오디오 편집 통합
  • 사용자 지정 오디오 미리보기 만들기

주요 기능

  • FFmpeg 종속성 없음
  • 크로스 플랫폼 지원 (Android 및 iOS)
  • 시작/종료 시간 선택을 위한 간단한 API
  • 경량이고 빠른 처리
  • 네이티브 오디오 처리 사용

적합한 대상

  • 오디오 녹음 앱을 개발하는 개발자
  • 기본 오디오 편집이 필요한 앱
  • 중요한 종속성 회피 프로젝트
  • 음성 메모 기능이 있는 모바일 앱
  • 교육 또는 콘텐츠 제작 도구

고려 사항

  • 기본적인 트리밍 작업에 한정
  • 고급 오디오 효과를 지원하지 않습니다
  • 플랫폼별 권한이 필요합니다
  • 기기의 특성에 따라 형식 제한이 있을 수 있습니다
  • 성능은 기기 하드웨어에 따라 달라집니다

원본 README

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

native_audio_trimmer

A Flutter plugin for trimming audio files on both Android and iOS platforms without using FFmpeg. This native audio editor provides powerful audio manipulation capabilities, perfect for Flutter audio trimming in apps, podcast trimming, and voice note editing.

Features

  • Trim audio files by specifying start and end times
  • Native implementation for iOS (using AVAssetExportSession)
  • Native implementation for Android (using MediaExtractor, MediaCodec, and MediaMuxer)
  • No FFmpeg dependency, resulting in smaller app size and faster builds
  • Support for multiple audio formats

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  native_audio_trimmer: ^1.0.0
Android

Add the storage permissions to your AndroidManifest.xml if you're targeting Android 12 or below and need to access files outside of your app's directory:

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

For Android 13+ (API level 33+), you may need to request more specific permissions depending on your use case:

<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
iOS

No additional setup is required for iOS.

Usage

import 'package:native_audio_trimmer/native_audio_trimmer.dart';

// Create an instance of AudioTrimmer
final audioTrimmer = AudioTrimmer();

// Trim an audio file
try {
  String inputPath = '/path/to/input.mp3';
  String outputPath = '/path/to/output.m4a';
  
  // Trim from 10 seconds to 30 seconds
      // Trim audio
      final trimmedFilePath = await NativeAudioTrimmer.trimAudio(
        inputPath: inputPath,
        outputPath: outputPath,
        startTimeInSeconds: 10.0, // Start time in seconds,
        endTimeInSeconds: 30.0, // End time in seconds,
      );
  
  print('Trimmed audio saved at: $trimmedFilePath');
} catch (e) {
  print('Error trimming audio: $e');
}

Example

Check out the example app in the example folder to see a complete implementation of audio file selection, trimming, and playback.

To run the example app:

cd example
flutter run

Implementation Details

iOS

On iOS, this plugin uses the native AVAssetExportSession to perform audio trimming operations. The resulting audio file is saved in the .m4a format.

Android

On Android, the plugin uses a combination of MediaExtractor, MediaCodec, and MediaMuxer to extract, process, and save the audio data between the specified start and end times.

Supported Formats

Input Formats
  • MP3
  • M4A/AAC
  • WAV
  • OGG (Android only)
  • FLAC
Output Format
  • M4A (AAC) for both platforms

Limitations

  • The plugin currently only outputs to M4A format
  • Very large audio files may require additional memory
  • Some exotic audio formats might not be supported by the native APIs

Contributing

Contributions are welcome! If you find a bug or want a feature, please open an issue on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.

카테고리

소스 저장소

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

아직 데이터가 없습니다.