使用 pymovie 的 ipython_display 在此代码后无法播放视频

问题描述

我有一个包含 pymovie 的视频,并在名为“剪辑”的列表中将块分成 1 分钟的视频,它由名为“书签”的 pd df 制成,列 = [“时间”,“类型”],其中类型只能获得“开始” " 或 "end" 所以基本上它想在一些时间之间连接视频并在带有 ipython_display 的 jupyternotebook 中播放视频但它不会显示视频但我可以中断程序并播放剪辑而我不想。所以你能解决代码的任何问题,还是问题出在 jupyternotebook 或 pymovie 或 ipython_display 。 ofc 我不想用 matplotlib 逐帧播放,我想要视频播放器。 clear_output(wait=True) 行也没有帮助。

from IPython.display import clear_output
final_clips=[]
starts=bookmarks.index[bookmarks['type']=="start"]
if len(starts!=0):
    for i in range(len(starts)):
        thisstarttime=bookmarks.loc[i,'time']
        ends=bookmarks.index[(bookmarks['type']=="end") & (bookmarks['time']>thisstarttime)].tolist()
        print("ends",ends)
        if len(ends)!=0:
            itsendtime=bookmarks.loc[ends[0],'time']
            if int(thisstarttime/60)==int(itsendtime/60):
                final_clips.append(clips[int(thisstarttime/60)].subclip(thisstarttime%60,itsendtime%60))
            else:
                final_clips.append(clips[int(thisstarttime/60)].subclip(thisstarttime%60,60))
                for j in range(int(thisstarttime/60)+1,int(itsendtime/60)):
                    final_clips.append(clips[j].subclip(0,60))
                final_clips.append(clips[int(itsendtime/60)].subclip(0,itsendtime%60))
    final_clip = concatenate_videoclips([final_clips[i] for i in range(len(final_clips))])
    clear_output(wait=True)
    final_clip.ipython_display(width=1200)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)