Coder Social home page Coder Social logo

fileless input/output about ffmpeg-kit HOT 10 CLOSED

arthenica avatar arthenica commented on July 20, 2024
fileless input/output

from ffmpeg-kit.

Comments (10)

tanersener avatar tanersener commented on July 20, 2024 1

just wrap native memfd_create, it's a linux feature probably to make it before api 30 just create a jni library

This is the definition of memfd_create function in NDK's sys/mman.h header. It is in line with Android documentation. It is not available below API Level 30.

#if __ANDROID_API__ >= 30
int memfd_create(const char* __name, unsigned __flags) __INTRODUCED_IN(30);
#endif /* __ANDROID_API__ >= 30 */

another solution would be to create a pipe

FFmpegKit already supports pipes. Please have a look at Pipe Support wiki page.

from ffmpeg-kit.

tanersener avatar tanersener commented on July 20, 2024

This was discussed on mobile-ffmpeg as well but I we couldn't find an elegant solution to implement this.

On Android, SharedMemory is one of the potential features we can use. Unfortunately, it is introduced in API Level 27. It can not be applied as a general solution.

from ffmpeg-kit.

andrew-ld avatar andrew-ld commented on July 20, 2024

being that it supports storage access framework couldn't you implement a custom fileprovider?

ie open:
https://android.googlesource.com/platform/frameworks/support/+/a9ac247af2afd4115c3eb6d16c05bc92737d6305/compat/src/main/java/androidx/core/content/FileProvider.java#561

could reimplement the various methods to make it read/write in ram

from ffmpeg-kit.

tanersener avatar tanersener commented on July 20, 2024

What do you mean by writing to RAM? I don't understand how can that FileProvider class help to implement this feature.

from ffmpeg-kit.

andrew-ld avatar andrew-ld commented on July 20, 2024

The reference implementation of a fileprovider is the one of androidx, if you see when a file is requested it returns a ParcelFileDescriptor, usually it points to the filedescriptor of a file on the disk, but by extending the class you can return a filedescriptor to a anonymous file mapped to memory using memfd_create

from ffmpeg-kit.

tanersener avatar tanersener commented on July 20, 2024

Using memfd_create is possible but it is introduced in API Level 30 according to Android documentation. We need a more general solution that we can use in earlier API levels as well.

from ffmpeg-kit.

andrew-ld avatar andrew-ld commented on July 20, 2024

just wrap native memfd_create, it's a linux feature probably to make it before api 30 just create a jni library

from ffmpeg-kit.

andrew-ld avatar andrew-ld commented on July 20, 2024

https://developer.android.com/reference/android/os/ParcelFileDescriptor#createPipe()

another solution would be to create a pipe

from ffmpeg-kit.

d4rken avatar d4rken commented on July 20, 2024

Pipes do not work for output though, right?
-i pipe1 file.mp4 works, but -i pipe1 pipe2 gives an "read only filesystem" error.

from ffmpeg-kit.

github-actions avatar github-actions commented on July 20, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from ffmpeg-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.