Skip to content

Commit

Permalink
Processing .mp4 file generates a black screen video with audio. rs#79
Browse files Browse the repository at this point in the history
  • Loading branch information
jnavarrom committed Jul 27, 2018
1 parent af4728e commit d9b78e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions SDAVAssetExportSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@ - (AVMutableVideoComposition *)buildDefaultVideoComposition
CGSize targetSize = CGSizeMake([self.videoSettings[AVVideoWidthKey] floatValue], [self.videoSettings[AVVideoHeightKey] floatValue]);
CGSize naturalSize = [videoTrack naturalSize];
CGAffineTransform transform = videoTrack.preferredTransform;

CGRect rect = {{0, 0}, naturalSize};
CGRect transformedRect = CGRectApplyAffineTransform(rect, transform);
// transformedRect should have origin at 0 if correct; otherwise add offset to correct it
transform.tx -= transformedRect.origin.x;
transform.ty -= transformedRect.origin.y;


// Workaround radar 31928389, see https://github.com/rs/SDAVAssetExportSession/pull/70 for more info
if (transform.ty == -560) {
transform.ty = 0;
Expand Down

0 comments on commit d9b78e1

Please sign in to comment.