SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Clients Development
Forum Rules FAQs Community Downloads Today's Posts Search


SageTV Clients Development This forum is for discussions relating to SageTV Open Source Clients Development.

Thread Tools Search this Thread Display Modes
Old 01-06-2016, 08:50 AM
stuckless's Avatar
stuckless stuckless is offline
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
[HELP]MPEG-PS Stream Reader for ExoPlayer (Android MiniClient)

SageTV uses MPEG-PS streams quite a bit, but, ExoPlayer does not support parsing MPEG-PS. It will parse MPEG-TS, but not PS.

I've been told that parsing PS is actually quite a bit easier than TS, but, I haven't really dug into this yet.

Jeff, pointed to me the FastMpeg2Reader in SageTV that does the MPEG TS/PS parsing, which can be used as a reference to create an "Extactor" that ExoPlayer can consume.

ExoPlayer uses a layered approach to parsing streams. I can't say I fully understand it. But, at the very least, you need an "Extractor" that extracts "Samples" from a stream. ExoPlayer has a TSExtractor, and that Extractor would have to be copied, and modified to handle MPEG-PS, a new clean extractor can be created.

Personally, I'd love it, if someone with a keener interest in video formats would take on this task, but if that doesn't happen, then I guess I'll start the process of learning and adapting this. It's just that with an hour a night (if I'm lucky), this is going to take some time.

If you are interested, let me know, since I won't start this, if someone else wants to do it.

I have the following note from Jeff...
And the PSExtractor won't be all that bad if you base it off the TSExtractor. Both formats contain MPEG PES packets inside of them; which is a lot of the more complex parsing. The PS layer is actually quite simple..codec detection is easy because it's based solely on the stream ID (you don't need to look at other descriptor tables). The whole PAT/PMT parsing stuff is essentially thrown away from the TSExtractor as well. It all comes down to these few things from FastMpeg2Reader (and assume ts=false in all these cases):

1. packAlign() ensures proper alignment in the stream (for verifying it's an MPEG2-PS, just look at the first block in
2. pack() just checks the higher level format codes to ensure they are right
3. pack_header() reads the actual MPEG2-PS packet header (which has a PES packet inside of it)
4. PES_Packet() parses all the PES packet header information and then ends up calling skipBytes over the actual audio/video data that's inside
To be clear, It's not that I don't want to do this, because I think it would be interesting. But, I also have lots of issues and "quirks" to work out in the existing Android MiniClient code as well. And, as I said, if no-one comes forward... then, I'll eventually tackle it. I think that getting this to work, is really the last part of having a fully working ExoPlayer for video playback.
Reply With Quote
Old 04-01-2016, 09:54 AM
stuckless's Avatar
stuckless stuckless is offline
Join Date: Oct 2007
Location: London, Ontario, Canada
Posts: 9,713
Just wanted to update this thread to say that this is no longer required. Jeff provided an PS implementation for ExoPlayer and it's the core ExoPlayer source code and included in the Android MiniClient. (Thanks Jeff!!)
Reply With Quote
Old 04-01-2016, 02:22 PM
Narflex's Avatar
Narflex Narflex is offline
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,349
No problem. Just another add it to the collection of MPEG parsers I've written over the years.
Jeffrey Kardatzke
Founder of SageTV
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Android MiniClient] Now in BETA stuckless SageTV Clients Development 487 07-03-2016 03:55 PM
MPEG2 Support in Android MiniClient stuckless SageTV Clients Development 24 01-03-2016 10:09 AM
A way to stream Sage recordings on Android pjpjpjpj General Discussion 3 02-08-2013 12:51 PM
Stream video to Android phone via sage web server? cowboyway SageTV Customizations 5 12-13-2009 02:52 PM
Problem converting mpeg stream to MPEG4 HDTV davemacnj SageTV Mac Edition 0 11-05-2009 08:41 PM

All times are GMT -6. The time now is 12:54 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.