getImageInfo static method

Future<FFprobeImageInfo?> getImageInfo(
  1. String inputPath
)

Implementation

static Future<FFprobeImageInfo?> getImageInfo(String inputPath) async {
  final cmd =
      '-v quiet -print_format json -show_format -show_streams "$inputPath"';
  final session = await FFprobeKit.execute(cmd);
  final output = await session.getOutput();

  if (output == null || output.trim().isEmpty) {
    if (kDebugMode) {
      print("⚠️ FFprobe returned empty output");
    }
    return null;
  }

  final data = jsonDecode(output);

  final streams = data['streams'] as List?;
  if (streams == null || streams.isEmpty) return null;

  final stream = streams.first;

  final width = stream['width'] ?? 0;
  final height = stream['height'] ?? 0;

  final size = data['format']?['size']?.toString();

  return FFprobeImageInfo(width, height, size);
}