Code Monkey home page Code Monkey logo

Comments (5)

wang-bin avatar wang-bin commented on June 12, 2024

Do you mean step to the next/previous 1 frame? It's still developing. But for timeline preview, accurate seeking to a given time is enough, via seek(msec, SeekFlag::FromStart) see example https://github.com/wang-bin/mdk-examples/blob/master/Qt/qmdkplay.cpp#L23

from mdk-sdk.

AdrianEddy avatar AdrianEddy commented on June 12, 2024

Do you mean step to the next/previous 1 frame?

Yes exactly, next 1 frame works fine, but previous doesn't and it will be useful too. Also seek to arbitrary exact frame will be useful, so for example I can call

seek(1234, SeekFlag::FromStart | SeekFlag::Frame)
and then for example
seek(976, SeekFlag::FromStart | SeekFlag::Frame)

from mdk-sdk.

wang-bin avatar wang-bin commented on June 12, 2024

Do you mean step to the next/previous 1 frame?

Yes exactly, next 1 frame works fine, but previous doesn't and it will be useful too. Also seek to arbitrary exact frame will be useful, so for example I can call

seek(1234, SeekFlag::FromStart | SeekFlag::Frame)
and then for example
seek(976, SeekFlag::FromStart | SeekFlag::Frame)

If frame rate is known, seek forward a large number of frames and seek to by time are equivalent. If frame rate is unknown, it's impossible to fast seek by frame, you must decode frames 1 by 1(it's supported now) and which will be slow. So seeking to arbitrary exact frame is not useful.

from mdk-sdk.

AdrianEddy avatar AdrianEddy commented on June 12, 2024

If frame rate is known, seek forward a large number of frames and seek to by time are equivalent.

You're right, this seems to work correctly if I calculate the timestamp from frame and frame rate and seek to timestamp.

I'll close this issue, but still it would be nice for the user of the SDK if that happens internally when passing SeekFlag::Frame.
Maybe something like this could be implemented in the SDK for SeekFlag::FromStart | SeekFlag::Frame case, if frame rate is known

auto delta = targetFrame - currentFrame;
if (delta > 0 && delta < 5) {
    seek(delta, SeekFlag::FromNow | SeekFlag::Frame);
} else {
    double timestampMs = (targetFrame / codec.frame_rate) * 1000.0;
    seek(timestampMs, SeekFlag::FromStart);
}

from mdk-sdk.

wang-bin avatar wang-bin commented on June 12, 2024

Try the latest build. Backward seeking works. the first parameter pos can be -1, -2, -3 etc. frame rate must be known.

from mdk-sdk.

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.