I knew this was a bit of a pain since I'd tried it before, but oh boy - there went my weekend. And i still don't have a 100% reliable solution. Ho hum.
Some of the issues I found with only a handful of videos I have at hand:
- An mpeg ts which will wont seek via timestamp. Only byte seeking works.
- An avi in which byte seeking never works. Only timestamp seeking does.
- An avi in which the DTS increments forever - so although you can seek by timestamp to a keyframe, you cannot use it to identify specific frames thereafter.
- A mov file in which byte seeking never works.
- A mov file which ends with an EPIPE error rather than end of file. It must be closed and re-opened to perform any further operations.
I have something which mostly works now, but I suspect it will never be reliable enough.