SCRecorder
SCRecorder copied to clipboard
Setting RecordSession VideoAffineTranform doesn't work in SCPlayer
Hi rFlex,
I'm using your recorder to record a video and when I set the RecordSession VideoAffineTransform it doesnt apply when i play the video from its asset in SCPlayer.
This is my transform session.videoAffineTransform = CGAffineTransformMake(-1.0, 0.0, 0.0, 1.0, 640, 0.0);
I set the player with [_player setItemByAsset:[_recordSession assetRepresentingRecordSegments]];
However when it plays it does not have the video mirrored.
When I play the video in a AVPlayer it has the video mirrored.
Any idea why this may be happening, is it possibly due to the way it grabs each frame and puts it onto the imageview?
Thanks, zoruc
I also saw this issue a while ago, I couldn't figure out why when setting the affine transform inside the AVAssetWriter, I don't see that transform on the resulting created AVAsset. The SCPlayer reads the requested transform from the AVAsset and applies it, but on that case it didn't see any special transform. What effect are you trying to do?
Hi rFlex, Sorry about getting back to you so late on this but in my app I use SCPlayer to read the asset before the user sends it. When recording from the front facing camera I want it to be played exactly like its being recorded so I apply this to it self.recordSession.videoAffineTransform = CGAffineTransformMake(-1.0, 0.0, 0.0, 1.0, 640, 0.0); When this sends and is played on a AVPlayer class the video is correctly displayed in the mirrored fashion. Do you know any better way for when recording on the front camera for a segment the video can be mirrored so it looks like it is when its getting recorded on a SCPlayer.
Thanks, zoruc
Hi rFlex, I am stuck on same point. When recording from the front facing camera I want it to be played exactly like its being recorded. But it didn't work. Could you help me on this, so that while recording using front camera, video will not rotated and save as it displayed while recording.
Thanks, Jeet
Hi @rFlex
I found a way may help to fix this issue:
in setDevice:
if( _device == AVCaptureDevicePositionFront ){
AVCaptureConnection *connection = [_photoOutput connectionWithMediaType:AVMediaTypeVideo];
if ( [connection isVideoMirroringSupported] ) {
connection.videoMirrored = YES;
}
connection = [_videoOutput connectionWithMediaType:AVMediaTypeVideo];
if ( [connection isVideoMirroringSupported] ) {
connection.videoMirrored = YES;
}
connection = [_movieOutput connectionWithMediaType:AVMediaTypeVideo];
if ( [connection isVideoMirroringSupported] ) {
connection.videoMirrored = YES;
}
}else{
AVCaptureConnection *connection = [_photoOutput connectionWithMediaType:AVMediaTypeVideo];
if ( [connection isVideoMirroringSupported] ) {
connection.videoMirrored = NO;
}
connection = [_videoOutput connectionWithMediaType:AVMediaTypeVideo];
if ( [connection isVideoMirroringSupported] ) {
connection.videoMirrored = NO;
}
connection = [_movieOutput connectionWithMediaType:AVMediaTypeVideo];
if ( [connection isVideoMirroringSupported] ) {
connection.videoMirrored = NO;
}
}
This code runs well in my project.
@jzblog Have you tried this code for capturing with both front and back camera?