[英]Use list of dates to timestamp / label mp4 video in python
我有一個在 Google 地球引擎中創建的 MP4 視頻文件 (Amundsen.mp4) - 延時攝影和每個圖像的日期列表 (dates.txt) - 不是所有連續的日子。
我想使用這個日期列表為 python 中視頻中的每一幀添加時間戳。 有人可以建議如何做,或者向我指出一個這樣做的教程嗎? 我還沒有找到有關如何以這種方式處理視頻的資源。
感謝評論我成功了。 這是我成功的代碼
from moviepy.editor import *
clip = VideoFileClip("myvideo.mp4")
text_list = list3 # List of dates
clip_list = []
for text in text_list:
try:
txt_clip = TextClip(text, fontsize = 70, color = 'red').set_duration(1)
clip_list.append(txt_clip)
except UnicodeEncodeError: #Unsure if this part is necessary, took from elsewhere to address someone else's issue, but doesn't cause a problem
txt_clip = TextClip("Issue with text", fontsize = 70, color = 'red').set_duration(1)
clip_list.append(txt_clip)
datevideo = concatenate(clip_list, method = "compose")
video2 = CompositeVideoClip([clip, datevideo])
#Write video
video2.write_videofile("videotest.mp4", fps = 1, codec = 'mpeg4')
# show video here embdeedded
#video2.ipython_display(width = 280)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.