duongtung4691 / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 1 forks source link

FFmpegFrameRecorder cannot support MP3 (Audio codec not found.) #463

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I grab the audio from the video, as following code:
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("/storage/sdcard0/11.mp4");
grabber.start();
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(
                    "/storage/sdcard0/xx.mp3", grabber.getAudioChannels());
recorder.setImageHeight(0);
recorder.setImageWidth(0);
//recorder.setSampleFormat(grabber.getSampleFormat());
recorder.setSampleRate(grabber.getSampleRate());
recorder.setFormat("mp3");
recorder.setAudioCodec(avcodec.AV_CODEC_ID_MP3);
recorder.start();

But have error (Audio codec not found):
com.googlecode.javacv.FrameRecorder$Exception: avcodec_find_encoder() error: 
Audio codec not found.
at 
com.googlecode.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:4
24)
at com.googlecode.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:267)
at com.example.ffmpegtest.MainActivity.process(MainActivity.java:77)
at com.example.ffmpegtest.MainActivity.access$0(MainActivity.java:62)
at com.example.ffmpegtest.MainActivity$2.run(MainActivity.java:53)

Original issue reported on code.google.com by kevens...@gmail.com on 22 Apr 2014 at 3:31

GoogleCodeExporter commented 9 years ago

Original comment by samuel.a...@gmail.com on 29 Apr 2014 at 1:51