I’m putting together a simple installation using OF and I’d like to record the output of the app to send to visitors after they’ve left the show.
I’ve tried a few different options (e.g. ofxMovieExporter, ofxQTVideoSaver, ofxVideoRecorder) and they all seem to have certain dependencies which either prevent them from running on my main dev platform (OSX Lion) or will prevent them from running in the deployment environment (Windows XP… I know…).
Please could someone recommend a setup for recording uncompressed AVI or image sequences (as a worst case) or some basic encoded option which will easily drop into my app and allow me to specify filenames that will work across these platforms?
Many thanks in advance!
So I’ve made some progress with ofxVideoRecorder (found via http://forum.openframeworks.cc/t/save-as-movie/7455/0). It looks like the only real issues I’ll have are getting the call to ffmpeg running successfully.
Right now it’s storing the mjpeg file correctly but failing at the final encoding. I can do it by hand and the resultant .mov is perfect, but would like to get it wrapped up correctly.
Code from the lib is
sprintf(cmd,"ffmpeg -y -r %2$d -i data/%1$s.mjpg -r %2$d -vcodec copy data/%1$s; rm data/%1$s.mjpg",fileName.c_str(), frameRate);
On OSX it’s failing on the following:
sh: ffmpeg: command not found
rm: data/testMovie.mov.mjpg: No such file or directory
Any tips on getting the correct paths into the app environment somehow so that this encoding step will run correctly?
You need to get the path from the executable to the data folder that the app is in:
ofToDataPath(filename, true); // the 'true' gives you an absolute path, which is what you need
Hope that helps.
also, do you have ffmpeg installed?
On osx, you can also grab a standalone / compiled version of ffmpeg to put in your data folder by poking around this app: http://www.ffmpegx.com/- I think if you do right click -> show package contents on the ffmpegx application, you can find in that folder a compiled version, and then copy that to your data folder.
then, you need to format your command right. it would be something like:
ofToDataPath("ffmpeg) + " -y -r %2$d -i " + ofToDataPath(“data/” +ofToString(i) + "s.mjpg -r " etc.
please note that system commands have no concept of where the data folder is, so we need to give it more info, meaning every location of name there needs an ofToDataPath() around it.
for example, this lists the contents of the data folder:
string command = “ls -la " + ofToDataPath(”") + “;”;
Brilliant thanks guys - yeah I have ffmpeg installed via homebrew. I’ll copy the binary over for now - not sure how I’ll handle the Windows version yet but that’s a start!
I’ll try the ofToDataPath changes later today and get back to you - if successful I’ll submit a pull request to the project (I’m guessing those are cross platform methods and won’t break things for linux/windows users?).
Thanks again - kee
Just wanted to apologise for not updating. Turns out the encoding task was holding up the app too much so decided to remove the cross platform requirement, enforced deployment on mac minis and went with ofxQTVideoSaver.
I think ofxVideoSaver could still do with the ofDataPath additions to the file paths in the encoding step, but not sure on how to get around the ffmpeg binary (or assumption of its availability in the path). Our installation going live tomorrow so will come back to this when things have calmed down a bit - thanks for your help once again
long time ago of this thread, but could somebody make ofxVideoRecorder work for windows platform?
I am working on it know, so if someone could, I would really appreciate a hint.