-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
@Double-Insta360
Im recording the 360 video using your SDK in iphone.
Now the issue is the recording is perfect with the stabilisation but the recording is slightly 2 or 3 degree angle moved. not perfect horizontaly.
see im attaching the screenshot.
Android recording:
Ios recording:
The android recording is perfect but the ios recording is not perfect.
here is the code of exporting
`let socketState = INSCameraManager.socket().cameraState
if socketState == .connected {
print("Socket connection established! Proceeding with download...")
timer.invalidate()
// Create a temporary file path for the downloaded video
let tempFileName = "temp_\(timestamp).insv"
let tempURL = documentsPath.appendingPathComponent(tempFileName)
// Use socket command manager for downloads (WiFi connection)
let socketCommandManager = INSCameraManager.socket().commandManager
print("Downloading video from camera via WiFi socket...")
// Download the video file from camera using fetchResource via socket (WiFi)
let downloadTask = socketCommandManager.fetchResource(
withURI: videoURI,
toLocalFile: tempURL,
progress: { [weak self] (progress: Progress?) in
guard let self = self, let progress = progress else { return }
let downloadProgress = Float(progress.completedUnitCount) / Float(progress.totalUnitCount)
let downloadPercentage = Int(downloadProgress * 100)
let totalProgress = downloadProgress * 0.5
DispatchQueue.main.async {
self.updateExportProgressDialog(progress: totalProgress, message: "Downloading video... \(downloadPercentage)%")
}
},
completion: { [weak self] (error: Error?) in
guard let self = self else {
result("failed_download")
return
}
if let error = error {
// If socket connection failed, try getting WiFi info via Bluetooth and provide guidance
self.handleDownloadFailure(videoURI: videoURI, tempURL: tempURL, outputURL: outputURL, result: result)
return
}
print("✅ [iOS] Video downloaded successfully to: \(tempURL.path)")
// Now export/stitch the video using INSExportSimplify with local file
self.exportVideoWithINSExportSimplify(inputURL: tempURL, outputURL: outputURL)
}
)
}
private func exportVideoWithINSExportSimplify(inputURL: URL, outputURL: URL) {
print("Starting video export with INSExportSimplify...")
// Store input and output URLs for later retrieval and cleanup
self.exportInputURL = inputURL // Store temp file for cleanup after export
self.exportOutputURL = outputURL
// Initialize INSExportSimplify with input and output URLs
let inputURLs = [inputURL]
let exporter = INSExportSimplify(urls: inputURLs, outputUrl: outputURL)
// Configure export parameters (matching Android settings exactly)
// Android: setWidth(2048), setHeight(1024), setFps(30), setBitrate(20 * 1024 * 1024), setStabType(STAB_TYPE_PANORAMA)
exporter.width = 2048
exporter.height = 1024
exporter.fps = 30
exporter.bitrate = 20 * 1024 * 1024 // 20 MB
// Set stitching type to Disflow (matching Android ExportMode.PANORAMA)
exporter.opticalFlowType = .disflow // Use Disflow stitching (matches Android)
// Set stabilization mode for PANORAMA (matching Android setStabType(STAB_TYPE_PANORAMA))
// For PANORAMA mode, use PanoFPV which is the panorama-specific stabilization mode
exporter.stabMode = .fullDirectional // Full Directional mode for balanced horizon without shaking
// Set delegate for progress callbacks (like the example app does)
exporter.exportManagedelegate = self
// Store exporter reference
self.videoExporter = exporter
// Start export
if let error = exporter.start() {
DispatchQueue.main.async { [weak self] in
self?.dismissExportProgressDialog()
}
// Clean up temporary file if it's a downloaded file
if inputURL.path.contains("temp_") {
try? FileManager.default.removeItem(at: inputURL)
}
exportInputURL = nil
exportResultCallback?("failed_export_start")
exportResultCallback = nil
exportOutputURL = nil
return
}
print("Export started successfully")
}`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels