lundi 2 mars 2015

How do I encode audio from a microphone using humble-video?



I'm trying to use the humble-video project to encode video and audio from a user's webcam and microphone. I'm using webcam-capture to do the video part, but how do I add audio to accompany my video recording.


I can follow this tutorial to get a ByteArrayOutputStream from a microphone, but how do I fit that into the humble-video encoder?


Humble-video needs an instance of MediaAudio, and that's instantiated like this:



public static MediaAudio make(int numSamples,
int sampleRate,
int channels,
AudioChannel.Layout channelLayout,
AudioFormat.Type format) {


I can get most of that information from an instance of the javax.sound.sampled.AudioFormat class, except for AudioFormat.Type.


AudioFormat.Type doesn't seem to exist in the class of AudioFormat I'm using: http://ift.tt/1prJBzi


Do I need to use a different class?


This demo from humble-video shows an example of encoding audio, but it begins with an already-made file that it puts through a Demuxer, and then a DemuxerStream, and finally a Decoder to get enough information to create a MediaAudio instance.


It seems that the author of humble-video is planning to make a "record and encode audio" demo http://ift.tt/1B4aArR




Aucun commentaire:

Enregistrer un commentaire