执行推流时,给FFmpegFrameRecorder设置的参数如下(具体代码参见Java CV本地视频流通过帧图片添加文本进行字幕合成 ):
recorder.setAudioBitrate(grabber.getAudioBitrate());
recorder.setSampleRate(grabber.getSampleRate());
recorder.setAudioCodec(avcodec.AV_CODEC_ID_MP3);
结果调用FFmpegFrameRecorder的record方法时抛出异常,详见报错日志:
准备开始推流...
Exception in thread "main" org.bytedeco.javacv.FrameRecorder$Exception: No audio output stream (Is audioChannels > 0 and has start() been called?)
at org.bytedeco.javacv.FFmpegFrameRecorder.recordSamples(FFmpegFrameRecorder.java:1040)
at org.bytedeco.javacv.FFmpegFrameRecorder.record(FFmpegFrameR