Giter VIP home page Giter VIP logo

Comments (7)

REAS avatar REAS commented on May 29, 2024

Please use the Forum for questions: http://forum.processing.org. This place is for bug reports. FYI, there's an example that comes with the video library that covers this question.

from processing-video.

krismz avatar krismz commented on May 29, 2024

The Libraries->video->Movie->Frames example has the frame rate hard-coded and does not ever actually get the frame rate from the Movie class.

int movFrameRate = 30;

None of the other examples I saw get frame rate either. I've also looked through the source code for the Movie class, and the only relevant method I could find is marked protected:

protected float getSourceFrameRate() {…}

I've tried signing up in the forum, but am still waiting for the confirmation email. I can continue this discussion there if you prefer.

-Kris

On Dec 11, 2014, at 4:18 PM, Casey Reas [email protected] wrote:

Closed #19.


Reply to this email directly or view it on GitHub.

from processing-video.

REAS avatar REAS commented on May 29, 2024

I'm not sure what issues, if any, getting the frame rate has. Maybe @codeanticode can let us know.

from processing-video.

codeanticode avatar codeanticode commented on May 29, 2024

The Movie class has a public field, frameRate, that contains the frame rate the video file is being played at. You can change the current frame rate with the frameRate(fps) method:

import processing.video.*;

Movie movie;

void setup() {
  size(640, 360);
  background(0);
  movie = new Movie(this, "transit.mov");
  movie.loop();  
}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  image(movie, 0, 0, width, height);
  println(movie.frameRate);
}

void keyPressed() {
  movie.frameRate(1);
}

@krismz let me know if this works for you. The Frames example should use of Movie.frameRate instead of the hard-coded value, thanks for pointing that out!

from processing-video.

codeanticode avatar codeanticode commented on May 29, 2024

@krismz did you try the code I posted in the previous comment?

from processing-video.

krismz avatar krismz commented on May 29, 2024

Yes, that worked for me, thanks! But it seems that frameRate is always the current playing frame rate of the movie which is only the same thing as the original frame rate prior to any sort of call to movie.frameRate(some_other_frame_rate). Is this true? If I want to skip to a specific frame in a movie, I need to jump based on the original source frame rate, not the current playing frame rate. I'm handling this now by saving off the value of movie.frameRate just after my first call to movie.read().

from processing-video.

codeanticode avatar codeanticode commented on May 29, 2024

@krismz thanks for the observation. The documentation is a bit ambiguous on this, since while it does describe the frameRate() function, it does not make any reference to the frameRate variable. My interpretation is that it should contain wherever was last set with frameRate(), which is consistent with the usage of the frameRate variable in PApplet.

@alignedleft @REAS do you have any comments? Should we add an entry for the frameRate variable in the video documentation? Should we start the original frame rate of the movie file somewhere?

from processing-video.

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.