Media file segmenter is a tool provided by Apple It can divides one media file into a series of small mpeg-2 transport stream files for HTTP Live Streaming
Now, I would like to do a reverse job: merge all of the mpeg-2 transport stream files into one media file (mp4) for iPhone playing
I have been trying to use AVFoundation classes- AVURLAsset
, AVMutableComposition
, AVMutableCompositionTrack
etc.
I code something like:
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:mpeg2tsMediaURL];
NSLog("duration: %lld", [asset duration].value); // shows empty duration here
I try to print other properties like AudioTrack, VideoTrack All of the properties are empty, the asset is an empty object When I switch the mpeg2tsMediaURL to a normal mp4 file URL, it can shows the properties right. So, it's failure to use AVFoundation classes to do the job.
Any suggestion is welcome. Thanks.