I have an M3U8 file saved locally.
I want to download the video file from the above file. I have googled a lot and found the M3U8 parser. But it didn’t help me.
I have attempted to download the video using the following code, but it always returned nil.
NSString *str = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"1" ofType:@"m3u8"] encoding:NSUTF8StringEncoding error:nil];
M3U8SegmentInfoList *list= [M3U8Parser m3u8SegmentInfoListFromPlanString:str baseURL:[NSURL URLWithString:@"http://hls.ted.com/talks/2238.m3u8?sponsor=Ripple"]];
NSLog(@"%@",list);
How can I download this video?
It's easy-peasy with VLC. Most steps are obvious, and you only need to do one trick.
seg-1-v1-a1.ts
→ http://videosource.site/seg-1-v1-a1.ts
, it's in the URL where you downloaded the M3U8 file. Use even Notepad/TextEdit and their Replace function, or paste the URL manually to every filenames. (In this case, the string seg
is a common sample so you can use it in the Replace function.)VLC will remux the file into an M4V file. It should be playable locally. (M4V files can be renamed to MP4, they're actually MP4 files.)