getMediaInfo method

Future<Map<String, dynamic>> getMediaInfo(
  1. String inputPath
)

Infomation

(duration, bitrate, codec, frame rate, resolution, etc.)

Implementation

Future<Map<String, dynamic>> getMediaInfo(String inputPath) async {
  final result = await ffprobeRun(
    arguments: [
      '-v',
      'quiet',
      '-print_format',
      'json',
      '-show_format',
      '-show_streams',
      inputPath,
    ],
  );

  if (result.exitCode != 0) {
    throw Exception('ffprobe failed: ${result.stderr}');
  }

  return jsonDecode(result.stdout);
}