kibsoft / QtMEL

Qt Media Encoding Library
GNU Lesser General Public License v2.1
67 stars 16 forks source link

Record Audio only #35

Open cygnus2k opened 8 years ago

cygnus2k commented 8 years ago

Hi, thanks for this library. But how record audio only? Thanks

kibsoft commented 8 years ago

Hello, do you mean encoding to mp3, or smth else?

cygnus2k commented 8 years ago
only record mp3. thanks
    El 24/11/15 a las 17:02, Kirill Bukaev escribió:

  Hello, do you mean
      encoding to mp3, or smth else?
  —
      Reply to this email directly or view
        it on GitHub.
kibsoft commented 8 years ago

This should work. Also you can look at CameraExample.

AudioGrabber *audioGrabber = new AudioGrabber;

AudioFormat format;
format.setChannelCount(2);
format.setSampleRate(44100);
format.setFormat(AudioFormat::SignedInt16);

audioGrabber->setFormat(format);
audioGrabber->setDeviceIndex(0);

Recorder *recorder = new Recorder;
recorder->setAudioGrabber(audioGrabber);

AudioCodecSettings settings;
settings.setSampleRate(audioGrabber->format().sampleRate());
settings.setChannelCount(audioGrabber->format().channelCount());
settings.setSampleFormat(EncoderGlobal::Signed16);

recorder->encoder()->setAudioCodecSettings(settings);
recorder->encoder()->setAudioCodec(EncoderGlobal::MP3);
recorder->encoder()->setFilePath("C:/audio.mp3");
recorder->start();
cygnus2k commented 8 years ago
Thanks,  I'll try
    El 24/11/15 a las 17:26, Kirill Bukaev escribió:

  This should work.
      Also you can look at CameraExample.
  AudioGrabber *audioGrabber = new AudioGrabber;

AudioFormat format; format.setChannelCount(2); format.setSampleRate(44100); format.setFormat(AudioFormat::SignedInt16);

audioGrabber->setFormat(format); audioGrabber->setDeviceIndex(0);

Recorder *recorder = new Recorder; recorder->setAudioGrabber(audioGrabber);

AudioCodecSettings settings; settings.setSampleRate(m_audioGrabber->format().sampleRate()); settings.setChannelCount(m_audioGrabber->format().channelCount()); settings.setSampleFormat(EncoderGlobal::Signed16);

recorder->encoder()->setAudioCodecSettings(audioCodecSettings()); recorder->encoder()->setAudioCodec(EncoderGlobal::MP3); recorder->encoder()->setFilePath("C:/audio.mp3"); recorder->start();

  —
      Reply to this email directly or view
        it on GitHub.
cygnus2k commented 8 years ago

Hi, the program crash on init m_audioGrabber init

2015-11-24 17:43 GMT-03:00 roberto cygnus2k@gmail.com:

Thanks, I'll try El 24/11/15 a las 17:26, Kirill Bukaev escribió:

This should work. Also you can look at CameraExample.

AudioGrabber *audioGrabber = new AudioGrabber;

AudioFormat format; format.setChannelCount(2); format.setSampleRate(44100); format.setFormat(AudioFormat::SignedInt16);

audioGrabber->setFormat(format); audioGrabber->setDeviceIndex(0);

Recorder *recorder = new Recorder; recorder->setAudioGrabber(audioGrabber);

AudioCodecSettings settings; settings.setSampleRate(m_audioGrabber->format().sampleRate()); settings.setChannelCount(m_audioGrabber->format().channelCount()); settings.setSampleFormat(EncoderGlobal::Signed16);

recorder->encoder()->setAudioCodecSettings(audioCodecSettings()); recorder->encoder()->setAudioCodec(EncoderGlobal::MP3); recorder->encoder()->setFilePath("C:/audio.mp3"); recorder->start();

— Reply to this email directly or view it on GitHub https://github.com/kibsoft/QtMEL/issues/35#issuecomment-159395525.

kibsoft commented 8 years ago

What do you mean by "init"? Where is it? Inside Recorder?

cygnus2k commented 8 years ago

in the mainwindow.cpp empty template:

MainWindow::MainWindow(QWidget *parent) :

QMainWindow(parent),

ui(new Ui::MainWindow)

{

AudioGrabber *m_audioGrabber = new AudioGrabber;

Tanks

2015-11-30 19:05 GMT-03:00 Kirill Bukaev notifications@github.com:

What do you mean by "init"? Where is it? Inside Recorder?

— Reply to this email directly or view it on GitHub https://github.com/kibsoft/QtMEL/issues/35#issuecomment-160776704.