SCRecorder
SCRecorder copied to clipboard
Losing sound on video recording after some time on iPod touch
During the video playback using the SCVideoPlayerView, the audio appears to playback fine until you reach the last part of the video (2-3 seconds) then it drops off and the video continues to play.
I am using the audio configuration provided in the ReadMe. Has anyone experience this behavior?
I am using iPod touch 5th generation running iOS 8.1.1
Does that happen on every video even a local one that you setup manually? Is the exact same video playing fine on other devices?
I'm trying to know if this is a playback issue or recording issue. You can find that out by playing the recorded video on another device.
It happens after recording session(s) using SCRecorder. The video plays fine on other devices (iPhone 5, iPhone 5s). It doesn't sound like the audio track is sped up.
Same happens on iphone 4 iOS 7.1.2 Audio configuration: Bitrate = 128000; Sample Rate = 0 (default 44100) Channels Count = 2 (or 1) Format = kAudioFormatMPEG4AAC (default)
Same problem on iPhone 6s Plus !
Do you have any other solutions ?
The solution was provided by someone in issue #249. You need to edit the adjustBuffer method located on line 430 in SCRecorderSession.m:
- (CMSampleBufferRef)adjustBuffer:(CMSampleBufferRef)sample withTimeOffset:(CMTime)offset andDuration:(CMTime)duration {
CMItemCount count;
CMSampleBufferGetSampleTimingInfoArray(sample, 0, nil, &count);
CMSampleTimingInfo *pInfo = malloc(sizeof(CMSampleTimingInfo) * count);
CMSampleBufferGetSampleTimingInfoArray(sample, count, pInfo, &count);
for (CMItemCount i = 0; i < count; i++) {
pInfo[i].decodeTimeStamp = CMTimeSubtract(pInfo[i].decodeTimeStamp, offset);
pInfo[i].presentationTimeStamp = CMTimeSubtract(pInfo[i].presentationTimeStamp, offset);
pInfo[i].duration = duration;
}
CMSampleBufferRef sout = sample;
// CMSampleBufferCreateCopyWithNewTiming(nil, sample, count, pInfo, &sout);
free(pInfo);
return sout;
}
@rFlex Is this line required? We can fill a PR to remove it if it's not required
@crsantos Looking forward to @rFlex's response. Although removing the line in my comment above fixes the issue, I'm not sure if it will cause problems elsewhere as I haven't been working with SCRecorder long enough.
Removing the line also fixed it for me. Just wondering if this line is required for something else or not... If someone has the answer...
SCRecorder crashes when I remove that line