2

Using python module ffpyplayer, How can I see the frames or get the img object to display or show the video image/frames to the screen?, in the tutorial that I followed, it seems very simple, it reads the frames and plays oudio but (does not display) any video image or frame to the screen, only if I add the (print img, t) will print the frame info to the screen but not video image is displayed on the screen.

I being following tutorials from: https://pypi.python.org/pypi/ffpyplayer, and here: http://matham.github.io/ffpyplayer/player.html, and searched google but the only relevant results point to the same info, I am somewhat new to programming and python, and so maybe I am missing something that seems to be very simple but I can't figure it out myself.

I am using: windows 7 64bit, python 2.7.11 32bit.

Any Help will be appreciated thank you very much.

from ffpyplayer.player import MediaPlayer

vid = 'test_video.flv'
player = MediaPlayer(vid)
val = ''
while val != 'eof':
    frame, val = player.get_frame()
    if val != 'eof' and frame is not None:
        img, t = frame
        print img, t     #This prints the image object
        # display img    #This does nothing!
Diego Suarez
  • 901
  • 13
  • 16
  • 1
    [This](https://stackoverflow.com/questions/59611075/how-would-i-go-about-playing-a-video-stream-with-ffpyplayer/59628167#59628167) might help you. – Vencat Jan 07 '20 at 12:12

1 Answers1

1

Kivy already provides such a video player, based on ffpyplayer, for you.
It also has the necessary threads already setup for you, to deal with buttons, file reading, audio and timing.
Check this page: https://kivy.org/docs/api-kivy.uix.videoplayer.html

To install kivy: https://kivy.org/docs/installation/installation.html

Then you might wish to take a look at the code in:

<< python_path >>\lib\site-packages\kivy\uix\videoplayer.py

That example could be rather complex, so you can also look at this url:
How to play videos from the web like youtube in kivy

Finally, in case Kivy complains that you only have opengl 1.1 (as happened to me), you might try adding the following lines to your code:

from kivy.config import Config
Config.set('graphics', 'multisamples', '0')

These solved the problem to me.

Community
  • 1
  • 1
Miguel
  • 64
  • 4