chetan
chetan

Reputation: 53

hls live streaming using ffmpeg in iOS

I am new to ffmpeg and I am trying to create live streaming app (HLS) and I want Live broadcasting rather than VOD.

I am able to use ffmpeg through terminal and create .ts files from m4v but I am not getting how to achieve the same thing in iPhone.

My approach is to create .ts files at iPhone end and then send it to server.

I am not sure if this approach is correct, If this correct how I can create .ts files then otherwise what's the right approach ?

Upvotes: 3

Views: 2543

Answers (1)

Abhi
Abhi

Reputation: 603

If you want to create .ts file from iPhone, you will need the FFmpegWrapper library and then do like this,

NSString *outputPath = [documentDirectoryPath stringByAppendingPathComponent:@"out.m3u8"];

    FFmpegWrapper *wrapper = [[FFmpegWrapper alloc] init];
    [wrapper convertInputPath:inputPath outputPath:outputPath segmentDuration:SEGMENT_DURATION options:nil progressBlock:
     ^(NSUInteger bytesRead, uint64_t totalBytesRead, uint64_t totalBytesExpectedToRead) {

         //Do loading here


     } completionBlock:^(BOOL success, NSError *error) {

         // Do whatever after it is complete

     }];

Upvotes: 3

Related Questions