How to identify the source of the problem in wxPython?

I have written a Python script that uses wxPython (vers. 3.0.0.0)
with Python (vers. 2.7.5) to test the playing and control of video
(AVI) files. The wxPython GUI is very simple with a panel for the
display of the AVI video and 8 buttons (Load File, Play ,
Pause, Sto**p, To Last, To Start ,
Fwd SS, Bak SS). The Fwd SS and Bak SS ,
move forward by a single step (frame), and backward by a single
step, respectively. The To Last and To Start display
the last frame, and first frame, respectively. These buttons all
work as expected on my Windows Vista 32-bit platform (desktop).

I have installed the same versions of Python and wxPython on a

Windows 7 (64-bit) platform (laptop) and I have a large collection
of Python scripts that I have on both the desktop and laptop. All of
these Python scripts give identical results on both desktop and
laptop, EXCEPT this recent script for the playing and control of an
AVI video. That is, the Load File and Play buttons
work ok; but, the other buttons do not work as they should (e.g. the
Fwd SS and Bak SS button have no effect on the
display).

I am using wxPython.media in this script and from the extensive

testing that I have done my best guess for the source of the problem
is in wxPython.media. How can I get help on finding what the problem
is? Who can I contact for more detailed information on
wxPython.media? The documentation that I have found on the web for
wxPython.media (so far), has not been very helpful IMHO. Note, the
Python script and a video (AVI) file are available from me
() on request.
–V

···

vs@it.uu.se

:frowning:

Perhaps you can dig deeper into the issue by adding a logger to your button event handlers or the media widget event handlers to see if the events are being fired and are being queued into the event queue. Somewhere some “constants” where removed from the distro and then put back in. Perhaps to make sure any ID_ or EVT_issues weren’t interjected between wx versions for the media widget check if the media widgets events are even firing.

Thanks for trying to help — I will follow your suggestions. It
does puzzle me that if “some constants” were removed and I am using
the same download of wxPython, that the problems do not show up on
both systems.
�

···

On 10-Jan-2014 02:56, Dev Player wrote:

    Perhaps you can dig deeper into the issue by adding

a logger to your button event handlers or the media widget event
handlers to see if the events are being fired and are being
queued into the event queue. Somewhere some “constants” where
removed from the distro and then put back in. Perhaps to make
sure any ID_ or EVT_issues weren’t interjected between wx
versions for the media widget check if the media widgets events
are even firing.

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to .
For more options, visit .
wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/groups/opt_out

Well, my SourceCoder has MediaCtrl built in, but it does not yet have single skip frame functionality.

Can you provide a sample app with a sample file displaying the problem at hand.
Ex: the sample file can be a 5-7 frame gif as Most Media Backends support them.

As far as where to go…, well you found it. Robin Dunn is the Head Dev of wxPython and this is basically the main mailing list/thread for it, so maybe if this is a platform specifc problem posting a sample app always helps as a working example multiple folks can test on all platforms.
I primarily use XP Pro. Also 7 Ultimate and Various Linux Flavors if this may help. The Vista laptop has just about seem its last days considering a screen manufacturers defect.

···

On Thursday, January 9, 2014 3:18:27 PM UTC-6, Birdy wrote:

I have written a Python script that uses wxPython (vers. 3.0.0.0)

with Python (vers. 2.7.5) to test the playing and control of video
(AVI) files. The wxPython GUI is very simple with a panel for the
display of the AVI video and 8 buttons (Load File, Play ,
Pause, Sto**p, To Last, To Start ,
Fwd SS, Bak SS). The Fwd SS and Bak SS ,
move forward by a single step (frame), and backward by a single
step, respectively. The To Last and To Start display
the last frame, and first frame, respectively. These buttons all
work as expected on my Windows Vista 32-bit platform (desktop).

I have installed the same versions of Python and wxPython on a

Windows 7 (64-bit) platform (laptop) and I have a large collection
of Python scripts that I have on both the desktop and laptop. All of
these Python scripts give identical results on both desktop and
laptop, EXCEPT this recent script for the playing and control of an
AVI video. That is, the Load File and Play buttons
work ok; but, the other buttons do not work as they should (e.g. the
Fwd SS and Bak SS button have no effect on the
display).

I am using wxPython.media in this script and from the extensive

testing that I have done my best guess for the source of the problem
is in wxPython.media. How can I get help on finding what the problem
is? Who can I contact for more detailed information on
wxPython.media? The documentation that I have found on the web for
wxPython.media (so far), has not been very helpful IMHO. Note, the
Python script and a video (AVI) file are available from me
(v…@it.uu.se) on request.

--V :-(

Virgil Stokes wrote:

I have written a Python script that uses wxPython (vers. 3.0.0.0) with
Python (vers. 2.7.5) to test the playing and control of video (AVI)
files. The wxPython GUI is very simple with a panel for the display of
the AVI video and 8 buttons (/Load File/, /Play/, /Pause/, /Sto//p/, /To
Last/, /To Start/, /Fwd SS/, /Bak SS/). The /Fwd SS/ and /Bak SS/, move
forward by a single step (frame), and backward by a single step,
respectively. The /To Last/ and /To Start/ display the last frame, and
first frame, respectively. These buttons all work as expected on my
Windows Vista 32-bit platform (desktop).

I have installed the same versions of Python and wxPython on a Windows 7
(64-bit) platform (laptop) and I have a large collection of Python
scripts that I have on both the desktop and laptop. All of these Python
scripts give identical results on both desktop and laptop, EXCEPT this
recent script for the playing and control of an AVI video. That is, the
/Load File/ and /Play/ buttons work ok; but, the other buttons do not
work as they should (e.g. the /Fwd SS/ and /Bak SS/ button have no
effect on the display).

I am using wxPython.media in this script and from the extensive testing
that I have done my best guess for the source of the problem is in
wxPython.media. How can I get help on finding what the problem is? Who
can I contact for more detailed information on wxPython.media? The
documentation that I have found on the web for wxPython.media (so far),
has not been very helpful IMHO. Note, the Python script and a video
(AVI) file are available from me (vs@it.uu.se) on request.

Compare which media encoders/decoders are installed on each system. There is a good chance that whatever decoder is needed for the AVI file in question is not installed on the machine where it doesn't work.

···

--
Robin Dunn
Software Craftsman

Virgil Stokes wrote:

I have written a Python script that uses wxPython (vers. 3.0.0.0) with
Python (vers. 2.7.5) to test the playing and control of video (AVI)
files. The wxPython GUI is very simple with a panel for the display of
the AVI video and 8 buttons (/Load File/, /Play/, /Pause/, /Sto//p/, /To
Last/, /To Start/, /Fwd SS/, /Bak SS/). The /Fwd SS/ and /Bak SS/, move
forward by a single step (frame), and backward by a single step,
respectively. The /To Last/ and /To Start/ display the last frame, and
first frame, respectively. These buttons all work as expected on my
Windows Vista 32-bit platform (desktop).

I have installed the same versions of Python and wxPython on a Windows 7
(64-bit) platform (laptop) and I have a large collection of Python
scripts that I have on both the desktop and laptop. All of these Python
scripts give identical results on both desktop and laptop, EXCEPT this
recent script for the playing and control of an AVI video. That is, the
/Load File/ and /Play/ buttons work ok; but, the other buttons do not
work as they should (e.g. the /Fwd SS/ and /Bak SS/ button have no
effect on the display).

I am using wxPython.media in this script and from the extensive testing
that I have done my best guess for the source of the problem is in
wxPython.media. How can I get help on finding what the problem is? Who
can I contact for more detailed information on wxPython.media? The
documentation that I have found on the web for wxPython.media (so far),
has not been very helpful IMHO. Note, the Python script and a video
(AVI) file are available from me (vs@it.uu.se) on request.

Compare which media encoders/decoders are installed on each system. There is a good chance that whatever decoder is needed for the AVI file in question is not installed on the machine where it doesn't work.

Thanks Robin,
I have more than one encoder/decoder on each. How do I determine which one wxPython.media.MediaCtrl is using?

--V

···

On 14-Jan-2014 05:05, Robin Dunn wrote:

Virgil Stokes wrote:

···

On 14-Jan-2014 05:05, Robin Dunn wrote:

Virgil Stokes wrote:

Compare which media encoders/decoders are installed on each system.
There is a good chance that whatever decoder is needed for the AVI
file in question is not installed on the machine where it doesn't work.

Thanks Robin,
I have more than one encoder/decoder on each. How do I determine which
one wxPython.media.MediaCtrl is using?

There is a utility called GraphStudio which you can use to create a visual representation of the default filter graph created by Windows for handling a particular media file or URL. The MediaCtrl class should be using a similar graph with the default DirectShow backend, so looking at the components on the graph can give you info about which decoders and other filters are actually being used.

--
Robin Dunn
Software Craftsman

Ok Robin,
Thanks for the tip!

···

On 16-Jan-2014 03:48, Robin Dunn wrote:

Virgil Stokes wrote:

On 14-Jan-2014 05:05, Robin Dunn wrote:

Virgil Stokes wrote:

Compare which media encoders/decoders are installed on each system.
There is a good chance that whatever decoder is needed for the AVI
file in question is not installed on the machine where it doesn't work.

Thanks Robin,
I have more than one encoder/decoder on each. How do I determine which
one wxPython.media.MediaCtrl is using?

There is a utility called GraphStudio which you can use to create a visual representation of the default filter graph created by Windows for handling a particular media file or URL. The MediaCtrl class should be using a similar graph with the default DirectShow backend, so looking at the components on the graph can give you info about which decoders and other filters are actually being used.

Robin Dunn wrote:

There is a utility called GraphStudio which you can use to create a
visual representation of the default filter graph created by Windows
for handling a particular media file or URL. The MediaCtrl class
should be using a similar graph with the default DirectShow backend,
so looking at the components on the graph can give you info about
which decoders and other filters are actually being used.

For information purposes, the original Microsoft tool for this is called
"graphedt", and it is included in the Windows SDK. GraphStudio is an
open source version of graphedt, and it is a huge improvement over the
original.

(I write web camera drivers for a living, so I'm quite proficient with
DirectShow, and good friends with GraphStudio.)

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

@ Birdy / Virgil Stokes wrote:

RE: The email sent with your attached sample app to my email.

OK… Got it open and managed to get it to fire up with os.getcwd().
looking at src…

    try:
        self.mc = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER,
                                     #szBackend=wx.media.MEDIABACKEND_DIRECTSHOW
                                     #szBackend=wx.media.MEDIABACKEND_QUICKTIME
                                     szBackend=wx.media.MEDIABACKEND_WMP10,

Normally as a default backend, use emptystring “” as a default. This will pick the best suited one for the platform.
Otherwise you should be familiar with registry stuff and figuring out if for example: if Quicktime is installed on windows.
Better OS code for the demos is really needed for figuring out what backend you should use by default.
WMP10 should be fine for MSW.
QUICKTIME should be fine for MAC.
GSTREAMER for Unix.
but “” by default seams to locate whatever is default.

Ok… now on to testing… WinXP ProSP3/ Win7Ultimate
wxPython 3.0.1.0.b20140104 msw (classic)
This is robin’s preview build to fix compiled stuff issues on XP, so note that you may need it also as a fix.

The blob(testfile).avi

Enter: OnLoadFile
Enter: DoLoadFile
Exit: DoLoadFile
DT = 100000 (microseconds)
= 100.00000 (milliseconds)
= 0.100000 (seconds)
SR = 10 (frames per second)
NF = 76 (number of frames)
Tmax = 7.6000000 (seconds)
Width = 298 (width in pixels)
Height = 298 (height in pixels)
Exit: OnLoadFile
Enter: OnMediaLoaded
TestCode\test1800.avi ready to play…
Total time: 7600 (ms)
Total: 1534770
Enter: seekOffset
frame = 1
offset = 0
Exit: seekOffset
Pos = 0 (ms)
Exit: OnMediaLoaded

upon loading testfile…
All buttons seem to work as normally would think they should including the SS Buttons.
Apparently the slider needs more work being integrated properly as the testapp is pretty basic atm.

Using oldschool ffdshow/ffmpeg video decoder.

Most any codec to play video needed is included in the K-Lite Mega Codec Pack.

NOTE! that Installing this is oftentimes a headache, because
you have to know what decoders you want otherwise things often go screwy and video doesn’t decode right with certain setups.
The installer presets often don’t work right is what I’m trying to say here. You have to pick and choose your setup manually.

As far as the video problems when moving the frame.
Bind, a Refresh() func to the frame’s, EVT_MOVE, EVT_SIZE events to handle the frame and/or MediaCtrl(child).

Overall, I didn’t have any problems with the testfile, besides the minor changes to get it to run. It’s pretty straight forward sample.
I’d look into getting a set of properly working codecs installed first, then look into refreshing the MediaCtrl after events.
Note also: sometimes the Media LOADED event doesn’t want to fire off on windows for odd unknown reasons.
Other poster’s answers above might help also as this may be a specific to your setup issue.

···

Metallicow wrote:

     >@ Birdy / Virgil Stokes wrote:

RE: The email sent with your attached sample app to my email.

OK... Got it open and managed to get it to fire up with os.getcwd().
looking at src...

try:
self.mc = wx.media.MediaCtrl(self, style=wx.SIMPLE_BORDER,
#szBackend=wx.media.MEDIABACKEND_DIRECTSHOW
#szBackend=wx.media.MEDIABACKEND_QUICKTIME
szBackend=wx.media.MEDIABACKEND_WMP10,

Normally as a default backend, use emptystring "" as a default. This
will pick the best suited one for the platform.
Otherwise you should be familiar with registry stuff and figuring out if
for example: if Quicktime is installed on windows.
Better OS code for the demos is really needed for figuring out what
backend you should use by default.
WMP10 should be fine for MSW.

DIRECTSHOW is newer technology and APIs for Windows than WMP10.

QUICKTIME should be fine for MAC.

And also works fine on Windows if Quicktime is installed, and for some forms of media is better than the above.

···

GSTREAMER for Unix.
but "" by default seams to locate whatever is default.

--
Robin Dunn
Software Craftsman

I am simply trying to relate refering to the best backend
for each DEFAULT platform, which is fineand seems to work right of the bat for OS’s.

QUICKTIME, isn’t a windows default, as much as I prefer it over WMP or “”,
but the demo default code should represent twhat OS the user is using.
Just to make things clear.
Portable code such as in: If I plug my thumbdrive into your computer, then it will run no matter what.

Linux is an iffy situation in this end of the ballpark,
but generally
QUICKTIME for apple,
WMP for windows.

I build my own install discs for windows, so I, quote(“I”), have the personal ability to modify a installation, based on what I think is crap.

The default crap disk includes everything MSW provided with the SP4 disc.

···

On Saturday, January 18, 2014 3:38:59 PM UTC-6, Robin Dunn wrote:

about codecs

@ Robin: In other words…
I am trying to say that using QUICKTIME as a backend, when it is not installed,
will cause a error(and causing the app to stop) if it is not installed on windows machines.
Hope I made this point clear for basics.

Thanks very much for your detailed analysis and suggestions. I will
definitely look into this more. However, after having so many problems with playing videos in
wxPython, I have taken another approach to the processing of short
video clips. In this approach the basic steps are: 1)� use ffmpeg to
create *.png image files from a short *.avi, 2)� use draw to canvas
methods of wxPython to loop on the *.png files. This works rather
well for the short video files that I have — looks like they are
being displayed with a video player. The big advantage of this
approach is that I have good control of each frame (image file) from
the video file.� That is, I can move forward or backwards through
these image files (video frames) with ease, and manipulate any image
that I wish (e.g. draw on them and change their properties) . And if
needed I can create a video file from these modified image files,
using ffmpeg — all in Python code.
After working on the control of video in wxPython for about 3 weeks
I finally realize It
would be useful to have more documentation and examples of video
processing in wxPython 3. It also seems that this problem is not
unique to wxPython.
—V

···

On 18-Jan-2014 11:46, Metallicow wrote:

      >@

Birdy

      RE: The email sent with your attached sample app to my email.




      OK... Got it open and managed to get it to fire up with

os.getcwd().

      looking at src...



      ������� try:

      ����������� self.mc = wx.media.MediaCtrl(self,

style=wx.SIMPLE_BORDER,

      ����������������������������������������

#szBackend=wx.media.MEDIABACKEND_DIRECTSHOW

      ����������������������������������������

#szBackend=wx.media.MEDIABACKEND_QUICKTIME

      ����������������������������������������

szBackend=wx.media.MEDIABACKEND_WMP10,

      Normally as a default backend, use emptystring "" as a

default. This will pick the best suited one for the platform.

      Otherwise you should be familiar with registry stuff and

figuring out if for example: if Quicktime is installed on
windows.

      Better OS code for the demos is really needed for figuring out

what backend you should use by default.

      WMP10 should be fine for MSW.

      QUICKTIME should be fine for MAC.

      GSTREAMER for Unix.

      but "" by default seams to locate whatever is default.



      Ok... now on to testing... WinXP ProSP3/ Win7Ultimate

      wxPython 3.0.1.0.b20140104 msw (classic)

      This is robin's preview build to fix compiled stuff issues on

XP, so note that you may need it also as a fix.

      The blob(testfile).avi

Enter: OnLoadFile

        �Enter: DoLoadFile

        �Exit:� DoLoadFile

        DT���� =������ 100000 (microseconds)

        ������ =��� 100.00000 (milliseconds)

        ������ =���� 0.100000 (seconds)

        SR���� =���������� 10 (frames per second)

        NF���� =���������� 76 (number of frames)

        Tmax�� =��� 7.6000000 (seconds)

        Width� =��������� 298 (width in pixels)

        Height =��������� 298 (height in pixels)

        Exit:� OnLoadFile

        Enter: OnMediaLoaded

        �TestCode\test1800.avi ready to play...

        �Total time: 7600 (ms)

        �Total: 1534770

        �Enter: seekOffset

        � frame� =���� 1

        � offset =���� 0

        �Exit: seekOffset

        �Pos = 0 (ms)

        Exit:� OnMediaLoaded
        upon loading testfile...

        All buttons seem to work as normally would think they should

including the SS Buttons.

        Apparently the slider needs more work being integrated

properly as the testapp is pretty basic atm.

        Using oldschool ffdshow/ffmpeg video decoder.



        Most any codec to play video needed is included in the

K-Lite Mega Codec Pack.

        NOTE! that Installing this is oftentimes a headache, because

you have to know what decoders you want otherwise things
often go screwy and video doesn’t decode right with certain
setups.
The installer presets often don’t work right is what I’m
trying to say here. You have to pick and choose your setup
manually.
As far as the video problems when moving the frame.
Bind, a Refresh() func to the frame’s, EVT_MOVE, EVT_SIZE
events to handle the frame and/or MediaCtrl(child).
Overall, I didn’t have any problems with the testfile,
besides the minor changes to get it to run. It’s pretty
straight forward sample.
I’d look into getting a set of properly working codecs
installed first, then look into refreshing the MediaCtrl
after events.
Note also: sometimes the Media LOADED event doesn’t want to
fire off on windows for odd unknown reasons.
Other poster’s answers above might help also as this may be
a specific to your setup issue.
�

  You received this message because you are subscribed to the Google

Groups “wxPython-users” group.

  To unsubscribe from this group and stop receiving emails from it,

send an email to .
For more options, visit .

— this is not a trivial problem.
:slight_smile:
http://www.free-codecs.com/download/k_lite_mega_codec_pack.htm

wxpython-users+unsubscribe@googlegroups.com
https://groups.google.com/groups/opt_out

If you are looking for individual frames stuff specifically, you could try this…

Output all the frames with vlc to pngs from the commandline with something like this…

vlc “C:\video.avi” --rate=1 --video-filter=scene --vout=dummy --aout=dummy --start-time=1 --stop-time=31 --scene-ratio=1 --scene-format=png --scene-prefix=frame- --scene-path=“C:\video\vlc_output_frames” vlc://quit

Then use a throbber to load and manipulate them. The wxPython Demo has a decent example of how this works with image sequences.
ATM it is as close to a animated apng you can get. AnimationCtrl doesn’t support apng yet, and gif colors range and transparency suck, so you are limited to throbber, MediaCtrl, or something custom you may develop.

There are a few python ffmpeg libraries around, but I haven’t looked into using them for any of my projects anyway, so I wouldn’t know.

···

On Sunday, January 19, 2014 5:02:49 AM UTC-6, Birdy wrote:

Thanks very much for your detailed analysis and suggestions. I will

definitely look into this more.

However, after having so many problems with playing videos in

wxPython, I have taken another approach to the processing of short
video clips. In this approach the basic steps are: 1)� use ffmpeg to
create *.png image files from a short *.avi, 2)� use draw to canvas
methods of wxPython to loop on the *.png files. This works rather
well for the short video files that I have — looks like they are
being displayed with a video player. The big advantage of this
approach is that I have good control of each frame (image file) from
the video file.� That is, I can move forward or backwards through
these image files (video frames) with ease, and manipulate any image
that I wish (e.g. draw on them and change their properties) . And if
needed I can create a video file from these modified image files,
using ffmpeg — all in Python code.

After working on the control of video in wxPython for about 3 weeks

I finally realize — this is not a trivial problem. It
would be useful to have more documentation and examples of video
processing in wxPython 3. It also seems that this problem is not
unique to wxPython.

---V  :-)