iOS Video: More than 4 simultaneous AVAssetReaders possible?

后端 未结 3 1008
夕颜
夕颜 2021-01-03 10:37

I would like to render multiple H264 mp4 videos on multiple views at the same time. Target is to read about 8 short videos, each at a size of 100x100 pixels and let them dis

相关标签:
3条回答
  • 2021-01-03 10:50

    Here's my latest iteration of a perfectly smooth-scrolling collection view with real-time video previews (up to 16 at a time):

    https://youtu.be/7QlaO7WxjGg

    It even uses a cover flow custom layout and "reflection" view that mirrors the video preview perfectly. The source code is here:

    http://www.mediafire.com/download/ivecygnlhqxwynr/VideoWallCollectionView.zip

    0 讨论(0)
  • 2021-01-03 10:57

    Yes, iOS has an upper limit on the number of videos that can be decoded at one time. While your approach is good, I don't know of any way to work around this upper limit as far as having that many h.264 decoders active at once. If you are interested, please have a look at my solution to this problem, this is an xcode project called Fireworks. Basically, this demo shows decoding a bunch of alpha channel videos to disk, then each one is played by mapping a portion of the video files into memory. This approach makes it possible to decode more than 4 movies at the same time without using up all the system memory and without running into the hard limit of the number of h.264 decoder objects.

    0 讨论(0)
  • 2021-01-03 11:03

    Have you tried creating separate AVPlayerItems based on the same AVAsset for each AVPlayerLayer?

    0 讨论(0)
提交回复
热议问题