Currently,I am using SDAVAssetExportSession https://github.com/rs/SDAVAssetExportSession project instead of standard  AVAssetExportSession because  SDAVAssetExportSession gives me access to set following settings
  exportSessionSDA!.outputFileType = AVFileTypeMPEG4
        exportSessionSDA!.shouldOptimizeForNetworkUse = true
        exportSessionSDA.videoSettings = [AVVideoCodecKey: AVVideoCodecH264, AVVideoWidthKey: 800, AVVideoHeightKey: 600, AVVideoCompressionPropertiesKey: [AVVideoAverageBitRateKey: 6000000, AVVideoProfileLevelKey: AVVideoProfileLevelH264High40]]
        exportSessionSDA.audioSettings = [AVFormatIDKey: kAudioFormatMPEG4AAC, AVNumberOfChannelsKey: 2, AVSampleRateKey: 44100, AVEncoderBitRateKey: 128000]
I want these settings in standard AVAssetExportSession as  SDAVAssetExportSession is creating an error 
SDAVAssetExportSession error
-[AVAssetWriter startSessionAtSourceTime:] invalid parameter not satisfying: CMTIME_IS_NUMERIC(startTime)
Mainly what i want is to compress video size. How to achieve this?
Recorded video source is available as mp4..
mycode
func sdExport(_ videoURL: URL)
{
         let avAsset1 = AVURLAsset(url: videoURL, options: nil)
          print("AVURLAsset1 ",avAsset1)
        let avAsset = AVURLAsset(url: ((videoURL as NSURL) as URL), options: nil)
         print("AVURLAsset2 ",avAsset)
        let startDate = Foundation.Date()
        //Create Export session
       // exportSessionSDA = SDAVAssetExportSession(asset: avAsset, presetName: AVAssetExportPresetPassthrough)
        exportSessionSDA = SDAVAssetExportSession(asset: avAsset)
        // exportSession = AVAssetExportSession(asset: composition, presetName: mp4Quality)
        //Creating temp path to save the converted video
        let documentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
        let myDocumentPath = URL(fileURLWithPath: documentsDirectory).appendingPathComponent("temp.mp4").absoluteString
        let url = URL(fileURLWithPath: myDocumentPath)
        let documentsDirectory2 = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] as URL
        let filePath = documentsDirectory2.appendingPathComponent("tempConverted/rendered-Video.mp4")
       // deleteFile(filePath)
        //Check if the file already exists then remove the previous file
        if FileManager.default.fileExists(atPath: myDocumentPath) {
            do {
                try FileManager.default.removeItem(atPath: myDocumentPath)
            }
            catch let error {
                print(error)
            }
        }
        exportSessionSDA!.outputURL = filePath
        exportSessionSDA!.outputFileType = AVFileTypeMPEG4
        exportSessionSDA!.shouldOptimizeForNetworkUse = true
        exportSessionSDA.videoSettings = [AVVideoCodecKey: AVVideoCodecH264, AVVideoWidthKey: 800, AVVideoHeightKey: 600, AVVideoCompressionPropertiesKey: [AVVideoAverageBitRateKey: 6000000, AVVideoProfileLevelKey: AVVideoProfileLevelH264High40]]
        exportSessionSDA.audioSettings = [AVFormatIDKey: kAudioFormatMPEG4AAC, AVNumberOfChannelsKey: 2, AVSampleRateKey: 44100, AVEncoderBitRateKey: 128000]
        let start = CMTimeMakeWithSeconds(0.0, 0)
        let range = CMTimeRangeMake(start, avAsset.duration)
        exportSessionSDA.timeRange = range
        exportSessionSDA!.exportAsynchronously(completionHandler: {() -> Void in
            switch self.exportSessionSDA!.status {
            case .failed:
                print("%@",self.exportSessionSDA?.error)
            case .cancelled:
                print("Export canceled")
            case .completed:
                //Video conversion finished
                let endDate = Foundation.Date()
                let time = endDate.timeIntervalSince(startDate)
                print(time)
                print("Successful!")
                guard let data = NSData(contentsOf: (self.singleTonFile?.fileUrl)!) else {
                    return
                }
                print("File size before compression: \(Double(data.length / 1048576)) mb")
                print("elf.exportSession.outputURL= ",self.exportSessionSDA.outputURL)
                guard let compressedData = NSData(contentsOf: self.exportSessionSDA.outputURL!) else {
                    return
                }
                print("File size after compression: \(Double(compressedData.length / 1048576)) mb")
                let when = DispatchTime.now() + 8
                DispatchQueue.main.asyncAfter(deadline: when)
                {
                    print("video_duration", self.singleTon.video_duration)
                    self.videoUrl() // calling upload
                }
                // self.mediaPath = self.exportSession.outputURL?.path as NSString!
                //  self.singleTon.mediaUrl = URL(self.exportSession.outputURL?.path)
                // print("self.singleTon.mediaUrl ",self.singleTon.mediaUrl)
                //self.mediaPath = String(self.exportSession.outputURL!)
            // self.mediaPath = self.mediaPath.substringFromIndex(7)
            default:
                break
            }
        })
    }