View Full Version : writing mpeg2 program stream question
diehardii
17th March 2004, 22:57
Hi guys I just wanted to get the opinions from some experts on the feasibility of this. I have a card that outputs a Packetized Elementary Stream (000001E0). The sound comes out as PCM, but I encode it to MPEG2 sound. The packets unfortunately are not 2048 bytes. So my question is, at least initially if I write a program stream header (000001BA) at the beginning of each packet, will I then have a file playable via software at least? Also, is it possible to calculate the SCR based on the PTS? I want to be able to do this realtime via a dshow filter, so I can't scan the whole file at once. Thanks.
~Steve
CMatt
19th March 2004, 16:03
You need to multixplex the stream. There are a lot of opensource muxer/demuxer. Look at the DVDx project, in the MPEG_LIB you should find all what you need.
Nic
19th March 2004, 17:49
Writes out a PES? How strange, you would think either a full PS or just the elementry stream...anyway...
You need to do more than write 000001BA, you have to write out the whole pack header (not just the startcode), but I assume that's what you meant anyway. It sounds to me like you could do this. The SCR can be generated from the PTS roughly. In DVD the SCR goes up in a very uniform way with each pack anyway, so you could do a similar thing.
There's a project called replex (for DVB->DVD streams), which has nice pack/pes writing code in it (or at least I thought so). You could try looking into that.
-Nic
diehardii
19th March 2004, 20:53
Hi Nic, thanks for the help. I did realize I have to write the whole pack header. Do I need a system header (000001B3 I think)? or is that not necessary? I thought that this would be the easiest way to go, just writing the pack header at the beginning of each packet. The code for that is relatively trivial.
Yeah, this card (Creative DVCR) is very odd. Perhaps the chip can do more, but the drivers really suck.
~Steve
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.