当前位置: 首页 > news >正文

设计logo免费网站聊城开发区建设局网站

设计logo免费网站,聊城开发区建设局网站,上海网站推广价格,自动生成网址的软件1.更改视频帧数 降低视频帧数#xff0c;简单的操作只能降低视频帧数#xff0c;如果要增加视频帧数#xff0c;那就要使用深度学习进行插帧处理#xff1a; import cv2 from moviepy.editor import * def change_fps(inpt_path,output_path,fps):# 加载视频video Video…1.更改视频帧数 降低视频帧数简单的操作只能降低视频帧数如果要增加视频帧数那就要使用深度学习进行插帧处理 import cv2 from moviepy.editor import * def change_fps(inpt_path,output_path,fps):# 加载视频video VideoFileClip(inpt_path)# 将帧率降低为15帧/秒new_video video.set_fps(fps)# 保存为新的文件new_video.write_videofile(output_path, codeclibx264)def change_fps_dir(video_dir,fps):file_list os.listdir(video_dir)for file in file_list:# 使用os.path.basename()获取文件名包括后缀file_name os.path.basename(file)out_name F file_nameinput os.path.join(video_dir,file_name)output os.path.join(video_dir,out_name)change_fps(input,output,fps)2.把视频拆分成帧保存 def split_video(video_path,save_path):# 创建输出目录os.makedirs(save_path, exist_okTrue)# 打开视频文件cap cv2.VideoCapture(video_path)frame_count 0# 读取视频帧并保存为图像while True:ret, frame cap.read()if not ret:break# 生成输出图像文件名frame_filename os.path.join(save_path, f{frame_count:05d}.jpg)frame_count 1# 保存帧图像cv2.imwrite(frame_filename, frame)# 释放视频文件cap.release()print(f总共保存了 {frame_count} 帧图像)3.把拆分图像合成视频 def img_video_merge(img_dir,video_path,frame_rate):file_list os.listdir(img_dir)cv_src cv2.imread(os.path.join(img_dir,file_list[0]))fourcc cv2.VideoWriter_fourcc(*mp4v) # 使用H.264编解码器height, width, channels cv_src.shape# 帧速率和帧大小frame_size (width, height)# 创建VideoWriter对象out cv2.VideoWriter(video_path, fourcc, frame_rate, frame_size)for file in file_list:cv_dst cv2.imread(os.path.join(img_dir, file))out.write(cv_dst)4.提取视频的音轨 def video_to_audio(video_path,audio_path):video VideoFileClip(video_path)audio video.audioaudio_temp temp.wavif os.path.exists(audio_path):os.remove(audio_temp)audio.write_audiofile(audio_temp)audio.close()if os.path.exists(audio_path):os.remove(audio_path)cmd ffmpeg -i audio_temp -ac 1 -ar 16000 audio_pathsubprocess.run(cmd,shellTrue) 5.视频与音轨合并 from moviepy.editor import VideoFileClip, AudioFileClip# 读取视频和音轨 video_clip VideoFileClip(video.mp4) # 替换为您的视频文件 audio_clip AudioFileClip(audio.mp3) # 替换为您的音轨文件# 将音轨添加到视频 video_clip video_clip.set_audio(audio_clip)# 保存合并后的视频 output_video_path output_video.mp4 video_clip.write_videofile(output_video_path, codeclibx264)# 关闭视频和音轨文件 video_clip.close() audio_clip.close()print(f已将音轨成功合并到视频并保存为 {output_video_path})6.视频合并 def image_stitching(images,stack):height, width, channels images[0].shape# 遍历所有图像如果尺寸不同将它们调整为相同的尺寸for i in range(1, len(images)):if images[i].shape ! (height, width, channels):images[i] cv2.resize(images[i], (width, height))if stack 0:result np.hstack(images)else:result np.vstack(images)return result#stack为0是水平合并等于1是垂直合并 def video_stitching(video_path_1,video_path_2,output_path,stack):cap1 cv2.VideoCapture(video_path_1)cap2 cv2.VideoCapture(video_path_2)if stack 0:frame_width int(cap1.get(3)) * 2frame_height int(cap1.get(4))elif stack 1:frame_width int(cap1.get(3))frame_height int(cap1.get(4)) * 2fourcc cv2.VideoWriter_fourcc(m, p, 4, v)out cv2.VideoWriter(output_path, fourcc, 25, (frame_width, frame_height))while (True):ret1, frame1 cap1.read()ret2, frame2 cap2.read()if ret1 and ret2 True:images [frame1, frame2]dst image_stitching(images,stack)out.write(dst)else:breakcap1.release()cap2.release()out.release()
http://www.hkea.cn/news/14265015/

相关文章:

  • 凡科建站代理九亭 网站建设
  • 长春做公司网站的江门建设银行网站
  • 网站首页背景图片品牌创意设计
  • wifi扩展器做网站期货软件定制开发公司
  • 常见的网站建设程序有哪些银川seo公司
  • 点了网站域名会跳转昆山住房城乡建设局网站查询
  • 专做国外旅游的网站湛江网站建设湛江
  • 做网站的简称wordpress oss ftp
  • 湖北网站建设电话wordpress关注公众号
  • 清河做网站多少钱邯郸广告公司网站建设
  • 房山营销型网站建设微信公众号运营要求
  • 二级域名网站免费建站wordpress 媒体备份
  • 免费做网站教程wordpress头部文字改不了
  • 阿里云做网站经费百度怎么推广自己的产品
  • 衡水精品网站建设报价wordpress能放视频播放器
  • 流量网站怎么做的wordpress代理服务器
  • 做外贸没有企业网站昌平网站开发公司
  • 如何做网站数据分析大学电子商务专业就业方向
  • 互联网网站怎么做建管家企业网站
  • 做网站一定要认证吗合肥做网站怎么样
  • erp管理系统免费版山西seo顾问
  • 做物流网站注意什么完全网络营销网站
  • 自己做的网站提示不安全吗系统官网网站模板下载
  • 免费字体设计 常见网站wordpress调用标签代码
  • 外贸网站推广上海网站联盟是什么
  • 新闻门户网站建设软件开发培训学校三八妇女节
  • 什么是网站建设与维护苏州自学网站建设平台
  • PHP网站开发简单实例网站设计工具
  • 国外 外贸 网站 源码外贸产品网站建设
  • 苏州诗华洛网站建设南京网站优化公司