fix
This commit is contained in:
parent
7affc2d940
commit
e8672dd308
|
@ -242,6 +242,8 @@ idx = 0
|
||||||
while True:
|
while True:
|
||||||
from_fail = False
|
from_fail = False
|
||||||
s = S()
|
s = S()
|
||||||
|
video_id = 0
|
||||||
|
try:
|
||||||
video = s.get_one_wait_compress_video()
|
video = s.get_one_wait_compress_video()
|
||||||
if not video:
|
if not video:
|
||||||
video = s.get_one_fail_compress_video()
|
video = s.get_one_fail_compress_video()
|
||||||
|
@ -252,7 +254,6 @@ while True:
|
||||||
continue
|
continue
|
||||||
idx += 1
|
idx += 1
|
||||||
video_id = safe_get_int(video, "id")
|
video_id = safe_get_int(video, "id")
|
||||||
try:
|
|
||||||
logger.Info("================== {}, from_fail:{}, {} start ==================".format(idx, from_fail, video_id))
|
logger.Info("================== {}, from_fail:{}, {} start ==================".format(idx, from_fail, video_id))
|
||||||
ok = s.proc_one(video)
|
ok = s.proc_one(video)
|
||||||
if not ok:
|
if not ok:
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
from lib.all import *
|
||||||
|
import subprocess
|
||||||
|
import json
|
||||||
|
|
||||||
|
host = "https://wishpal-ironfan-media.oss-cn-hangzhou-internal.aliyuncs.com/"
|
||||||
|
|
||||||
|
|
||||||
|
def get_pixel_format(video_url):
|
||||||
|
command = [
|
||||||
|
'ffprobe', '-v', 'quiet',
|
||||||
|
'-show_streams', '-select_streams', 'v:0',
|
||||||
|
'-print_format', 'json', video_url
|
||||||
|
]
|
||||||
|
|
||||||
|
result = subprocess.run(command, capture_output=True, text=True)
|
||||||
|
output = result.stdout
|
||||||
|
|
||||||
|
data = json.loads(output)
|
||||||
|
streams = data.get('streams', [])
|
||||||
|
|
||||||
|
if streams:
|
||||||
|
pix_fmt = streams[0].get('pix_fmt', 'Unknown')
|
||||||
|
return pix_fmt
|
||||||
|
else:
|
||||||
|
return 'No video stream found'
|
||||||
|
|
||||||
|
|
||||||
|
class S:
|
||||||
|
def __init__(self):
|
||||||
|
self.col_video = MongoDB(
|
||||||
|
host="mongodb://root:Wishpal2024@dds-bp1da1ddd62bede41.mongodb.rds.aliyuncs.com:3717,dds-bp1da1ddd62bede42.mongodb.rds.aliyuncs.com:3717/admin?replicaSet=mgset-77304659",
|
||||||
|
port=3717,
|
||||||
|
db="media",
|
||||||
|
collection="video"
|
||||||
|
)
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
self.col_video.close()
|
||||||
|
|
||||||
|
def proc(self):
|
||||||
|
prj = {
|
||||||
|
"src_id": 1,
|
||||||
|
"src_id_h264": 1
|
||||||
|
}
|
||||||
|
docs = self.col_video.find({}, projection=prj)
|
||||||
|
for d in docs[:10]:
|
||||||
|
vid = safe_get_int(d, "_id")
|
||||||
|
src_id_h264 = safe_get_str(docs, d)
|
||||||
|
url = host + src_id_h264
|
||||||
|
print(vid, url)
|
||||||
|
|
||||||
|
|
||||||
|
# video_url = 'https://filecdn01.tiefen.fun/vdprodh264720/5a/d7/175d-2137-4a66-8e5c-d5ed61241b6c'
|
||||||
|
# pixel_format = get_pixel_format(video_url)
|
||||||
|
# print(f'Pixel Format: {pixel_format}')
|
||||||
|
s = S()
|
||||||
|
s.proc()
|
Loading…
Reference in New Issue