-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I call FFmpegFrameRecorder the start () method error #72
Comments
can you play those temporary video and audio files in any player? |
Yes, I can play it. Now I have handle this problem, but the video after merge can not be played |
Please try to use the default audio codec by NOT calling |
yesong how did you solve this problem ? |
use the default audio codec by NOT calling setAudioCodec(). |
Hey Saudet Now this problem has been solved, But now I encountered a new problem, I use an MP3 audio files and an MP4 video files composite a new MP4 file, but the composite video files can not be played, is that my code problem? Please help me, thank you ! this is my code: //audio grabber grabberVideo.start(); int with = grabberVideo.getImageWidth(); String videoPath = fileUtils.getSDCardRoot() + filePath + File.separator + fileName; double frameRate = grabberVideo.getFrameRate(); Log.i("yesongsong", "frameRate= "+frameRate +" sampleRate= "+sampleRate +" audioChannels= "+audioChannels); recorder.setFormat("mp4"); recorder.start(); Frame frame1 = grabberVideo.grabFrame(); while (frame1 != null || frame2 != null) { recorder.record(frame1); } recorder.release(); |
@yesong Could you provide the messages that FFmpeg outputs to the console? Thanks! |
@saudet Program at run time without any errors or warnings about the ffmpeg Tips Is this my code problem? I've paid a lot of time, but it has not work. |
@saudet |
Ok, great to hear that! Could you please let us know how you fixed your problem, so that it may help others in the future with the same issue. Thank you! |
After I call start() on a recorder, I get the following error: |
If you don't need audio setAudioChannels(0) before calling start().
|
Thanks for your advice, not the case though where I could ignore an audio track. It's appeared that a video codec also couldn't be opened. |
org.bytedeco.javacv.FrameRecorder$Exception: avio_open2 error() error -13: Could not open 'null' but the file is : why? |
@quinnxiao Errno 13 is "Permission denied": Your application doesn't have write access. |
I am trying the RecordActivity sample and I am getting the same error (13). I have these in the manifest (before the application): Also when I open the app's permissions in my device it says that I have these permissions. 08-05 11:00:48.630 15147-15147/com.example.ayele.myapplication I/MainActivity: recorder initialize success What am I missing here? Thank you! |
You just have missing permissions. Some devices have all permissions
disabled by default. You need to enable them. Refer to your device
documentation.
|
Thank you again! 06-08 16:30:54.548 31518-31518/? I/art: Late-enabling -Xcheck:jni EDIT |
org.bytedeco.javacv.FrameRecorder$Exception: Could not open audio codec.
at org.bytedeco.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:543)
at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:268)
The following is my code:
FileUtils fileUtils = new FileUtils();
fileUtils.creatSDDir(filePath);
AssetManager am = getAssets();
InputStream inputStream = am.open("music_city.mp3");
File audiofile = createFileFromInputStream(inputStream,0);
InputStream inputStream2 =am.open("tpl_afternoon.mp4");
File videoFile = createFileFromInputStream(inputStream2,1);
//audio grabber
FFmpegFrameGrabber grabberAudio = new FFmpegFrameGrabber(audiofile);
// video grabber
FFmpegFrameGrabber grabberVideo = new FFmpegFrameGrabber(videoFile);
grabberAudio.start();
grabberVideo.start();
int with = grabberVideo.getImageWidth();
int height = grabberVideo.getImageHeight();
int audioChannels = grabberAudio.getAudioChannels();
recorder = new FFmpegFrameRecorder(videoPath , with, height,audioChannels);
double frameRate = grabberVideo.getFrameRate();
int sampleRate = grabberAudio.getSampleRate();
int sampleFormat = grabberAudio.getSampleFormat();
Log.i("yesongsong", "frameRate= "+frameRate +" sampleRate= "+sampleRate +" sampleFormat= "+sampleFormat);
recorder.setFormat("mp4");
recorder.setFrameRate(grabberVideo.getFrameRate());
recorder.setSampleRate(grabberAudio.getSampleRate());
recorder.setSampleFormat(grabberAudio.getSampleFormat());
recorder.setVideoBitrate(videoBitrate);
recorder.setVideoCodec(videoCodec);
recorder.setAudioBitrate(audioBitrate);
//recorder.setAudioCodec(audioCodec);
recorder.start(); // run here Exception occurred
Frame frame1 = grabberVideo.grabFrame();
Frame frame2 = grabberAudio.grabFrame();
while (frame1 != null || frame2 != null) {
recorder.record(frame1);
recorder.record(frame2);
frame1 = grabberVideo.grabFrame();
frame2 = grabberAudio.grabFrame();
}
recorder.release();
recorder.stop();
recorder = null;
grabberAudio.stop();
grabberVideo.stop();
Log.i("yesongsong","Total Time:- "+ recorder.getTimestamp());
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}.execute();
The text was updated successfully, but these errors were encountered: