Giter Site home page Giter Site logo

Comments (2)

jmgirven avatar jmgirven commented on September 26, 2024 3

If I were to perform getFrameAtTime on a very high resolution, e.g. 4k video, I would have to load in a 4k image into memory before then programatically downscaling it to the size of my ImageView as you suggest. I am not hugely familiar with the internals of this library, or probably more importantly FFmpeg, but wouldn't specifying a size to FFmpeg on image creation lead to a reducation in memory usage? Do you know the answer?

I was also reading about loading in bitmaps efficiently from this doc:

http://developer.android.com/training/displaying-bitmaps/load-bitmap.html

but to perform the method they suggest, instead of this library returning a bitmap, I would need an InputStream / file / etc. Is that an alternative?

I am asking because I am loading in a gallery of image thumbnails from a user video. After loading in the frame using getFrameAtTime, I downscale it using:

    Bitmap bitmap = null;
    FFmpegMediaMetadataRetriever retriever = new FFmpegMediaMetadataRetriever();
    try {
        retriever.setDataSource(context, uri);
        bitmap = retriever.getFrameAtTime(timeUs, FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
    } finally {
        retriever.release();
    }
    return ThumbnailUtils.extractThumbnail(bitmap, width, height);

and set it to an ImageView. This is potentially a lot of 4k bitmaps (at least temporarily) going into memory!

from ffmpegmediametadataretriever.

wseemann avatar wseemann commented on September 26, 2024

The bitmap returned by getFrameAtTime can be scaled programmatically so I don't see a need to add this method.

from ffmpegmediametadataretriever.

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.