[MPlayer-dev-eng] [PATCH] mencoder, B-frames, and video/audio delay
Loren Merritt
lorenm at u.washington.edu
Sun Jan 22 23:23:05 CET 2006
On Sun, 22 Jan 2006, Michael Niedermayer wrote:
> well "avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);" is the encoder
> input to decoder output delay
>
> the delay between encoder input and encoder output (=pts difference) is
> variable and between 0 and s->max_b_frames + 1 if b frames are used or 0 if not
>
> 0 1 2 3 4 5
> I B P B P
> | \| \|
> | |\ |\
> I P B P B
>
> if the encoder can output several frames at once with no input then its delay
> can be between 0 and s->max_b_frames
>
> the difference between encoder input pts and encoder output dts / decoder
> input dts should be "avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);"
> too
Method 0: ideally, decoder's pts = encoder's pts
-1 0 1 2 3 4 5
I B P B P pts
| \| \|
| |\ |\ encode
I P B P B
/ / / / /
| / / / / muxer compensates for delay (subtract up to bframes+1)
I P B P B dts
\ \| \|
| |\ |\ decode
I B P B P pts
...but that's not how dts is stored in avi or mp4.
Method 1: if negative timestamps aren't allowed
0 1 2 3 4 5
I B P B P pts (encoder)
| \| \|
| |\ |\ encode
I P B P B
| / / / /
| | | | | muxer compensates for delay (subtract up to bframes)
I P B P B dts
\ \| \|
| |\ |\ decode
I B P B P pts (decoder)
/ / / / /
| | | | | player compensates for delay (subtract 1)
I B P B P pts (display)
--Loren Merritt
More information about the MPlayer-dev-eng
mailing list