-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vfx.TimeSymmetrize
cutoffs 1 second at the end and makes picture jump
#2286
Comments
I encountered the same issue. Did you find a solution? |
Hi, that's the next one on my list, I'll take a look when I can ! |
Hi, @chenhaoch and @AndrewFucher could any of you provide some code example triggering the bug, including the media used in the code example. |
I didn't use my code: video_files = [os.path.join('videos', f) for f in os.listdir('videos') if f.endswith('.mp4')]
video_clips = [VideoFileClip(f) for f in video_files]
# 创建正序和逆序视频片段
processed_clips = []
for clip in video_clips:
processed_clips.append(clip)
mirrored_clip = clip[::-1]
# processed_clips.append(clip.with_effects([vfx.TimeSymmetrize()]))
processed_clips.append(mirrored_clip)
# mirrored_clip.write_videofile('output.mp4', codec='libx264', audio_codec='aac', audio_bitrate='192k')
# 合并视频
final_video = concatenate_videoclips(processed_clips)
final_video.write_videofile('video_output.mp4', codec='libx264', audio_codec='aac', audio_bitrate='192k') |
and I checked the first and last frames, they don't correspond. processed_clips = []
for i, new_clip in enumerate(video_clips):
# clip = new_clip.subclipped(0,5)
# 保存原始视频第一帧和最后一帧
frame = clip.get_frame(0)
img = Image.fromarray(frame)
img.save(f'frames/original_first_{i}.jpg')
# 使用iter_frames获取原始视频最后一帧
clip_frames = list(clip.iter_frames())
clip_last_frame = clip_frames[-1]
img = Image.fromarray(clip_last_frame)
img.save(f'frames/original_last_{i}.jpg')
processed_clips.append(clip)
# 保存TimeMirror处理后的第一帧和最后一帧
mirrored_clip = clip.with_effects([vfx.TimeMirror()])
frame = mirrored_clip.get_frame(0)
img = Image.fromarray(frame)
img.save(f'frames/mirrored_first_{i}.jpg')
# 使用iter_frames获取TimeMirror处理后的最后一帧
mirrored_clip_frames = list(mirrored_clip.iter_frames())
mirrored_clip_last_frame = mirrored_clip_frames[-1]
img = Image.fromarray(mirrored_clip_last_frame)
img.save(f'frames/mirrored_last_{i}.jpg')
processed_clips.append(mirrored_clip) |
Hi, I think I found the problem, but another matter seems to appear when applying some sub clipping, so I will need a bit of time to fix both. |
Hi,
While trying to use
vfx.TimeSymmetrize
I found out that it cutoffs 1 second at the end (start for backward part)Issue lies in how slices are calculated in Clip class.
Expected Behavior
TimeSymmetrize
Will add exactly same video but in reverseActual Behavior
Reversed part is cut by 1 second
Steps to Reproduce the Problem
Just use this effect
TimeSymmetrize
Specifications
The text was updated successfully, but these errors were encountered: