# Segmentation duration not matching

**URL:** <https://community.wowza.com/t/segmentation-duration-not-matching/48168>\
**Category:** Wowza Developer Dojo\
**Tags:** wowza-streaming-server-java-api\
**Created:** [February 22, 2017, 5:49pm UTC](https://community.wowza.com/t/segmentation-duration-not-matching/48168 "2017-02-22T17:49:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lorenzo\_Santoro](https://avatars.discourse-cdn.com/v4/letter/l/b2d939/32.png) [@Lorenzo\_Santoro](https://community.wowza.com/u/Lorenzo_Santoro)\
**Post date:** [February 22, 2017, 5:49pm UTC](https://community.wowza.com/t/segmentation-duration-not-matching/48168/1 "2017-02-22T17:49:53Z")

</div>

Hi, I need to record a stream divided by files of exactly the same duration.

The problem is they’re always one or two seconds longer. I thought it was because the recorder waits for a key frame to close the current file and open a new one, so i tried by setting

```auto
recordParametersVideo.startOnKeyFrame = false

```

but the result is always the same.

Here is my code

```auto
StreamRecorderParameters recordParametersVideo = new StreamRecorderParameters(appInstance);   
recordParametersVideo.segmentationType = IStreamRecorderConstants.SEGMENT_BY_DURATION;
recordParametersVideo.segmentDuration = 10*60*1000;
recordParametersVideo.startOnKeyFrame = false;
recordParametersVideo.recordData = false;
recordParametersVideo.outputPath = "/some/dir/";	
recordParametersVideo.fileTemplate = "segment${SegmentNumber}";
recordParametersVideo.fileFormat = IStreamRecorderConstants.FORMAT_MP4;
		
final ILiveStreamRecordManager recorder = vhost.getLiveStreamRecordManager();
recorder.startRecording(appInstance, "streamToRecord", recordParametersVideo);

```

Wowza docs say:

> public boolean startOnKeyFrame
> 
> Configures whether or not the recorder will wait until a video key frame is received to start writing packets to the output file, thus ensuring the first packet in the file contains a video key frame.

If so setting it to false shouldn’t cause duration differences.

May I have misunderstood the function of StreamRecorderParameters.startOnKeyFrame? Or maybe the cause of my problem is another one?
