3

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.

Till
  • 27,559
  • 13
  • 88
  • 122
bandw
  • 879
  • 2
  • 11
  • 30

1 Answers1

0

You can combine MPEG transport stream files using tsMuxeR.

To combine TS files using the GUI:

  1. Click the "add" button to add the first file.
  2. Click the "join" button and select the second file. Click the "join" button again to select the third file, etc. (Unfortunately, as of version 2.6.12, you have to join each file individually. You might want to use the command line tool if there are many files.)
  3. An output filename should automatically be selected for you, but you can change the output file path in the "Output" section.
  4. Click the "Start muxing" button.
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
  • I just used this to successfully merge 21 .ts files, I will probably make my own GUI as the join button is pretty annoying – Richie Frame Sep 18 '17 at 11:12