Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-27 Thread Olivier Ayache
When you close IContainer with InputStream. It will be automatically close. You can see Implementation here https://github.com/olivierayache/xuggle-xuggler/blob/ffmpeg-3.x-dev/src/com/xuggle/xuggler/io/InputOutputStreamHandler.java For the JNI overhead it must be measured but normally by working w

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-27 Thread Alex Cohn
Yes, I would definitely be glad to join forces. That's true that the fd will be closed with the stream, or when the owning ParcelFileDescritpor is closed. But what decides when the stream/ParcelFileDescritpor can be closed? With `file:` protocol, it's very natural that avformat closes the fd when

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-27 Thread Olivier Ayache
You're welcome. Can I suggest you to try IContainer.open with InputStream/OutputStream. If you use a FileInputStream created from the file descriptor retrieved with https://developer.android.com/reference/android/content/Intent#ACTION_OPEN_DOCUMENT Normally fd will be automatically closed by the s

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-27 Thread Alex Cohn
Thanks Olivier, Custom IO looks like a nice way to work around the protocol limitations. Unfortunately, it cannot work with avio_open(), so the API becomes trickier for end users. Also, just like with pipes, I cannot reliably close the file descriptor when ffmpeg execution is over, can I? BR, Al

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-27 Thread Olivier Ayache
A good alternative to work with FFmpeg on Android is Xuggler, it presents FFmpeg's API directly to Java/Kotlin. To deal with fd you can declare and implement your own IO handler by implementing https://github.com/olivierayache/xuggle-xuggler/blob/ffmpeg-3.x-dev/src/com/xuggle/xuggler/io/IURLProtoc

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-26 Thread Alex Cohn
On Sun, Jul 26, 2020 at 10:21 PM Martin Storsjö wrote: > > Hi, > > Without having too much opinion on the JNI stuff (direct access to > content:// urls might be convenient, but on the other hand, it's not > really something you'd end up with if using the command line tool on its > own - if you hav

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-26 Thread Martin Storsjö
Hi, Without having too much opinion on the JNI stuff (direct access to content:// urls might be convenient, but on the other hand, it's not really something you'd end up with if using the command line tool on its own - if you have one of those you most probably have some java code for getting

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-26 Thread Alex Cohn
On Sat, Jul 25, 2020 at 9:37 PM Matthieu Bouron wrote: > > On Wed, Jul 22, 2020 at 2:38 PM Alex Cohn wrote: > > > Usually, we employ the `pipe:` protocol to deal with the numerical > > file descriptors, and this answers all our needs. On Android, there is > > a different use case in which numeric

Re: [FFmpeg-devel] working with file descriptors on Android

2020-07-25 Thread Matthieu Bouron
On Wed, Jul 22, 2020 at 2:38 PM Alex Cohn wrote: > Usually, we employ the `pipe:` protocol to deal with the numerical > file descriptors, and this answers all our needs. On Android, there is > a different use case in which numerical file descriptors appear, and > this is not covered well with `pi

[FFmpeg-devel] working with file descriptors on Android

2020-07-22 Thread Alex Cohn
Usually, we employ the `pipe:` protocol to deal with the numerical file descriptors, and this answers all our needs. On Android, there is a different use case in which numerical file descriptors appear, and this is not covered well with `pipe:` protocol. This happens when a file is opened in scope