51282

AVAssetExportSession no audio (iPhone), works on iPad

We're trying to take an existing video with audio (.mov) and make a more email friendly version. Seems pretty straightforward and the code below does just what we need ... almost.

On an iPad2 (4.3.3) it works in debug & release builds all of the time. On the iPhone 4 (4.3.3) or 4th gen iPod Touch there's no audio. From time to time, no obvious correlation as to what triggers it, it will start working on the iPhone. Delete the app, rebuild/install, and it no longer works.

AVURLAsset* asset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:sourcePath] options:nil]; session = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetLowQuality]; session.outputURL = [NSURL fileURLWithPath:destPath]; session.outputFileType = AVFileTypeQuickTimeMovie; session.shouldOptimizeForNetworkUse = YES; [session exportAsynchronouslyWithCompletionHandler:^{ [self performSelectorOnMainThread:@selector(conversionFinished) withObject:nil waitUntilDone:NO]; }];

Answer1:

Are you playing the movie too, for example in an MPMoviePlayer? I have had some occasional export quirks while playing or using other initialized assets with the same URLs.

Recommend

  • Gaussian Mixture Model in MATLAB - Calculation of the Empirical Variance Covariance Matrix
  • vectorizing an R-loop with backward dependency
  • Detecting Windows Tablet (touch windows devices) with Jquery
  • Not able to send json tweets events to Kafka topic/producer using kafka command line
  • iOS conditional link static library
  • Algorithms that lead to java.lang.OutOfMemoryError: PermGen space error
  • Outlook 365 add-in only appears in Outlook 2013 client
  • extracting evidence of equality from match
  • Avoid UIWebView load iTunes App
  • Sitecore 8: Number of Recipients in List Manager not calculating properly
  • Kendo UI Timepicker custom interval format
  • How to stop auto-refreshing of SBT modules upon opening project in IDEA?
  • How will Roslyn help me in avoiding a recompile to deploy changes to my ASP.NET website?
  • Table field that holds row count from another table
  • How does CoreLocation locate the device?
  • Spring Integration debounce/deduplicate
  • iOS 9 custom transition - animationControllerForDismissedController not called
  • jQuery Mobile - Dialogs without changing hash
  • Can't connect Entity Framework to local SQL Server Express
  • Sympy: working with equalities manually
  • Can my app be notified when another application starts/stops playing audio?
  • Why does Sencha 2 only work in Webkit browsers?
  • How to add the custom button on google's(device) native application in android?
  • retrieving data from url in iphone
  • Is there any way to call saveCurrentTurnWithMatchData without sending a push notification?
  • change search magnifying glass to UIActivityIndicatorView
  • Efficient User-Agent Regex to find Safari in Python
  • Is it possible to get the word under the mouse cursor in a ``?
  • Blackberry 6: how to detect a long click on track pad?
  • Access user's phone number on iOS 7
  • OSX - always hide certain files
  • Compiling dlib on OS X
  • How to generate and display a QR Code in ionic 2
  • ViewController With Transparent Background Entering Current ViewController With Push Transition
  • Make VS2015 use angular-cli ng at build time in a .NET project
  • Exchange data b/w iOS devices using Bluetooth 4.0
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • How can I remove ASP.NET Designer.cs files?
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]