[Mplayer-users] total time in OSD
Arpi
arpi at thot.banki.hu
Wed Aug 22 14:41:35 CEST 2001
Hi,
> > I have one question (please don't be angry for me, it's a little, very little
> > request): is it possible to include a total time of movie in OSD? It could be
> > accessible in some way, for example on some keypress...
> > Yes, I know it could be impossible to show it with streaming video.
>
> I looked at implementing it. Unfortunately, the total playing time of the
> file isn't easily known. Certainly for mpegs (which are in a
> "stream" type format) it isn't known; perhaps its in AVI headers etc
> (though that is probably wrong often?).
>
> I experimented with tracking average bytes per second being played and
> using that to estimate total play time - but this didn't work well at all
> - lots of jitter in the estimate.
Exactly. This is the reason why is not implemented yet.
Now i'll summarize the things, and please close this thread forever.
mpeg:
- has no header, you don't know how many frames it has.
- for progressive mpeg2 you can't use constant fps value, as in
fact less frames are coded than displayed (frames are doubled)
- most mpeg video and audio streams has bitrate info in frame headers.
if you can cound how many streams you have and summarize all bitrates,
you'll get the filesize/totaltime ratio so you win. but it's hard to
do, and there are still files with variable rate or simply missing
or even worse: bad bitrate value in headers.
- another possible way: seek to teh last frames of video (filesize-128k?)
read last packets and find the video PTS. it will be total time, if
PTS values are correct over the whole file (they aren't for VOBs or
edited files) mtv and libmpeg3 does that.
avi:
- it's easy. it has header, header contains constant fps and number of
frames. except a few files, these values are correct.
asf:
- it's a streaming format, so it has no end... so no total values.
(even if it's grabbed to disk or encoded to file, the file format
itself is for streaming)
- no bitrate info (at least in the asf specs we have)
- no constant fps, it has no fps at all. it uses timestamps to control
playback speed.
-> you have to read the whole file and summarize frame duration values.
(avifile does that)
- maybe the same hack can be used as for mpeg, so seeking to last packets,
sync, and get timestamp.
qt:
- it will be easy, it has too many headers with all info repeated
many times :)
now mplayer uses file size & file position ratio for OSD seekbar.
> So I gave up. If anyone has ideas on how to do this better I'd like to
> hear them because a time-remaining display would be a nice addition for
> me.
doesn't worth that too much hacking with ugly code and suspection of many
things...
A'rpi / Astral & ESP-team
--
mailto:arpi at thot.banki.hu
http://esp-team.scene.hu
_______________________________________________
Mplayer-users mailing list
Mplayer-users at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-users
More information about the MPlayer-users
mailing list