Writing video + generated audio to AVAssetWriterInput, audio stuttering

后端 未结 2 498
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 22:45

I\'m generating a video from a Unity app on iOS. I\'m using iVidCap, which uses AVFoundation to do this. That side is all working fine. Essentially the video is rendered by

相关标签:
2条回答
  • 2020-12-13 23:19
    CMAudioSampleBufferCreateWithPacketDescriptions(kCFAllocatorDefault, bbuf, TRUE, 0, NULL, audio_fmt_desc_, 1, timestamp, NULL, &sbuf);
    

    should be

    CMAudioSampleBufferCreateWithPacketDescriptions(kCFAllocatorDefault, bbuf, TRUE, 0, NULL, audio_fmt_desc_, n, timestamp, NULL, &sbuf);i made it.
    
    0 讨论(0)
  • 2020-12-13 23:24

    It looks ok, although I would use CMBlockBufferCreateWithMemoryBlock because it copies the samples. Is your code ok with not knowing when audioWriterInput has finished with them?

    Shouldn't kAudioFormatFlagIsAlignedHigh be kAudioFormatFlagIsPacked?

    0 讨论(0)
提交回复
热议问题