2

It seems all methods expect either files or urls. I see some methods that work with OutputStream, but I haven't managed to open an IContainer using one of those methods; I always get an invalid return value.

2 Answers2

1

Create your own IURLProtocolHandler interface and pass to IContainer.open(...) to open any type of media type you want.

Art Clarke
  • 2,495
  • 18
  • 15
0

You can look at this answer I posted on another question to write to an OutputStream (which could easily be a ByteArrayOutputStream).

This gist of it would be to use com.xuggle.xuggler.io.XugglerIO to map from an OutputStream to a special kind of file URL so that FFMPEG can access the stream.

IMediaWriter writer = ToolFactory.makeWriter(XugglerIO.map(outputStream));

Keep in mind that you'll now have to manually set your format (because it can't detect it from the filename). For example:

IContainerFormat containerFormat = IContainerFormat.make();
containerFormat.setOutputFormat("ogg", null, "application/ogg");
writer.getContainer().setFormat(containerFormat);
Community
  • 1
  • 1
11101101b
  • 7,679
  • 2
  • 42
  • 52