I have a problem that when playing a video with pyglet apparently the beginning and the end of the stream is not handled correctly. The player ignores the first keyframe and thus shows glitches images until the it finds the second keyframe. Likewise the on_eos-event is not fire but python chrashes because it apparently tries to load more frames.
import pyglet
vidPath = "test.mp4"
window = pyglet.window.Window()
player = pyglet.media.Player()
source = pyglet.media.load(vidPath)
player.queue(source)
player.play()
@player.event
def on_eos():
print('video end')
@window.event
def on_draw():
window.clear()
if player.source and player.source.video_format:
player.get_texture().blit(0, 0)
pyglet.app.run()
I am using Python 3.4.3, pyglet 1.2.4 and AVbin 10 on OSX 10.11.3.
Trying the same code and videos on Ubuntu I get the same problems and the following errors on start:
Non-reference picture received and no reference available
[h264 @ 0x3386700] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x33880e0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x3388520] decode_slice_header error
[h264 @ 0x3388a80] illegal short term buffer state detected
Non-reference picture received and no reference available
[h264 @ 0x3388a80] decode_slice_header error
[h264 @ 0x338c2e0] reference picture missing during reorder
[h264 @ 0x338c2e0] reference picture missing during reorder
[h264 @ 0x338c2e0] reference picture missing during reorder
and these once the video has reached the end:
[h264 @ 0x23bde00] no frame!
[h264 @ 0x23bf7e0] AVC: nal size 0
[h264 @ 0x23bf7e0] AVC: nal size 0
[h264 @ 0x23bf7e0] no frame!
[h264 @ 0x23bfc20] AVC: nal size 0
[h264 @ 0x23bfc20] AVC: nal size 0
Any ideas what is the problem here? I have some videos that start correctly but the end is never recognized.