蚕茧视频识别AI程序关键代码(不包含资源、模型、转换库)

This commit is contained in:
BBIT-Kai
2025-11-18 16:36:05 +08:00
parent 7a5e29be1c
commit 4fa0c7d1eb
23 changed files with 2269 additions and 0 deletions
+78
View File
@@ -0,0 +1,78 @@
from utils.pgDb import pg_pool
import json
def insert_sca_video(
name,
raw_object_name,
ai_object_name,
duration,
size,
video_codec,
audio_codec,
overall_bit_rate,
resolution,
sc_analysis_time,
sc_analysis_total_count,
sc_analysis_max_count,
sc_analysis_primary_type,
sc_analysis_secondary_type,
other_info,
):
with pg_pool.getConn() as conn:
with conn.cursor() as cursor:
other_info = json.dumps(other_info, ensure_ascii=False)
cursor.execute(
"""
INSERT INTO sca_videos (
name, raw_object_name, ai_object_name, duration, size, video_codec, audio_codec,
overall_bit_rate, resolution, sc_analysis_time, sc_analysis_total_count, sc_analysis_max_count,
sc_analysis_primary_type, sc_analysis_secondary_type, other_info, created_at
)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NOW())
RETURNING id
""",
(
name,
raw_object_name,
ai_object_name,
duration,
size,
video_codec,
audio_codec,
overall_bit_rate,
resolution,
sc_analysis_time,
sc_analysis_total_count,
sc_analysis_max_count,
sc_analysis_primary_type,
sc_analysis_secondary_type,
other_info,
),
)
new_id = cursor.fetchone()[0]
conn.commit()
return new_id
def insert_sca_video_details(
v_id,
time_stamp,
other_info,
):
with pg_pool.getConn() as conn:
with conn.cursor() as cursor:
other_info = json.dumps(other_info, ensure_ascii=False)
cursor.execute(
"""
INSERT INTO sca_video_details (
v_id, time_stamp, other_info
)
VALUES (%s, %s, %s)
""",
(
v_id,
time_stamp,
other_info,
),
)
conn.commit()