matham / ffpyplayer

A cython implementation of an ffmpeg based player.
GNU Lesser General Public License v3.0
134 stars 38 forks source link

url play repeat last part a few times #57

Open redstoneleo opened 5 years ago

redstoneleo commented 5 years ago

url play repeat last part of the file a few times , a bug. tested with

filename = 'http://dict.youdao.com/dictvoice?audio=nice&type=1'
from ffpyplayer.player import MediaPlayer
player = MediaPlayer(filename)#, ff_opts={'autoexit': True}, 'loop': 2
matham commented 4 years ago

I tried it just now and couldn't replicate the issue.

redstoneleo commented 4 years ago

Tested with Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] on win32 wun7 32bit and ffpyplayer-4.3.0, the above code crshed python.

matham commented 4 years ago

My test was with some fixes I added to current master that is not contained in 4.3.0. I was able to play it without any problems.

redstoneleo commented 4 years ago

Would you mind release a fixed version ? Otherwise I am not able to test the problem.

matham commented 4 years ago

Yeah, I'll be making a new release soonish.

redstoneleo commented 4 years ago

Tested with FFPyPlayer-4.3.1 When I tested in Python IDLE, the issue remains so. When tested in Sublime , it just crashed Python

matham commented 4 years ago

Can you provide a full log of running the program showing the crash and everything?

redstoneleo commented 4 years ago

just this line

[mp3 @ 02c44280] Estimating duration from bitrate, this may be inaccurate

and then the python has stopped working dialog

BTW, I tested with the code

import time
filename = 'http://dict.youdao.com/dictvoice?audio=nice&type=1'

from ffpyplayer.player import MediaPlayer
player = MediaPlayer(filename)  # , ff_opts={'autoexit': True}, 'loop': 2

i = 0
while 1:
    i += 1
    print(i)
    frame, val = player.get_pts()
    print('get_frame-----------', frame, val)
    if val == 'eof':
        break
    elif frame is None:
        time.sleep(0.01)
    else:
        img, t = frame
        print(val, t, img.get_pixel_format(), img.get_buffer_size())
        time.sleep(val)