a-schild / jave2

The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project
GNU General Public License v3.0
1.28k stars 249 forks source link

Default encoder for format amr (codec amr_nb) is probably disabled. Please choose an encoder manually. #265

Open HappyWYQ opened 7 months ago

HappyWYQ commented 7 months ago

how to enable amr encoder when using version 3.5.0?

version 3.5.0 occured this error,but version 3.1.1 is ok. 11:00:34.733 [main] DEBUG ws.schild.jave.ConversionOutputAnalyzer - Input Line (5): <Automatic encoder selection failed for output stream #0:0. Default encoder for format amr (codec amr_nb) is probably disabled. Please choose an encoder manually.>

this is my java code

            //Audio Attributes
            AudioAttributes audio = new AudioAttributes();

// audio.setCodec("libmp3lame"); // audio.setCodec("libopencore_amrnb"); audio.setBitRate(12200); audio.setChannels(1); audio.setSamplingRate(8000);

            //Encoding attributes
            EncodingAttributes attrs = new EncodingAttributes();
            attrs.setInputFormat("amr");
            attrs.setOutputFormat("amr");
            attrs.setAudioAttributes(audio);

            //Encode
            String[] audioEncoders = encoder.getAudioEncoders();
            System.out.println("======="+JSONObject.toJSONString(audioEncoders));
            encoder.encode(new MultimediaObject(source), target, attrs);