[linux-dvb] How to convert MPEG-TS to MPEG-PS on the fly?

Nick Ludlam nick at recoil.org
Fri Aug 22 17:44:56 CEST 2008

On 22 Aug 2008, at 15:44, Josef Wolf wrote:

> On Fri, Aug 22, 2008 at 11:07:47AM +1000, Kevin Sheehan wrote:
>> Barry was right on the money with the ts2ps suggestion below.  It's  
>> part
>> of the libdvb package.  You don't have to use the dvb-mpegtools  
>> app, you
>> can just use the lib in yours - no pipes, etc.
> I know.  But I still consider ts2ps to be too heavy for my  
> application.
> It goes and parses all the PES contents, which eats much CPU.

I might be slightly out in terms of your requirements, but I've had  
success using
the 'replex' tool ( http://www.metzlerbros.org/dvb/ ) to do on-the-fly  
conversions of a recorded TS into a PS with a specified video and  
audio PID.

The command I wrapped in a popen call from a script was:

	/opt/local/bin/replex -o /dev/stdout -i TS -v %s -a %s -t MPEG2 /dev/ 

Where the two %s's were replaced with the desired audio PID and video  
Then I wrote to, and read from the pipes accordingly.

The only issue I had with this was that it was prone to breaking  
unless the
TS stream had little or no corruption. The CPU usage for replex was
considerably lower than using mencoder or ffmpeg, although I don't know
how difficult it would be to get replex to insert multiple audio  
streams into
the resulting PS.


Nick Ludlam
nick at recoil.org

More information about the linux-dvb mailing list