我想使用Windows7下的vlcj库从网络摄像机捕获音频。 视频捕获效果很好,但是我无法一起捕获音频。 在Unix下,我可以使用Alsa接口,但是在Windows下必须使用。
frame.setVisible(true);
File dir = new File(System.getProperty("user.home"), "Videos");
dir.mkdirs();
DateFormat df = new SimpleDateFormat("yyyyMMdd-HHmmss");
String fileName = dir.getAbsolutePath() + "/Capture-" + df.format(new Date()) + ".mpg";
/*
* Tweak the options depending on your encoding requirements and audio
* capture device (ALSA is not likely to work on Windows of course)
*/
String[] options = {":sout=#transcode{vcodec=mp2v," +
"vb=4096," +
"scale=1," +
"acodec=mpga," +
"ab=128," +
"channels=2," +
"samplerate=44100}" +
":duplicate{dst=file{dst=" + fileName + "}, " +
"dst=display, " +
"select=noaudio" /* ":input-slave=alsa://hw:0,0" */
};
mediaPlayer.playMedia(mrl, options);
但是我必须在Windows下的输入从属中设置
"select=????"
":input-slave=???"
如果删除最后一个参数:select = noaudio,我会出错-主输入错误:调用了ES_OUT_RESET_PCR