How to re-multiplex Multiple Program Transport Str

2019-06-10 01:33发布

问题:

I have multiple MPTS files recorded from satellite receivers, I need to cherry pick programs/services/PIDS from each file re-multiplex them into a single MPTS file. Optionally I might be able to get away with taking all the services from every file and adding them to the final MPTS (In case anyone knows about a multiplexer that wouldn't allow me to cherry pick programs)

Does anybody know how to do this with open source or free software (like VLC or ffmpeg for example) under either windows or linux?

回答1:

I ended up using the multiplexer package from Oskar Schirmer @ scara.com, which was the only one open source solution I could find, I'm not even sure if this project is being maintained, but it works.

The exact command to cherry pick a PID in a MPTS ts file (to another file) is:

iso13818ts -F 500 --file 1 source.ts --ts 1 2 13 > destination.ts

Where:

  • -F 500 is the time in ms to send the PSI tables (PAT & PMT)
  • --file 1 source.ts specifies an input file (source.ts) and gives it a referral id (1)
  • --ts 1 2 13 tells the command file 1 is a ts, take program 2 and remap it to program 13 on the output
  • standard output is the resulting ts, so it needs to be redirected to a file or piped

With this same command you can remultiplex the multiple MPTS streams at a time (as long as your system can keep up), so a short example would be:

iso13818ts -F 500 --file 1 source1.ts --file 2 source2.ts --ts 1 2 13 --ts 2 1 10 > dest.ts

Which takes program 2 from file 1 and makes it program 13, and program 1 from file 2 and makes it program 10 and puts the resulting TS into dest.ts