0

I know that this is a frequently asked question which does not have a trivial solution.

Found a demo which does the same - http://blog.denivip.ru/index.php/2017/01/live-streaming-on-ios/?lang=en, but it does not use AVAssetWriter.

People have also suggested using the bento4 library but I want to be able to do it programmatically without creating a new process, and without the latency of having to create a new file, and using AVAssetWriter.

If not possible, why does IOS not have in-built support to create those files using AVAssetWriter using samples?

Is RTSP the only option that Apple recommends for Live Streaming?

user3911119
  • 273
  • 3
  • 14

1 Answers1

0

Answering my question.

  1. Use AVAssetWriter to create sequence of mp4 files.
  2. While reading the files to write to socket, use qt-faststart to create a streamable version of the mp4 file. This is the java equivalent - https://github.com/ypresto/qtfaststart-java/tree/master/src/main/java/net/ypresto/qtfaststart

Looks like ios cannot be asked to do this.

EDIT#1: Sadly, many mp4 files do not seem to have the moov atom at the end. So, back to square one. Is there some way to force the AVAssetWriter to always write the moov atom at least at the end if not beginning?

EDIT#2: Viola! Looks like Apple does support the feature. See this: https://developer.apple.com/documentation/avfoundation/avassetwriter/1389811-shouldoptimizefornetworkuse?language=objc and this: What does shouldOptimizeForNetworkUse actually do?

user3911119
  • 273
  • 3
  • 14