Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio recording: system exception: cannot lock mutex #60

Open
chao-mu opened this issue Apr 24, 2018 · 0 comments
Open

Audio recording: system exception: cannot lock mutex #60

chao-mu opened this issue Apr 24, 2018 · 0 comments

Comments

@chao-mu
Copy link

chao-mu commented Apr 24, 2018

I have an application where I read a video file with ofVideoPlayer (presumably AVFoundation), apply effects to it, and write each frame to ofxVideoRecorder. However, I'm having difficulty figuring out how exactly to pipe in the audio. I read the example source code, but that's getting it from a device and not from the videoplayer and I'm not sure how to bridge that gap.

Where I am currently is getting a segfault when I close and not recording any audio, despite my audio event handler being called. I'm doing the following:

recorder_.setVideoCodec("mjpeg");
recorder_.setVideoBitrate("2500k");
recorder_.setAudioCodec("mp3");
recorder_.setAudioBitrate("192k");
recorder_.setup("out-" + ofGetTimestampString() + ".mov", video_->getWidth(), video_->getHeight(), 60);
recorder_.start();

// int nOutputChannels, int nInputChannels, ofBaseApp *appPtr, int sampleRate, int bufferSize, int nBuffers
ofSoundStreamSetup(2, 0, this, 44100, 256, 4);
    void ofApp::audioReceived(float *input, int bufferSize, int nChannels){
        if (recording_) {
            recorder_.addAudioSamples(input, bufferSize, nChannels);
        }
    }

But receive the following error and a segfault:

[ fatal ] ofThreadErrorLogger::exception: System exception: cannot lock mutexits/s speed=1.04x
frame= 433 fps= 63 q=24.8 Lsize= 33543kB time=00:00:07.20 bitrate=38164.4kbits/s speed=1.05x
video:33541kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.008100%
Segmentation fault: 11

I assume there is something that I'm doing wrong. Any help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant