Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Storage Access Framework

Taner Sener edited this page Sep 27, 2022 · 1 revision

If you want to use a file selected using Storage Access Framework (SAF) with FFmpegKit, you can use the following methods to convert a Uri to a file path defined with FFmpegKit's saf: protocol. That path can be safely used as input or output in FFmpegKit and FFprobeKit commands.

Input
Uri uri = intent.getData();
String inputPath = FFmpegKitConfig.getSafParameterForRead(requireContext(), uri);
FFmpegKit.execute("-i " + inputPath + " ... output.mp4");
Output
Uri uri = intent.getData();
String outputPath = FFmpegKitConfig.getSafParameterForWrite(requireContext(), uri);
FFmpegKit.execute("-i input.mp4 ... " + outputPath);
Both Input and Output
Uri uri = intent.getData();
String path = FFmpegKitConfig.getSafParameter(requireContext(), uri, "rw");
FFmpegKit.execute("-i input.mp4 ... " + path);
Clone this wiki locally