【问题标题】:get last frame of a vedio clip and extend for 10 scends using moviepy获取视频剪辑的最后一帧并使用moviepy延长10秒
【发布时间】:2019-12-15 07:17:16
【问题描述】:

我正在使用moviepy 编辑一些视频剪辑。我想播放原始剪辑的最后一帧 10 秒,以便在其上显示一些文本。我尝试使用

将最后一帧转换为视频
clip.to_ImageClip(t=clip.duration).set_duration(10)

但是失败了。

有人知道为什么吗?以及任何可能的解决方案。

import moviepy.editor as ed
import os

content=ed.VideoFileClip(path)
myclip=content.to_ImageClip(content.duration).set_duration(10)
myclip.write_videofile(path)

MoviePy 错误:

failed to read the first frame of video file C:\my\test.mp4. 

That might mean that the file is corrupted. 
That may also mean that you are using a deprecated version of FFMPEG. 
On Ubuntu/Debian for instance the version in the repos is deprecated. 
Please update to a recent version from the website. 

【问题讨论】:

    标签: python moviepy


    【解决方案1】:

    我也面临同样的问题,但是,下面的代码对我有用:

    clip = VideoFileClip(path)
    frame_t = clip.duration - 1
    ext_clip = clip.to_ImageClip(t=frame_t, duration=4)
    ext_clip.write_videofile("sample4.mp4", fps=24)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多