Files
aiData/DouYin/check_codecs.py
HuangHai f2f7a38210 'commit'
2026-01-20 19:06:36 +08:00

39 lines
1.2 KiB
Python

import os
import subprocess
def check_codecs(directory):
files = [f for f in os.listdir(directory) if f.endswith(".mp4")]
print(f"Checking {len(files)} files in {directory}...")
hevc_count = 0
h264_count = 0
for filename in files:
filepath = os.path.join(directory, filename)
try:
cmd = [
"ffprobe", "-v", "error",
"-show_entries", "stream=codec_name",
"-of", "default=noprint_wrappers=1:nokey=1",
filepath
]
result = subprocess.run(cmd, capture_output=True, text=True)
codecs = result.stdout.strip().split('\n')
if "hevc" in codecs:
print(f"[HEVC] {filename}")
hevc_count += 1
elif "h264" in codecs:
# print(f"[H264] {filename}")
h264_count += 1
else:
print(f"[UNKNOWN] {filename}: {codecs}")
except Exception as e:
print(f"Error checking {filename}: {e}")
print(f"\nSummary: H.264: {h264_count}, HEVC: {hevc_count}")
check_codecs(r"d:\dsWork\aiData\DouYin\DownloadedVideos")