Skip to content

Commit

Permalink
Issue rs#79 - Processing .mp4 file generates a black screen video wit…
Browse files Browse the repository at this point in the history
…h audio
  • Loading branch information
Shy Aberman committed Sep 13, 2019
1 parent 9db5d13 commit 957aa3a
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;

// Issue rs#79 - Processing .mp4 file generates a black screen video with audio
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 957aa3a

Please sign in to comment.