本文整理汇总了Python中moviepy.editor.VideoFileClip.fps方法的典型用法代码示例。如果您正苦于以下问题:Python VideoFileClip.fps方法的具体用法?Python VideoFileClip.fps怎么用?Python VideoFileClip.fps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类moviepy.editor.VideoFileClip
的用法示例。
在下文中一共展示了VideoFileClip.fps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VideoFileClip
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import fps [as 别名]
args = parser.parse_args()
if args.round == 0:
args.round = 12
clip = VideoFileClip(args.input)
if args.length is not None:
clip = clip.set_duration(args.length)
print "Read clip, duration = %.1fs, FPS = %.1f" % (clip.duration, clip.fps)
#------------------------------------------------------------------------
# Non-integer frame rates (e.g. 29.97) cause problems when retrieving
# offsets. Round to an integer.
#------------------------------------------------------------------------
clip.fps = round(clip.fps)
#------------------------------------------------------------------------
# Transform brightnesses into a list of (offset_seconds, brightness)
#------------------------------------------------------------------------
print "Analysing brightness ...."
brightnesses = [ (index / clip.fps, round(np.mean(frame) / 255.0, args.round)) for index, frame in enumerate(clip.iter_frames()) ]
#------------------------------------------------------------------------
# Sort ascending
#------------------------------------------------------------------------
brightnesses = sorted(brightnesses, key = lambda x: ((-1 if args.reverse else 1) * x[1], x[0]))
#------------------------------------------------------------------------
# Transform into pairs of (origin_offset, destination_offset)
#------------------------------------------------------------------------
示例2: VideoFileClip
# 需要导入模块: from moviepy.editor import VideoFileClip [as 别名]
# 或者: from moviepy.editor.VideoFileClip import fps [as 别名]
from moviepy.editor import VideoFileClip, concatenate_videoclips
clip1 = VideoFileClip("partly_cloudy.mp4").subclip(747, 759)
clip1.fps = 15
clip1.write_videofile("partly_cloudy_short.mp4")