Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

m3u8 file AVAssetImageGenerator error

I am using AVPlayer to play .m3u8 file. Using AVAssetImageGenerator to extract image out of it using following code :

AVURLAsset *asset1 = [[AVURLAsset alloc] initWithURL:mp.contentURL options:nil];
AVAssetImageGenerator *generate1 = [[AVAssetImageGenerator alloc] initWithAsset:asset1];
generate1.appliesPreferredTrackTransform = YES;
NSError *err = NULL;
CMTime time = CMTimeMake(1, 2);
CGImageRef oneRef = [generate1 copyCGImageAtTime:time actualTime:NULL error:&err];
img = [[UIImage alloc] initWithCGImage:oneRef];

It always gives me error :

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x7fb4e30cbfa0 {NSUnderlyingError=0x7fb4e0e28530 "The operation couldn’t be completed. (OSStatus error -12782.)", NSLocalizedFailureReason=An unknown error occurred (-12782), NSLocalizedDescription=The operation could not be completed}

It works for mp4,mov and all major video extensions URL but not for m3u8. Any idea??

like image 390
objectivecdeveloper Avatar asked Aug 20 '15 07:08

objectivecdeveloper


People also ask

What is cannot load M3U8 error?

The “ Cannot Load M3U8″ Error can occur while trying to play a video on the internet. The error might display three different types of messages ie. “ Cross Domain Access Denied “, “ No levels to play ” and “ 404 not found “.

What is the m3u8 file extension?

M3U8 is a playlist file format that contains path or URL pointing to an actual video or audio file or multiple media files. With a M3U8 player for browser or playback extension, you are able to play M3U8 files on the Internet. However, sometimes you may find that you cannot load M3U8 smoothly and there is only an error message displayed.

How to fix M3U8 Access Denied error in Google Chrome?

Open Google Chrome, click the three dots icon on the upper right side, select Settings > Privacy and Security > Cookies and other site data. On the new section, select Allow all cookies. After that, refresh the page to play M3U8. This method is also applicable to some crossdomain access denied errors.

How to import TS to M3U8 playlist?

Step 1. Load the M3U8 folder as the input. Open VideoProc Converter, select "Video", click "+ Video Folder" to add the source folder, or click "+ Video" to add all the TS video files in sequence from the folder. Note: Due to the particularity of M3U8 playlist, some files might not able to be loaded successfully.


1 Answers

Your problem is only to be expected. .m3u8 Files are not actual Asset files, rather, they are more akin to a playlist. They are used in HTTP Live Streaming and provide a location for "Segments" based on available bandwidth.

here is an example of a .m3u8 file (Apple's sample .m3u8 file)

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000
gear1/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=311111
gear2/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=484444
gear3/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=737777
gear4/prog_index.m3u8

Unfortunately, you can not create an AVAsset or AVURLAsset to represent the media in a HTTP Live stream. Reference:Apple's reference example of Asset Loading/playing

like image 99
MDB983 Avatar answered Nov 01 '22 00:11

MDB983