Problems start()-ing FFmpegFrameGrabber

388 views
Skip to first unread message

David Šabata

unread,
Oct 22, 2013, 11:54:02 AM10/22/13
to jav...@googlegroups.com
Hello,
I am trying to merge audio with video and am having problems even starting the grabbers. Here's some code I use for audio grabber.

FFmpegFrameGrabber audioGrabber = new FFmpegFrameGrabber(audiofile);
audioGrabber.setFormat("mp4");
audioGrabber.start();

And here's the error which always pops up

W/System.err﹕ com.googlecode.javacv.FrameGrabber$Exception: avformat_open_input() error -1094995529: Could not open input "/storage/emulated/0/somepath...". (Has setFormat() been called?)
W/System.err﹕ at com.googlecode.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:338)
W/System.err﹕ at com.javacv.recorder.FFmpegRecorderActivity$AsyncStopRecording.doInBackground(FFmpegRecorderActivity.java:329)

I tried not calling setFormat at all (which I saw in some snippets around the web) and also tried to use various formats I thought of, such as mp3, mp4, aac, flv, 3gp, but nothing worked.

Can you please point me out, what am I doing wrong?
The file does exist, is readable and playable by any player. Also I tried both classic mp3 song and some recording I did earlier by FFmpegRecorder (based on samples/RecordingActivity).

PS. I'm using latest (I suppose) binaries from the web download section.

David Šabata

unread,
Oct 23, 2013, 3:58:24 AM10/23/13
to jav...@googlegroups.com
Ok, I figured it out at last. 

The problem was that I was using another audio/video recorders earlier in the app and then was attempting to start a framegrabber sooner, than those objects got released (because of a race condition).

I am not sure why is this happening, probably the native implementation is sharing some objects across recorders and grabbers. The error message is quite misleading though.
Reply all
Reply to author
Forward
0 new messages