[vlc-devel] VLC ignores PTS in PES streams ?!
odikrause at gmail.com
Sat Jan 17 09:36:28 CET 2009
Well, I guess I should know.
Sample code I cannot deliver, but even I understood it, so it cannot
be too difficult.
PTS is based on the presentation time, DTS on the decoding time.
the DTS should be a little earlier than the PTS (to give the decoder some time)
The PTS is based on the presentation order of the MPEG stream which
differs from the transport order with a regular pattern of 3, except
for the very first I-frame, where PTS=DTS
I simply base the timestamps on the frame numbers (with respect to the
pattern (-1,2,-1) and the frame frequency plus some offset.
This value is multiplied by 90000 %2^33. Then I squeeze it into the field.
DTS differs in offset, and no respect for the pattern.
I hope thats a bit clear.
On Sat, Jan 17, 2009 at 2:08 AM, Matthias Bauer <smile4you at gmx.ch> wrote:
> Hello all
> I would like to change PTS/DTS in the PES stream from VDR ffnetdev
> with new ones calculated from current time to solve the problem with
> invalid PTS/DTS fastforward/reverse of a video recording.
> Can anybody give me some lines of sample source code for creating
> PTS/DTS. I didn't understand the documentation on how to build them.
> Thank you and best regards.
> Am 14.01.2009 um 23:36 schrieb Matthias Bauer:
>> Hello Laurent
>> Thank you for the fast answer.
>> To clarify what I would like to do: I use VDR with the ffnetdev plugin
>> as streaming server and VLC as streaming client. VDR ffnetdev plugin
>> is streaming the video output to the net instead of displaying it
>> VDR can play Live-TV (streaming to VLC works fine) or replay
>> recordinge (streaming to VLC works also fine as long it is played in
>> normal speed). But the user can fastforward, pause, rewind or
>> slowmotion the recorded video while it is still streamed to VLC. The
>> PTS/DTS are sent out of the recorded file, no matter in which speed it
>> is played. In case of rewind the PTS/DTS even decrease.
>> Now I want to patch this streaming server plugin "ffnetdev" to fix the
>> problem. What do you think is the best way to manipulate the stream,
>> either only while trick speed or while the whole streamed recording?
>> May be I should better replace the PTS/DTS with calculated values out
>> of current time?
>> I get the stream and additional informations about the current speed
>> and direction as input and should output a VLC compatible stream.
>> Regards, Matthias
>> Am 14.01.2009 um 23:05 schrieb Laurent Aimar:
>>> On Wed, Jan 14, 2009, Matthias Bauer wrote:
>>>> I'm sure VLC does not ignore PTS/DTS values because I have a problem
>>>> with this when I'm streaming a recorded PES stream to VLC and then
>>>> fastforward, reverse or slowmotion the stream on the streaming
>>>> BTW: Do you have an idea how I could manipulate the stream while
>>>> fastforward, reverse or slowmotion of the stream? I tried to
>>>> (1) remove PTS/DTS from stream, or
>>>> (2) set all bits of PTS/DTS to 1 or even
>>>> (3) adding trickmode info into the stream,
>>> If you are recreating a PS stream so that it plays at X speed on a
>>> client (that you do not control) when streamed by your server you
>>> need to:
>>> - divide the pts and dts by X.
>>> - divide the SCR value by X.
>>> - send it at X * original speed. (simply respecting the new SCR value
>>> will work).
>>> With that it should work, provided that every video frame and audio
>>> packet have
>>> a PTS and a DTS value (as the frame rate and audio samplerate are
>>> now wrong and
>>> thus cannot be used to interpolate the missing values).
>>> Becarefull that tricking VLC this way, will prevent it to correctly
>>> fix the audio
>>> in order to keep the pitch.
>>> If you do have control on the VLC then it is another case (and
>>> simpler, you
>>> just need to send the file at the modified speed and inform VLC of
>>> the right
>>> speed to use).
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
More information about the vlc-devel