コード例 #1
0
 @Test
 public void flvNellymoserTest() throws Exception {
   logger.info("flvNellymoserTest");
   Muxer muxer =
       Muxer.make(this.getClass().getCanonicalName() + ".flv_nellymoser.flv", null, null);
   Encoder encoder = Encoder.make(Codec.findEncodingCodec(Codec.ID.CODEC_ID_NELLYMOSER));
   Type findType = null;
   for (Type type : encoder.getCodec().getSupportedAudioFormats()) {
     if (findType == null) {
       findType = type;
     }
     if (type == Type.SAMPLE_FMT_S16) {
       findType = type;
       break;
     }
   }
   logger.info(findType.toString());
   int sampleRate = 44100;
   encoder.setSampleRate(sampleRate);
   Rational encoderTimeBase = Rational.make(1, sampleRate);
   encoder.setTimeBase(encoderTimeBase);
   encoder.setChannels(1);
   encoder.setChannelLayout(Layout.CH_LAYOUT_MONO);
   encoder.setSampleFormat(findType);
   encoder.setFlag(Flag.FLAG_GLOBAL_HEADER, true);
   encoder.open(null, null);
   muxer.addNewStream(encoder);
   processConvert(muxer, encoder);
   logger.info("done");
 }