0

Stop motion app

Trying to get frame duration (/.5)set by users value received from a stepper: self.stepperValue;

Original settings hard coded value of five frames a second

// 5 fps - taking 5 pictures will equal 1 second of video
frameDuration = CMTimeMakeWithSeconds(1./5., 90000);

Now trying with frames per second determined by stepper value, What I've tried so far (stepperValue is being read correctly)

 int x = self.stepperValue;
 frameDuration = CMTimeMakeWithSeconds(1./x, 90000);

This results on nothing being captured

second attempt

 float a = ([_stepperValue.text floatValue]);


// 5 fps - taking 5 pictures will equal 1 second of video
frameDuration = CMTimeMakeWithSeconds(1./a, 90000);

This results in a standard 5 frames per second value no matter value is entered form the stepper

JSA986
  • 5,870
  • 9
  • 45
  • 91
  • [This post](http://stackoverflow.com/questions/4001755/trying-to-understand-cmtime-and-cmtimemake) may be helpful – jprofitt Aug 18 '13 at 14:37
  • Already checked that out it explains about `CMTimeMakeWithSeconds` but not how to add float values, int values etc to the mix, unless ive missed something will re visit – JSA986 Aug 18 '13 at 14:39
  • Ok revisited the link thanks to your comment and float64 seems to be trick here. Thanks – JSA986 Aug 18 '13 at 14:46

1 Answers1

0

Fixed this

 Float64 seconds = ([_stepperValue.text floatValue]);

 frameDuration = CMTimeMakeWithSeconds(1./seconds, 90000);
JSA986
  • 5,870
  • 9
  • 45
  • 91