I’m working with Windows 10 and several macOS versions trying to get my software upgraded to wxPython 4.1 and running on Catalina. I’m using Python 3.7.7 and mostly the latest daily build (currently 4.1.1a1.dev4845 because of drag-and-drop issues with the official 4.1.0 release).
I am seeing a problem with the MediaCtrl specifically with positioning media files using Seek().
On macOS 10.10.5 Yosemite if I use wxPython 4.0.6, Seek()s seem to work, with Tell() coming up with the same value as provided to Seek(), indicating the video was positioned correctly. I get the same result on Windows 10 with wxPython 4.1.1a1.dev4845.
However, on macOS Yosemite with wxPython 4.1.1a1.dev4845, that doesn’t work. Here’s what happens when I write a loop to seek every frame from 5.0 seconds to 7.0 seconds in an *.mp4 video.
A first Seek() within a given whole second does not change the media position So Seek(5033) does not take me to the frame AFTER the 5.0 second mark (5000, with a frame being 33 milliseconds long), but leaves the media Tell() unchanged, whereever it was before the Seek().
A second Seek() within a given second will reposition the media position at the whole second mark. So Seek(5033) fails to change position, but following it with Seek(5066) sets the video position to 5000 milliseconds (as reported by Tell()) rather than 2 frames later at 5066. All subsequent calls within that second leave the media position at 5000. When I call Seek(6023), the first call in a new whole second, the Tell() returns 5000, but the next Seek(6056) shifts the Tell() value (that is, the media position) to 6000.
On macOS 10.15.5 Catalina, wxPython 4.0.6 doesn’t support the MediaCtrl correctly, if I recall right. wxPython 4.1.1a1.dev4845 works the same as on Yosemite, but with the added bonus of an error message for the first 10 Seek() calls that says some variation of:
Python[704:7574] CMTimeMakeWithSeconds(5.033 seconds, timescale 1): warning: error of -0.033 introduced due to very low timescale
My users need frame accuracy in seeking and playing their video files. They are working with precise video selections from within larger video files. They also sometimes play multiple videos simultaneously (following a synchronization process). A frame or two off is one thing, but differences of up to a second make this feature unusable. Frame accuracy is really central to my program.
Is this problem from wxPython or is it a wxWidgets issue? Is there anything that can be done about it to make MediaCtrl.Seek() work correctly on macOS? I know that this frame accuracy was supported for at least a decade prior to the 4.1 release.
I’ll attach a simple sample. In the code, you’ll need to point to a media file (one that’s at least 31 seconds long) and run it. It will load your media file and Seek() a position a bit more than 30 seconds in. Press the “Test” button and look at your command line output. You’ll see a list of positions sent to Seek(), positions returned by Tell(), and the difference between the two.
Thanks in advance for looking into this.
David