Skip to content

Audio recording: system exception: cannot lock mutex #60

@axolotl-logic

Description

@axolotl-logic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions