FairPlay Streaming: calling copyPixelBufferForItemTime on AVPlayerItemVideoOutput returns NULL

Anyone have experience using HLS with Fairplay and have been able to get a pixel buffer?

I am using AVURLAsset with its resourceLoader delegate set. My AVAssetResourceLoaderDelegate takes care of working with the Fairplay process.

It perfectly displays the value of AVPlayerLayer , however, when I try to use AVPlayerItemVideoOutput , which is connected to AVPlayerItem and uses copyPixelBufferForItemTime on it, the returned pixel buffer is always NULL.

On the other hand, when I use an unencrypted stream and do not use resourceLoader, copyPixelBufferForItemTime returns a pixel buffer as expected.

Is this the intended work? (i.e. streams protected using FairPlay do not expose their pixel buffer to prevent misuse.)

And if not, is there a way to get the pixel buffer from a stream that is protected by FairPlay on iOS?

0
source share
2 answers

After further study of this issue, I came to the conclusion that Apple designed its AVPlayer in such a way that as soon as you use HPS with FairPlay protection, the only exit point (see A :) for decrypted data copyPixelBufferForItemTime always returns zero.

  • I tested the same stream without encryption, and copyPixelBufferForItemTime returns a link to the pixel buffer as expected.
  • I tested the same encrypted stream on AVPlayerLayer and displayed the video as freed.

It seems that when you use FairPlay, the only way to display protected video content is to use AVPlayerLayer . It seems that today there is no way to extract FairPlay protected HPS files from the Apple API to display them on an OpenGL texture in 3D space, for example.

A: copyPixelBufferForItemTime is the only exit point since calling renderInContext on AVPlayerLayer does not work

0
source

I ran into the same problem when using AVURLAsset with its resourceLoader delegate set. Unlike your situation, there are two types of real-time decrypted content, and one of them can get a pixel buffer, and the other can not. I am not sure if this is related to the contents of the m3u8 file.

Content that can extract a pixel buffer and get a thumbnail.

 #EXTM3U #EXT-X-VERSION:2 #EXT-X-KEY:METHOD=AES-128,URI="http://xxx.xxxx.net/key/xxx",IV=0xxxx #EXT-X-TARGETDURATION:10 #EXT-X-MEDIA-SEQUENCE:11601809 #EXTINF:10, no desc #EXT-X-PROGRAM-DATE-TIME:2019-05-28T11:00:10Z stream_index_20190331T232744_1_11601809.ts #EXTINF:10, no desc #EXT-X-PROGRAM-DATE-TIME:2019-05-28T11:00:20Z stream_index_20190331T232744_1_11601810.ts 

Content that cannot receive a pixel buffer

 #EXTM3U #EXT-X-VERSION:8 #EXT-X-INDEPENDENT-SEGMENTS #EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audiod",NAME="en",DEFAULT=YES,AUTOSELECT=YES,LANGUAGE="eng",URI="Audio3_2.m3u8" #EXT-X-STREAM-INF:BANDWIDTH=3000000,AVERAGE-BANDWIDTH=3000000,VIDEO-RANGE=PQ,CODECS="dvh1.05.06",RESOLUTION=1920x1080,FRAME-RATE=50.000,AUDIO="audiod",CLOSED-CAPTIONS=NONE,HDCP-LEVEL=TYPE-1 Video1_1.m3u8 
0
source

Source: https://habr.com/ru/post/886585/


All Articles