[MPlayer-dev-eng] [PATCH] further dvr-ms playback improvements
John Donaghy
johnfdonaghy at gmail.com
Tue Aug 29 01:42:40 CEST 2006
>
> case DEMUXER_TYPE_ASF: {
> float next_pts = ds_get_next_pts(d_video);
> float d= next_pts > 0 ? next_pts - d_video->pts : d_video->pts-pts1;
> if(d>=0){
> if(d>0){
> if((int)sh_video->fps==1000)
> mp_msg(MSGT_CPLAYER,MSGL_V,"\navg. framerate: %d fps \n",(int)(1.0f/d));
> sh_video->frametime=d; // 1ms
> sh_video->fps=1.0f/d;
> }
> frame_time = d;
> } else {
> mp_msg(MSGT_CPLAYER,MSGL_WARN,"\nInvalid frame duration value (%5.3f/%5.3f => %5.3f). Defaulting to %5.3f sec.\n",d_video->pts,next_pts,d,frame_time);
> // frame_time = 1/25.0;
> }
> }
> break;
>
This code doesn't make sense because it will do the same thing no
matter what fps value is provided either by the demuxer or from the
command line.
It is worth stressing that dvr-ms file are a special case of ASF files
that do not conform to the usual rules so, as in my initial patch, I
suggest the case limb above should do something different if the file
is a dvr-ms file rather than a standard asf file.
MPlayer can play WMV files well enough (AFAIK) but it still cant play
dvr-ms files properly. (I wrote a bit about the dvr-ms format in the
multimedia wiki if you are interested.) In essence a video frame is
split across multiple payloads/segments and unlike with WMV files the
container doesn't tell you via the 'media object number' when you've
read a complete video frame.
demux_asf.c gets round this problem by parsing the video stream (which
is always mpeg2 for now at least) to see when it's read a complete
frame. I borrowed the idea for this from looking at the ffmpeg code
but the way it is implemented now in the demux_asf.c could hardly be
considered a modular approach. Neither was my second patch to also
pick up the framerate from the codec but at least it worked.
On the subject of the pts values picked up by demux_asf.c heres what
happens: dvr-ms files use the 'replicated data' feature of asf for
including extra data in a segment. The replicated data contains the
size of the segment followed by the presentation time - demux_asf.c
uses the presentation time of the first segment in the frame to set
the frame's pts value. The rest of this replicated data possibly
contains more useful information but there's no documentation on how
to make sense of it.
Regarding what we can at least parse, I added some debug statements to
indicate what the sequence number, presentation and duration (ie asf
packet duration time - not segment duration) do in a typical dvr-ms
file (see below).
I think this indicates that the video pts times returned by the
demux_asf.c are useless because it appears that the presentation_time
field isn't being used for it's intended purpose in a dvr-ms file.
I'd like to try to come up with an acceptable way to solve this issue
in mplayer if someone is willing to mentor me. I don't want to waste
time writing another patch that gets rejected and I dont have neither
a good enough understanding of how mplayer works nor a knowledge of
other container formats.
I suggest the approach should use the same technique employed by the
lavf demuxer - ie find an way to pick up the missing information from
the decoder when you cant get it from the demuxer but I'd like to hear
other opinions. Nico's patch may be close to what is needed and as he
pointed out regarding this:
"on the other side delegating
this assignment to the decoder can help to fix one of mplayer's limitation:
when playing file formats that don't have a nominal framerate (such as
asf, mpeg*) video.c tries to parse the video stream headers to set the
framerate,
an operation that it should _not_ do."
Here's the output I refered to above that shows why the presentation
times picked up by demux_asf.c are likely wrong for dvr-ms files (but
probably ok for WMV files)
NEW VIDEO pts=0.000
NEW AUDIO pts=4.000
VIDEO SEG: seq_num=2 pres_time=5 duration=6
VIDEO SEG: seq_num=3 pres_time=6 duration=6
VIDEO SEG: seq_num=3 pres_time=6 duration=4
VIDEO SEG: seq_num=4 pres_time=7 duration=4
VIDEO SEG: seq_num=5 pres_time=8 duration=4
NEW VIDEO pts=8.000
VIDEO SEG: seq_num=6 pres_time=9 duration=4
VIDEO SEG: seq_num=7 pres_time=10 duration=4
VIDEO SEG: seq_num=7 pres_time=10 duration=4
VIDEO SEG: seq_num=8 pres_time=11 duration=4
VIDEO SEG: seq_num=9 pres_time=12 duration=4
VIDEO SEG: seq_num=10 pres_time=13 duration=4
VIDEO SEG: seq_num=11 pres_time=14 duration=4
VIDEO SEG: seq_num=11 pres_time=14 duration=28
VIDEO SEG: seq_num=12 pres_time=39 duration=28
VIDEO SEG: seq_num=13 pres_time=40 duration=28
AUDIO SEG: seq_num=2 pres_time=41 duration=28
NEW AUDIO pts=41.000
VIDEO SEG: seq_num=14 pres_time=42 duration=28
VIDEO SEG: seq_num=14 pres_time=42 duration=3
VIDEO SEG: seq_num=15 pres_time=43 duration=3
VIDEO SEG: seq_num=16 pres_time=44 duration=3
VIDEO SEG: seq_num=17 pres_time=45 duration=3
NEW VIDEO pts=45.000
VIDEO SEG: seq_num=17 pres_time=45 duration=4
VIDEO SEG: seq_num=18 pres_time=46 duration=4
VIDEO SEG: seq_num=19 pres_time=47 duration=4
VIDEO SEG: seq_num=20 pres_time=48 duration=4
VIDEO SEG: seq_num=21 pres_time=49 duration=4
VIDEO SEG: seq_num=21 pres_time=49 duration=4
VIDEO SEG: seq_num=22 pres_time=50 duration=4
VIDEO SEG: seq_num=23 pres_time=51 duration=4
AUDIO SEG: seq_num=3 pres_time=52 duration=4
NEW AUDIO pts=52.000
VIDEO SEG: seq_num=24 pres_time=53 duration=4
VIDEO SEG: seq_num=24 pres_time=53 duration=3
VIDEO SEG: seq_num=25 pres_time=54 duration=3
VIDEO SEG: seq_num=26 pres_time=55 duration=3
VIDEO SEG: seq_num=27 pres_time=56 duration=3
VIDEO SEG: seq_num=27 pres_time=56 duration=5
VIDEO SEG: seq_num=28 pres_time=57 duration=5
VIDEO SEG: seq_num=29 pres_time=58 duration=5
NEW VIDEO pts=58.000
VIDEO SEG: seq_num=30 pres_time=59 duration=5
VIDEO SEG: seq_num=31 pres_time=60 duration=5
VIDEO SEG: seq_num=32 pres_time=61 duration=5
VIDEO SEG: seq_num=32 pres_time=61 duration=9
VIDEO SEG: seq_num=33 pres_time=62 duration=9
VIDEO SEG: seq_num=34 pres_time=69 duration=9
VIDEO SEG: seq_num=35 pres_time=70 duration=9
VIDEO SEG: seq_num=35 pres_time=70 duration=4
VIDEO SEG: seq_num=36 pres_time=71 duration=4
VIDEO SEG: seq_num=37 pres_time=72 duration=4
VIDEO SEG: seq_num=38 pres_time=73 duration=4
VIDEO SEG: seq_num=39 pres_time=74 duration=4
VIDEO SEG: seq_num=39 pres_time=74 duration=3
VIDEO SEG: seq_num=40 pres_time=75 duration=3
VIDEO SEG: seq_num=41 pres_time=76 duration=3
VIDEO SEG: seq_num=42 pres_time=77 duration=3
VIDEO SEG: seq_num=42 pres_time=77 duration=61
VIDEO SEG: seq_num=43 pres_time=78 duration=61
VIDEO SEG: seq_num=44 pres_time=79 duration=61
VIDEO SEG: seq_num=45 pres_time=80 duration=61
VIDEO SEG: seq_num=46 pres_time=138 duration=61
VIDEO SEG: seq_num=46 pres_time=138 duration=4
AUDIO SEG: seq_num=4 pres_time=139 duration=4
NEW AUDIO pts=139.000
VIDEO SEG: seq_num=47 pres_time=140 duration=4
NEW VIDEO pts=140.000
VIDEO SEG: seq_num=48 pres_time=141 duration=4
VIDEO SEG: seq_num=49 pres_time=142 duration=4
VIDEO SEG: seq_num=49 pres_time=142 duration=3
VIDEO SEG: seq_num=50 pres_time=143 duration=3
VIDEO SEG: seq_num=51 pres_time=144 duration=3
VIDEO SEG: seq_num=52 pres_time=145 duration=3
VIDEO SEG: seq_num=52 pres_time=145 duration=4
VIDEO SEG: seq_num=53 pres_time=146 duration=4
VIDEO SEG: seq_num=54 pres_time=147 duration=4
VIDEO SEG: seq_num=55 pres_time=148 duration=4
VIDEO SEG: seq_num=56 pres_time=149 duration=4
VIDEO SEG: seq_num=56 pres_time=149 duration=4
VIDEO SEG: seq_num=57 pres_time=150 duration=4
More information about the MPlayer-dev-eng
mailing list