ofxVideoRecorder isn't recording

Hi, I’ve installed this addon on Ubuntu 12.04 64 bits, I have ffmpeg installed (the one from Ubuntu packages) since a while.

I can run ffmpeg commands from console and record the streaming from a webcam without problems in this way:

ffmpeg -f video4linux2 -r 25 -s 640x480 -i /dev/video0 out2.avi

However when run the example I got these errors, so any file is built:

“The video recorder failed to write some frames!”

“The video recorder failed to write some audio samples!”

I don’t know if something related with codec issues or maybe a different version of ffmpeg as well, since Ubuntu version is a fork. I asked the same in github, but I haven’t had any respnse yet and I need to solve this as soon as is possible.
I appreciate any hint to solve this.


Yea, this addon is super picky. Well ffmpeg. Have you double checked that your audio input index & sample rate are correct for the device? Video recording is dependent on the audio data coming in along with the correct sample rates. If its incorrect, it will kick out those errors and write out some random zero k file. Also make sure the location you are writing to has permission to be written to and directories exist in that location.

@ryanww I was being assisted by the plugin creator. It seems I have troubles with get working ffmpeg and audio.
As soon as I could figure it out I will comments the results.
Thanks for your help, I’l check out what you said.


Although I got it working with ffmpeg from the comman line with my ‘own’ commands: I can recording video & audio, or just audio. I tryed the ffmpeg command line constructed in ofxVideoRecorder.cpp, but it doesn’t work for me.

I can record video without audio with the example by commented out this line of ofApp.cpp

vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, vidGrabber.getWidth(), vidGrabber.getHeight(), 30, sampleRate, channels);

and uncommented:

vidRecorder.setup(fileName+ofGetTimestampString()+fileExt, vidGrabber.getWidth(), vidGrabber.getHeight(), 30); // no audio

These were suggestions made by Tim Scaffiddi the author of this addon. That narrows my possibilties for searching the problem, it has to do with a sound issue which I can’t solve yet.

Those command work well for me:

Audio & video:

ffmpeg -f alsa -ac 2 -i default -itsoffset 00:00:00.5 -f video4linux2 -s 320x240 -r 25 -i /dev/video0 outaudui.mpg


ffmpeg -f alsa -ac 2 -i pulse -acodec libmp3lame -ab 96k outputk.mp3D
ffmpeg -f alsa -ac 2 -i pulse -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -y myVOICE.wav

I think it has to do with the multiple ffmpeg configuration possibilities and their combination or maybe some drivers issues that I can’t figure out properly.

I will construct my own recorder based on ofxVideoRecorder a way simpler though, with the commands that work for me.
Anyway suggestions are always welcome.

OS: Ubuntu 12.04 64 bits

How about trying another sound interface? Is it one that is built in to the camera or something? Maybe at least for testing… Have you looked at the printed output of the soundplayer.listdevices() (or similar) to see what it says for ID’s and such?