javacv
javacv copied to clipboard
Audio Recording JavaCV
Hi everyone, I'm trying to record&play only audio but i keep getting the same error. org.bytedeco.javacv.FFmpegFrameRecorder$Exception: No audio output stream (Is audioChannels > 0 and has start() been called?) (For more details, make sure FFmpegLogCallback.set() has been called.)
recorder.recordSamples(sampleRate, numChannels, sBuff); //Error Line
Please use record(Frame) instead of recordSamples().
Well, the exception message may be on point.
Two things I would check: Has the recorder been started with start()? and When constructing the recorder have you set the audioChannel count?
Simply try setting the audiochannels with:
recorder.setAudioChannels(2);
Before starting the recorder.
Hey @saudet , what you said yesterday, did not work. I ran a different code with using 'Mixer' and this is the result I got ( I'm currently working with Ubuntu OS )
"Line unsupported: interface TargetDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame. little-endian.
TargetDataLine line = (TargetDataLine) mixer.getLine(dataLineinfo); // Cause of error.
I've got it, thank you both.
If you're trying to record audio from the microphone, there's a working example here: https://github.com/bytedeco/javacv/blob/master/samples/WebcamAndMicrophoneCapture.java