Skip to content

Commit

Permalink
Switch URL to https. Add getCurrentTime and getCurrentFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
hamoid committed Apr 17, 2017
1 parent 2424b1a commit ece0524
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -72,6 +72,8 @@ The exported video is compressed using the h264 codec. This codec does not allow

## change log

* 0.1.8 - April 17th, 2017
* Switch server url to https (attempt to solve broken installation inside the IDE)
* 0.1.7 - April 1st, 2017
* Setting are now saved in the libray folder. Using the Java Preferences was
giving errors on some Windows versions.
Expand Down
15 changes: 6 additions & 9 deletions examples/withAudioViz/withAudioViz.pde
Expand Up @@ -5,10 +5,11 @@ import ddf.minim.spi.*;

VideoExport videoExport;

String audioFilePath = "jingle.mp3";

String SEP = "|";
float movieFPS = 30;
float frameDuration = 1 / movieFPS;
float movieTime = 0;
BufferedReader reader;

void setup() {
Expand All @@ -24,15 +25,15 @@ void setup() {
// experimentation. Otherwise every time you
// run this program it re-generates the FFT
// analysis.
audioToTextFile("jingle.mp3");
audioToTextFile(audioFilePath);

// Open the text file we just created for reading
reader = createReader("jingle.mp3.txt");
reader = createReader(audioFilePath + ".txt");

// Set up the video exporting
videoExport = new VideoExport(this);
videoExport.setFrameRate(movieFPS);
videoExport.setAudioFileName("jingle.mp3");
videoExport.setAudioFileName(audioFilePath);
videoExport.startMovie();
}
void draw() {
Expand Down Expand Up @@ -66,7 +67,7 @@ void draw() {
// I added an offset of half frame duration,
// but I'm not sure if it's useful nor what
// would be the ideal value. Please experiment :)
while (movieTime < soundTime + frameDuration * 0.5) {
while (videoExport.getCurrentTime() < soundTime + frameDuration * 0.5) {
background(0);
noStroke();
// Iterate over all our data points (different
Expand All @@ -91,10 +92,6 @@ void draw() {
popMatrix();
}
videoExport.saveFrame();
// Manually increment the movie time.
// In future versions I should add
// something like videoExport.getTime() instead.
movieTime += 1 / movieFPS;
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions resources/build.properties
Expand Up @@ -87,7 +87,7 @@ author.url=http://hamoid.com
# Set the web page for your Library.
# This is NOT a direct link to where to download it.

library.url=http://funprogramming.org/VideoExport-for-Processing
library.url=https://funprogramming.org/VideoExport-for-Processing

This comment has been minimized.

Copy link
@hamoid

hamoid Apr 20, 2017

Author Owner

@prisonerjohn Please update the library url to https so the new version is shown inside the Processing IDE. Thank you! :)

This comment has been minimized.

Copy link
@prisonerjohn

prisonerjohn Apr 22, 2017

Done!



# Set the category (or categories) of your Library from the following list:
Expand Down Expand Up @@ -132,12 +132,12 @@ source.repository=https://github.com/hamoid/VideoExport-for-Processing.git
# This is used to compare different versions of the same Library, and check if
# an update is available.

library.version=17
library.version=18


# The version as the user will see it.

library.prettyVersion=0.1.7
library.prettyVersion=0.1.8


# The min and max revision of Processing compatible with your Library.
Expand All @@ -155,7 +155,7 @@ compatible.maxRevision=0
# against. This information is only used in the generated webpage.

tested.platform=osx,linux,windows
tested.processingVersion=3.2.3
tested.processingVersion=3.3.0


# Additional information for the generated webpage.
Expand Down
27 changes: 27 additions & 0 deletions src/com/hamoid/VideoExport.java
Expand Up @@ -355,6 +355,33 @@ protected void initialize() {
}
}

/**
* Call this function to figure out how many frames your movie has so far.
*
* @return the number of frames added to the movie so far
*/
public int getCurrentFrame() {
return frameCount;
}

/**
* You could use the returned value to display a time counter, a progress
* bar or to create periodic motion, for instance by feeding
* the returned value into the sin() function, and using the result to drive
* the position of an object.
*
* @return the duration of the movie (so far) in seconds
*/
public float getCurrentTime() {
return frameCount / ffmpegFrameRate;
}

/**
* Call this if you need to figure out the path to the ffmpeg program
* (advanced).
*
* @return the path to the ffmpeg program as a String
*/
public String getFfmpegPath() {
return settings.getString(SETTINGS_FFMPEG_PATH, FFMPEG_PATH_UNSET);
}
Expand Down

0 comments on commit ece0524

Please sign in to comment.