Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

xiaoqi / mp4giftconvert

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit a6a14574 authored a month ago by xiaoqi's avatar xiaoqi
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

delete dir

parent e1cf50e4
Hide whitespace changes
Inline Side-by-side
Showing with 8 additions and 6 deletions
  • convert_webp_2_mp4.py
  • mp4_height_wrong.py
convert_webp_2_mp4.py
View file @ a6a14574
...@@ -449,7 +449,7 @@ def webp2mp4core(input_webp_path_str, output_file_path: str = None, output_name: ...@@ -449,7 +449,7 @@ def webp2mp4core(input_webp_path_str, output_file_path: str = None, output_name:
temp_dir = Path(tempfile.gettempdir()) / f"convert_webp4-{dir_name_end}" temp_dir = Path(tempfile.gettempdir()) / f"convert_webp4-{dir_name_end}"
temp_png_dir = temp_dir / webp_path.stem temp_png_dir = temp_dir / webp_path.stem
temp_png_alpha_dir = temp_dir / f"alpha_{webp_path.stem}" temp_png_alpha_dir = temp_dir / f"alpha_{webp_path.stem}"
delete_path(temp_dir)
# 使用更新后的临时文件夹路径进行后续操作 # 使用更新后的临时文件夹路径进行后续操作
if not webp2png(input_webp_path_str, temp_png_dir,target_width=p_width): if not webp2png(input_webp_path_str, temp_png_dir,target_width=p_width):
return return
...@@ -475,7 +475,7 @@ def webp2mp4core(input_webp_path_str, output_file_path: str = None, output_name: ...@@ -475,7 +475,7 @@ def webp2mp4core(input_webp_path_str, output_file_path: str = None, output_name:
# 合并视频并清理临时文件 # 合并视频并清理临时文件
merge_videos_side_by_side(temp_output_alpha_video_path, temp_normal_output_video_path, output_merge_video_path) merge_videos_side_by_side(temp_output_alpha_video_path, temp_normal_output_video_path, output_merge_video_path)
print(f"两个视频合并完成,保存在{output_merge_video_path},开始删除临时文件") print(f"两个视频合并完成,保存在{output_merge_video_path},开始删除临时文件")
delete_path(temp_dir)
# 注意:这里假设其他所需函数(如webp2png, convert_to_grayscale, png2mp4, get_fps, merge_videos_side_by_side, delete_path)已经定义。 # 注意:这里假设其他所需函数(如webp2png, convert_to_grayscale, png2mp4, get_fps, merge_videos_side_by_side, delete_path)已经定义。
def convert_png_dir(): def convert_png_dir():
......
This diff is collapsed. Click to expand it.
mp4_height_wrong.py
View file @ a6a14574
import os import os
from moviepy import VideoFileClip from moviepy import VideoFileClip
list = []
def check_mp4_height(directory): def check_mp4_height(directory):
# 遍历给定目录下的所有文件 # 遍历给定目录下的所有文件
for filename in os.listdir(directory): for filename in os.listdir(directory):
...@@ -13,11 +13,13 @@ def check_mp4_height(directory): ...@@ -13,11 +13,13 @@ def check_mp4_height(directory):
height = video.size[1] height = video.size[1]
# 检查高度是否为偶数 # 检查高度是否为偶数
if height % 2 != 0: if height % 2 != 0:
print(f"文件名: {filename}, 高度: {height} (不是偶数)") list.append(f"文件名: {filename}, 高度: {height} (不是偶数)")
except Exception as e: except Exception as e:
print(f"无法处理文件 {filename}: {e}") print(f"无法处理文件 {filename}: {e}")
if __name__ == '__main__': if __name__ == '__main__':
# 用户输入目录路径 # 用户输入目录路径
mp4_directory = input("请输入MP4文件所在的目录:") mp4_directory = input("请输入MP4文件所在的目录:")
check_mp4_height(mp4_directory) check_mp4_height(mp4_directory)
\ No newline at end of file for i in enumerate(list):
print(i)
\ No newline at end of file
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment