Skip to content

Pipe Support

ffmpegkit-maintained edited this page Jun 23, 2026 · 1 revision

Pipe Support

FFmpegKit only runs ffmpeg/ffprobe commands — it can't start another process and redirect its output directly into a command. This fails:

cat <image path> | -i pipe: video.mp4
Unable to find a suitable output format for 'cat'

The pipe: protocol itself still works, though — you can feed a named pipe with another process's output and reference that pipe as input.

1. Create a pipe

String pipe1 = FFmpegKitConfig.registerNewFFmpegPipe(mainActivity);

2. Build your command using the pipe

String ffmpegCommand = "-i " + pipe1 + " -r 25 <output video path>";

3. Execute the command

FFmpegKit.execute(ffmpegCommand);

4. Push data into the pipe from another process

Runtime.getRuntime().exec(new String[]{"sh", "-c", "cat <image path> > " + pipe1});

5. Close the pipe

FFmpegKitConfig.closeFFmpegPipe(pipe1);

ffmpeg blocks at step 3 until something is written to the pipe — if you skip step 4, the thread running step 3 waits indefinitely.

Clone this wiki locally