2012-08-27 4 views
0

동영상이 드롭 프레임인지 논스톱 프레임인지 확인해야합니다.비디오 파일이 NDF인지 DF인지 (드롭 프레임인지 논스톱 프레임인지)

xcode 비디오 프레임 워크 (QTMovie 또는 AVFoundation의 비디오 프레임 워크) 중 하나에서 비디오 파일의 속성에서 찾으려고합니다. 운이별로 없다.

나는 FCP-X XML 파일에 필요한 정보를 채우기 위해이 작업을 수행하고 있습니다.

아무도이 경험이 있습니까?

중요한 메모는 64 비트 환경에서 작업 중이므로 그대로 있어야합니다.

답변

1

CMTimeCodeFormatDescriptionGetTimeCodeFlags()을 사용하면 지정된 시간 코드 형식 설명 ref에 대한 시간 코드 플래그를 가져올 수 있습니다. AVAssetTrackformatDescriptions을 입력하여 형식 설명 ref를 가져올 수 있습니다.

나는 그것을 같이 보일 것이라고 생각 :

BOOL isDropFrame (AVAssetTrack* track) 
{ 
    BOOL result = NO; 
    NSArray* descriptions = [track formatDescriptions]; 
    NSEnumerator* descriptionEnum = [descriptions objectEnumerator]; 
    CMFormatDescriptionRef nextDescription; 
    while ((!result) && ((nextDescription = (CMFormatDescriptionRef)[descriptionEnum nextObject]) != nil)) 
    { 
     if (CMFormatDescriptionGetMediaType(nextDescription) == kCMMediaType_TimeCode) 
     { 
      uint32_t timeCodeFlags = CMTimeCodeFormatDescriptionGetTimeCodeFlags ((CMTimeCodeFormatDescriptionRef)nextDescription); 
      result = ((timeCodeFlags & kCMTimeCodeFlag_DropFrame) != 0); 
     } 
    } 
    return result; 
} 
+0

감사합니다! 나는 이것을 작동 시키려고 노력하면서 약간의 시간을 보냈고, 그 문법에 대해서는 완전히 명확하지 않다. AVAssetTrack에서 formatDescriptions를 호출하고 배열을 반환하지만 적절한 "CMTimeCodeFormatDescriptionRef desc"를 CMTimeCodeFormatDescriptionGetTimeCodeFlags()에 배치하는 방법을 모르겠습니다. 예제를 제공해 주시겠습니까? – mxisaac

+0

몇 가지 코드를 추가했습니다 (메모리에서 확인하십시오!). – user1118321

+0

이것은 그 것처럼 보입니다! 내가해야만하는 유일한 변화는 (CMFormatDescriptionRef) [descriptionEnum nextObject]를 캐스팅하는 것이 었습니다. 그리고 하나의 철자법 오류 ... 나는 대답을 수정합니다. – mxisaac