1

We have been to trying to create real-time videos on iOS, but have experienced many frustrating problems with AVAssetWriter like this one where the error claims media is being appended after a session ends, though our code does not appear to do this.

Upon reading the Apple docs more carefully, it appears AVAssetWriter is not meant for real-time processing:

Note: The asset reader and writer classes are not intended to be used for real-time processing. In fact, an asset reader cannot even be used for reading from a real-time source like an HTTP live stream. However, if you are using an asset writer with a real-time data source, such as an AVCaptureOutput object, set the expectsMediaDataInRealTime property of your asset writer’s inputs to YES. Setting this property to YES for a non-real-time data source will result in your files not being interleaved properly.

If not AVAssetWriter, how are you supposed to capture input from the front camera and make a video in real-time (with different overlays/watermarks appearing at different points in the video)?

Crashalot
  • 33,605
  • 61
  • 269
  • 439
  • Use AVToolBox to compress, and a third party library to package. – szatmary Dec 14 '17 at 02:06
  • @szatmary could you kindly elaborate? there only seems to be an audiotoolbox? how do you recommend capturing video on iOS? – Crashalot Dec 14 '17 at 02:19
  • I think you missed VideoToolbox. – szatmary Dec 14 '17 at 02:22
  • @szatmary ahh indeed. :) So instead of AVAssetWriter, you suggest using VideoToolbox and AudioToolbox? Are you aware of any working samples online showing how to use VideoToolbox and AudioToolbox to capture video from the front camera? There doesn't appear to be anything solid on Github or Google. To be clear, we don't need to stream -- just record and save locally onto the user's device. – Crashalot Dec 14 '17 at 02:38
  • You misunderstand the definition of real-time in this context. " just record and save locally onto the user's device" is not real-time. – szatmary Dec 14 '17 at 02:43
  • @szatmary ok, makes sense! thanks for answering. you don't happen to know the answer to this avassetwriter issue do you (https://stackoverflow.com/questions/41647342/avassetwriter-error-cannot-append-media-data-after-ending-session)? – Crashalot Dec 14 '17 at 02:48
  • @szatmary btw could you please post as an answer so you can receive the points? thanks again! – Crashalot Dec 27 '17 at 23:13

0 Answers0