[MPlayer-users] Possible bug with libtheora support in mplayer current
Julian Kniephoff
Julian.Kniephoff at gmx.de
Sun May 4 19:06:55 CEST 2008
Hi everyone,
I recently ran into this bug on Ubuntu (MPlayer-1.0rc2-4.2.3) and also could
reproduce it with the current SVN version (from today: 4th of May).
If this isn't fixed in another place I overlooked, already, I could contribute
a patch but at first some apologies and/or clarifications which may be in
order:
This is my first post to a mailing list so if something goes wrong, sorry for
that. If I got the threading wrong: I'm referring to this e-Mail:
http://lists.mplayerhq.hu/pipermail/mplayer-users/2007-December/070943.html
If this is the wrong place to post a patch sorry about that, too.
And at last sorry for my possibly bad English ;).
Concerning the Bug:
If libtheora is compiled in, MPlayer uses the video stream of the ogg file to
calculate the length (in the "-identify-phase"), whereas without the lib, it
uses the vorbis (audio) stream - at least that is what I found out /
interpreted from some experiments with MPlayers code.
The calculation is then: length = final_granulepos / rate
For the audio stream, rate is the bitrate, here = 44100
For the video stream, it is the framerate, here = 29.97 and granulepos's
represent frames. So frames / (frames / time) = time seems correct but for
theora, granule positions are encoded. Some bytes represent the frames before
the last keyframe and the other bytes represent the frames since that
keyframe (as far as I understood it, look up in the theora docs for furhter
details...). These two frame numbers have to be added to get the complete
number of frames since the start of the video (which for final_granulepos is
the number of frames of the whole video, thus the calculation of the length
gets correct). So what one needs to fix this is to find out how these
information are encoded in a granulepos.
My patch basically does this but I'm not sure whether this is the way, MPlayer
does things; it's implemented kind of naive - without great knowledge of
MPlayers code.
With this patch, I get a length of ID_LENGTH=211.41 for the mentioned video
which is correct (the video stream in it is a bit shorter than the audio
stream according to ogginfo, so the 0.05 seconds difference are ok).
The patch is written against the above mentioned version of MPlayer from the
Ubuntu repositories.
Thanks in advance,
Julian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: theora_length.patch
Type: text/x-diff
Size: 1225 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20080504/81428b00/attachment.patch>
More information about the MPlayer-users
mailing list