Android video player cannot seek far in high-tbn videos

Hi,

  So, my Android 2.2.1 phone's video player every now and then failed to
seek in certain sections of certain videos. The dominant case was that
it could not seek past the first 12 minutes in ~42 minutes videos. I've
found some time to debug this and it boiled down to video streams like

  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
  0x31637661), yuv420p, 320x180 [SAR 3899:3910 DAR 31192:17595],
  197 kb/s, SAR 4608:4621 DAR 8192:4621, 23.98 fps, 23.98 tbr,
  24k tbn, 47.95 tbc

working fine, and streams like

  Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
  0x31637661), yuv420p, 320x180 [SAR 351:352 DAR 39:22], 194 kb/s,
  23.98 fps, 23.98 tbr, 2997003.00 tbn, 47.95 tbc

being broken, i.e., if you seek to, say, 13 minutes into the video, the
Android video player will restart playing the video from the beginning,
while jumping to 7 minutes in works as expected. Explicitly setting the
framerate to `23.98` appears to be a suitable workaround, `ffmpeg` does
not seem to have other ways to control the tbn value. Now, 

  log(12 minutes * (2997003 per second))/log(2)

is pretty much exactly 31, so this could be some signed 32 bit integer
overflow-like issue. That would also correspond with another observed
issue with such videos, namely that if you try seeking towards the end,
the play might jump to somewhere near the beginning, rather than playing
the video from the start.

regards,
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Tuesday, 3 September 2013 17:43:17 UTC