2013-07-17 24 views
3

在我的應用我記錄和保存使用AVCapture/AssetsLibrary.When我記錄在縱向記錄的視頻的方向是確定的視頻,但是當我在風景拍攝錄製的視頻的定位是90度這是不好,我需要幫助解決這個問題。 我的代碼..錄製的視頻定位問題

在我appDelegate.m

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{ 

    NSUInteger orientations = UIInterfaceOrientationMaskAllButUpsideDown; 

    if(self.window.rootViewController){ 
     UIViewController *presentedViewController = [[(UINavigationController *)self.window.rootViewController viewControllers] lastObject]; 
     orientations = [presentedViewController supportedInterfaceOrientations]; 
    } 

    return orientations; 
} 

和myViewController.m

- (NSUInteger)supportedInterfaceOrientations{ 

    return UIInterfaceOrientationMaskPortrait; 
} 

捕獲會話方向

AVCaptureConnection *CaptureConnection = [MovieFileOutput connectionWithMediaType:AVMediaTypeVideo]; 
if ([CaptureConnection isVideoOrientationSupported]) 
{ 
    AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationPortrait; 

    [CaptureConnection setVideoOrientation:orientation]; 
} 

感謝,

+0

你是如何配置的方向捕獲會話? – Wain

+0

@請看我編輯的代碼! – Machete

回答

0

設置CaptureVideoOrientation.i.e:

AVCaptureVideoOrientation orientation =AVCaptureVideoOrientationLandscapeRight 
0

旋轉元數據由移動記錄裝置連同的.mp4或.mov視頻保存。如果玩家你使用支持旋轉元數據,你會看到

圖片提供的 Rotation Metadata in Video Files Created by Mobile Devices

Rotation Metadata in Video Files Created by Mobile Devices

它可以有4個值:0,90,180和270縱向視頻(90°)顯示爲縱向。如果不是這樣,你會把它看作景觀。不支持它(上面列表形式的鏈接)

玩家:

  • 火狐42
  • 歌劇院在Mac
  • 媒體播放器經典