---
title: "How to set session AVAssetExportSession in ios?"  
description: "How to set session AVAssetExportSession in ios?"  
author: "marcel ethan"  
published: 2014-10-17  
updated: 2014-10-18  
canonical: https://www.mindstick.com/forum/2413/how-to-set-session-avassetexportsession-in-ios  
category: "iphone"  
tags: ["iphone", "ios"]  
reading_time: 2 minutes  

---

# How to set session AVAssetExportSession in ios?

```
NSArray *pres = [AVAssetExportSession exportPresetsCompatibleWithAsset:asset];        if([pres containsObject:AVAssetExportPreset640x480]) {            AVAssetExportSession *session = [[AVAssetExportSession alloc]initWithAsset:asset presetName:AVAssetExportPreset640x480];            FileManagerUtilities *fUtil = [[FileManagerUtilities alloc]init];            session.outputURL = [NSURL fileURLWithPath:[fUtil searchPathDirectory:NSDocumentDirectory byAppendingDirectoryPath:nil andFileName:@"tempVideo.mov"]];            session.outputFileType = AVFileTypeQuickTimeMovie;            session.fileLengthLimit = 10.0;            [session exportAsynchronouslyWithCompletionHandler:^{                switch ([session status]) {                    case AVAssetExportSessionStatusFailed:                        NSLog(@"Export failed: %@", [[session error] localizedDescription]);                        break;                    case AVAssetExportSessionStatusCancelled:                        NSLog(@"Export canceled");                        break;                    default:                        break;                }            }];        }
```

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to set [session](https://www.mindstick.com/articles/12042/session-in-c-sharp).fileLengthLimit to 10mb but don't know what [mistake](https://yourviews.mindstick.com/view/88393/ai-humanity-s-greatest-invention-or-final-mistake) I am doing. Unable to [limit](https://www.mindstick.com/forum/159824/explain-the-purpose-of-the-limit-and-offset-clauses-and-how-are-they-used-for-pagination) the [size](https://www.mindstick.com/forum/159799/how-can-you-manage-the-size-of-mdf-and-ldf-files) to 10mb, how to set fileLengthLimit to 10mb.\

## Replies

### Reply by Jayden Bell

\
An **AVAssetExportSession** object transcodes the contents of an AVAsset source object to create an output of the form described by a specified export preset.\
\
The fileLenghtLimit should be in bytes, ie:\
\
session.fileLengthLimit = 10*1024*1024;\


---

Original Source: https://www.mindstick.com/forum/2413/how-to-set-session-avassetexportsession-in-ios

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
