hqq128/javacv

FFmpegFrameRecorder cannot support MP3 (Audio codec not found.)

Closed this issue · 1 comments

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

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

  • Changed state: Duplicate
  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect