Open govind300 opened 5 years ago
Hi team,
While using your library, I noticed that after merging recorded video file in portrait mode from camera and audio, the video was converted and displayed in landscape mode Please help to fix this.
Thanks! Tony
In VideoGenerator.swift if you add the line commented below this will fix the orientation problem.
if let aVideoAssetTrack: AVAssetTrack = aVideoAsset.tracks(withMediaType: .video).first, let aAudioAssetTrack: AVAssetTrack = aAudioAsset.tracks(withMediaType: .audio).first {
//fixes the orientation issue
mutableCompositionVideoTrack.first?.preferredTransform = aVideoAssetTrack.preferredTransform
do {
try mutableCompositionVideoTrack.first?.insertTimeRange(CMTimeRangeMake(start: CMTime.zero, duration: aVideoAssetTrack.timeRange.duration), of: aVideoAssetTrack, at: CMTime.zero)
try mutableCompositionAudioTrack.first?.insertTimeRange(CMTimeRangeMake(start: CMTime.zero, duration: aVideoAssetTrack.timeRange.duration), of: aAudioAssetTrack, at: CMTime.zero)
} catch{
print(error)
}
totalVideoCompositionInstruction.timeRange = CMTimeRangeMake(start: CMTime.zero,duration: aVideoAssetTrack.timeRange.duration)
}
I've submitted a pull request with this change.
Hello team, Thanks for this amazing library.
While using your library I found an issue, when I am merging two landscape recorded videos (1st from back camera and 2nd from the front camera in iPhone 7) the 1st video gets wrong orientation in my case flipped upside down.
It will be really helpful if you solve this issue as soon as possible.
again thanks for your contribution to the community.