Questions tagged [cmtime]

CMTime structs are non-opaque mutable structs representing times (either timestamps or durations). A CMTime is represented as a rational number, with a numerator (an int64_t value), and a denominator (an int32_t timescale). A flags field allows various non-numeric values to be stored (+infinity, -infinity, indefinite, invalid). There is also a flag to mark whether or not the time is completely precise, or had to be rounded at some point in its past.

CMTime structs are non-opaque mutable structs representing times (either timestamps or durations).

A CMTime is represented as a rational number, with a numerator (an int64_t value), and a denominator (an int32_t timescale). A flags field allows various non-numeric values to be stored (+infinity, -infinity, indefinite, invalid). There is also a flag to mark whether or not the time is completely precise, or had to be rounded at some point in its past.

CMTimes contain an epoch number, which is usually set to 0, but can be used to distinguish unrelated timelines: for example, it could be incremented each time through a presentation loop, to differentiate between time N in loop 0 from time N in loop 1.

Click here for Apple Documentaion of CMTime class.

98 questions
6
votes
1 answer

Undefined symbols for architecture i386: "_CMTimeMake", referenced from:

I don't understand why this is happening. I'm trying to us CMTimeMake: CMTime cmTime = CMTimeMake(60, 1); The imports of .h are: #import #import #import and .m are: #import…
Jacksonkr
  • 31,583
  • 39
  • 180
  • 284
6
votes
1 answer

Creating a time range for AVAssetExportSession

I was wondering how to make a time range for AVAssetExportSession from time stamps such as: NSTimeInterval start = [[NSDate date] timeIntervalSince1970]; NSTimeInterval end = [[NSDate date] timeIntervalSince1970]; The code that I am using for my…
user1273431
  • 73
  • 1
  • 6
5
votes
2 answers

I cannot get a precise CMTime for Generating Still Image from 1.8 second Video

Every time I try to generate a still frame from my video asset, it is generated at a time of 0.000.. seconds. I can see this from my log message. The good thing is that I can get the image at time 0.000.. to show up in a UIImageView called…
johntraver
  • 3,612
  • 18
  • 17
5
votes
1 answer

Swift iOS -CMTimeMakeWithSeconds: warning: error of -0.433 introduced due to very low timescale

I'm using AVPlayer to play a video. I followed this video tutorial Let's Build That App I use a UISlider/scrubber to go along with the current frame/time of the video. I have a video that is 10.43 seconds and I use a fast forward function that takes…
Lance Samaria
  • 17,576
  • 18
  • 108
  • 256
5
votes
4 answers

How to get thumbnail image of video from ALAsset in iOS?

I want to get thumbnail images of every frame from video and then save this images in Mutable Array of images. I want to use this images to play as a animation. NSURL* assetURL = [self.asset valueForProperty:ALAssetPropertyAssetURL]; NSDictionary*…
Kumar
  • 1,882
  • 2
  • 27
  • 44
4
votes
4 answers

Save audio with fade in fade out with setVolumeRampFromStartVolume not working in iOS

I am trying to cut an audio file for an iPhone project. I can cut it and save it, but any fade in / fade out that I try to apply doesn't work, the audio file is just saved cutted but not faded. I am using the following code: // // NO PROBLEMS TO SEE…
Marc
  • 1,029
  • 1
  • 10
  • 27
4
votes
0 answers

iOS swift: Should I embed CMTimingInfo in Elementary Stream (to be sent over the network) along with H264 parameters and CMBlockBuffer?

I used the following stackoverflow posts to extract h264 parameters , so I can send an elementary stream over the network and the receiving application will reconstruct CMSampleBuffer. However, no video image was displayed on…
James Park
  • 91
  • 1
  • 4
4
votes
2 answers

AVCaptureDevice: comparing samplebuffer timestamps

I have a video AVCaptureDevice (AVMediaTypeVideo), am decreasing the exposure briefly using setExposureTargetBias:completionHandler and then restoring it again. I need to know exactly which buffer in…
Dickson
  • 211
  • 1
  • 11
4
votes
1 answer

Converting AudioBuffer to CMSampleBuffer with accurate CMTime

The goal here is to create a mp4 file via video through AVCaptureDataOutput and audio recorded a CoreAudio. Then send the CMSampleBuffers of both to an AVAssetWriter who has accompanying AVAssetWriterInput(AVMediaTypeVideo) and…
4
votes
3 answers

Check CMTime Equals

Is there any method to check a CMTime is equal to another CMTime. In my case I need to check CMTime is equal to KCMTimeZero. I tried CMTimeCompare method, but it will be True for all the CMTimes which is equal to KCMTimeZero or greater than…
Vishnu Kumar. S
  • 1,797
  • 1
  • 15
  • 35
4
votes
4 answers

How to add CMTime to NSMutableDictionary?

I'm currently attempting to add some video clip settings to a NSMutableDictionary, including two CMTime objects. I am trying to store the video stream in use (indicated with an integer), the clip duration (CMTime) and the clip start time (CMTime),…
m23
  • 43
  • 1
  • 3
3
votes
1 answer

Converting CMTime To String is wrong value return

I want CMTime to String an human readable. So I Found below code. extension CMTime { var durationText:String { let totalSeconds = CMTimeGetSeconds(self) let hours:Int = Int(totalSeconds / 3600) let minutes:Int =…
oddK
  • 261
  • 4
  • 14
3
votes
2 answers

Receiving Fatal error: Double value cannot be converted to Int because it is either infinite or NaN

The code is for a podcasting app. import AVKit extension CMTime { func toDisplayString() -> String { let totalSeconds = Int(CMTimeGetSeconds(self)) let seconds = totalSeconds % 60 let minutes = totalSeconds / 60 let timeFormatString…
user10628073
3
votes
1 answer

preferredTimescale in CMTimeMakeWithSeconds

I am implementing custom camera and for that I want to set exposure duration. My code for setting slider's properties is- slider.maximumValue = Float(CMTimeGetSeconds(camera.activeFormat.maxExposureDuration)) slider.minimumValue =…
Nikhil Manapure
  • 3,748
  • 2
  • 30
  • 55
3
votes
2 answers

CMTime in AVPlayer's addPeriodicTimeObserverForInterval: callback never reaches item's duration

I use AVPlayer's -(id)addPeriodicTimeObserverForInterval: queue: usingBlock: method to update UI up to playback progress. However, my progress bar never reaches end. CMTime duration = self.player.currentItem.asset.duration; float totalSeconds =…
kerd
  • 307
  • 2
  • 13