Closed Akascape closed 2 years ago
@Akascape Sorry for the late reply, I didn't get notified of this issue, Is there any traceback? If there is then just catch the error using the try-except
clause and inform the user that the file is corrupted.
As for the frame rate issue. Can you try uncommenting this line? https://github.com/PaulleDemon/tkVideoPlayer/blob/dcb81a8d1180a0e489d49414fcb7519a004706b3/tkVideoPlayer/tkvideoplayer.py#L179
Also the self._video_meta should be _video_info. Try and let me know.
@PaulleDemon Its working with those but normal videos are now slowed. Btw I have fixed the crash error by limiting the file type.
@Akascape I'll look into this later, let me know if you have any ideas. Thanks
@PaulleDemon I have built my app and everything is working fine but the crash is sometimes critical when a corrupted video is played. I am getting this traceback:
Exception in thread Thread-4 (_load):
Traceback (most recent call last):
File "Python\lib\threading.py", line 1009, in _bootstrap_inner
self.run()
File "Python\lib\threading.py", line 946, in run
self._target(*self._args, **self._kwargs)
File "Python\lib\site-packages\tkVideoPlayer\tkvideoplayer.py", line 106, in _load
with av.open(path) as self._container:
File "av\container\core.pyx", line 401, in av.container.core.open
File "av\container\core.pyx", line 272, in av.container.core.Container.__cinit__
File "av\container\core.pyx", line 292, in av.container.core.Container.err_check
File "av\error.pyx", line 336, in av.error.err_check
av.error.InvalidDataError: [Errno 1094995529] Invalid data found when processing input: 'corrupted_video.mp4';
last error log: [mov,mp4,m4a,3gp,3g2,mj2] moov atom not found
After this error, the video player freezes and stops working. Even a stable video is not playable without a restart. What to do in that case?
@Akascape Have you tried try-except block? Maybe just try catching the error and stop the video from playing.
@PaulleDemon I used the try-except method like this:
def play_pause():
""" pauses and plays """
try:
if vid_player.is_paused():
vid_player.play()
play_pause_btn["text"] = "Pause"
else:
vid_player.pause()
play_pause_btn["text"] = "Play"
except:
pass
I tried the try-except method in every block but still getting that error if I load that video directly. Actually the case is rare and only happens with conversion failed videos(with no data). But as my program is about data corruption and glitch art so sometimes it may create those type of videos, and I want to block those from interrupting the program. What can I do?
@Akascape sorry for the late reply, I am not being notified of the conversations on time. Can you check out this post on SO: https://stackoverflow.com/questions/11523797/how-to-add-a-moov-atom-in-a-mp4-video-file
I tried -movflags faststart but its not working. I think I have to try different conversion settings and also have to improve my other core files. Thanks for your help... @PaulleDemon
@Akascape Ok, then can I close the issue? since it's not directly related to the library.
@PaulleDemon TkvideoPlayer works fine with normal video but when a damaged file or non-video file is loaded then the pyav crashes and tkvideoplayer options also freezes and we have to restart the program.
Is there any way to reload or stop the pyav process in that case?
Secondly, I am also facing a playback speed issue with some raw videos (with variable frame rates) , I tried changing
vid_player.set_resampling_method(1)
andconsistant_frame_rate=True
but still the playback speed is very high with those videos.How can I fix this?