yeref 0.25.57__py3-none-any.whl → 0.25.59__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
yeref/yeref.py
CHANGED
@@ -16769,6 +16769,40 @@ async def item_to_dynamic_sticker(bot, chat_id, input_file, PACK_TYPE, PACK_KIND
|
|
16769
16769
|
|
16770
16770
|
# clip = mp.VideoFileClip(input_file)
|
16771
16771
|
# width, height = clip.size
|
16772
|
+
|
16773
|
+
import tempfile
|
16774
|
+
print(1)
|
16775
|
+
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
16776
|
+
print(2)
|
16777
|
+
tmp_fd, tmp_path = tempfile.mkstemp(suffix='.mp4')
|
16778
|
+
print(3)
|
16779
|
+
os.close(tmp_fd)
|
16780
|
+
print(4)
|
16781
|
+
cap = cv2.VideoCapture(input_file)
|
16782
|
+
print(5)
|
16783
|
+
out = cv2.VideoWriter(tmp_path, fourcc, fps, (width, height))
|
16784
|
+
print(6)
|
16785
|
+
while True:
|
16786
|
+
print(7)
|
16787
|
+
ret, frame = cap.read()
|
16788
|
+
print(8)
|
16789
|
+
if not ret: break
|
16790
|
+
print(9)
|
16791
|
+
img = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
16792
|
+
print(10)
|
16793
|
+
output_ = remove(img)
|
16794
|
+
print(11)
|
16795
|
+
frame2 = cv2.cvtColor(np.array(output_), cv2.COLOR_RGB2BGR)
|
16796
|
+
print(12)
|
16797
|
+
out.write(frame2)
|
16798
|
+
print(13)
|
16799
|
+
cap.release()
|
16800
|
+
print(14)
|
16801
|
+
out.release()
|
16802
|
+
print(15)
|
16803
|
+
os.replace(tmp_path, input_file)
|
16804
|
+
print(16)
|
16805
|
+
print(f"{tmp_path=}, {input_file=}")
|
16772
16806
|
|
16773
16807
|
if width % 2 != 0: width -= 1
|
16774
16808
|
if height % 2 != 0: height -= 1
|
@@ -16788,16 +16822,16 @@ async def item_to_dynamic_sticker(bot, chat_id, input_file, PACK_TYPE, PACK_KIND
|
|
16788
16822
|
|
16789
16823
|
try:
|
16790
16824
|
# if is_circle:
|
16791
|
-
ffmpeg_command = [
|
16792
|
-
|
16793
|
-
|
16794
|
-
|
16795
|
-
|
16796
|
-
|
16797
|
-
]
|
16825
|
+
# ffmpeg_command = [
|
16826
|
+
# 'ffmpeg', '-i', input_file, '-filter_complex_threads', '2',
|
16827
|
+
# '-r', str(fps),
|
16828
|
+
# '-c:v', 'libx264', '-preset', 'slow', '-crf', '18',
|
16829
|
+
# '-pix_fmt', 'yuv420p',
|
16830
|
+
# '-s', pixels_str, '-t', '3', '-an', '-y', file_mp4
|
16831
|
+
# ]
|
16798
16832
|
# else:
|
16799
|
-
|
16800
|
-
|
16833
|
+
ffmpeg_command = ['ffmpeg', '-i', input_file, '-filter_complex_threads', '2', '-r', str(fps), '-b:v',
|
16834
|
+
'40k', '-crf', '30', '-s', pixels_str, '-t', '3', '-an', '-y', file_mp4]
|
16801
16835
|
print(f"{ffmpeg_command=}")
|
16802
16836
|
p = await asyncio.create_subprocess_exec(*ffmpeg_command)
|
16803
16837
|
await p.communicate()
|
@@ -0,0 +1,8 @@
|
|
1
|
+
yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
|
2
|
+
yeref/l_.py,sha256=Pc6C6WIIV1MZ_tv7wAkIUJttn0yUC-ewqjTdrX8VDeA,1117680
|
3
|
+
yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
|
4
|
+
yeref/yeref.py,sha256=FSN4kIb0Vxa7pKYyDbcAbh25iAGF041XYJyQBobVzJY,1028554
|
5
|
+
yeref-0.25.59.dist-info/METADATA,sha256=B8PvrpSm-XxaRqAd84Ko6H83NMzs5t9qwtqiGbD_EkA,119
|
6
|
+
yeref-0.25.59.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
+
yeref-0.25.59.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
|
8
|
+
yeref-0.25.59.dist-info/RECORD,,
|
yeref-0.25.57.dist-info/RECORD
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
yeref/__init__.py,sha256=Qpv3o6Xa78VdLcsSRmctGtpnYE9btpAkCekgGhgJyXM,49
|
2
|
-
yeref/l_.py,sha256=Pc6C6WIIV1MZ_tv7wAkIUJttn0yUC-ewqjTdrX8VDeA,1117680
|
3
|
-
yeref/tonweb.js,sha256=Jf6aFOQ1OIY4q7fINYz-m5LsI3seMus124M5SYYZmtE,443659
|
4
|
-
yeref/yeref.py,sha256=xjqLRZjUsMDjHIE7EOrevumE5T44qxvLdlOBu5cMTBc,1027136
|
5
|
-
yeref-0.25.57.dist-info/METADATA,sha256=OplN3DRS3YBV6wFB70YTvJ75mvhbafIH0Als-oE-PsU,119
|
6
|
-
yeref-0.25.57.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
7
|
-
yeref-0.25.57.dist-info/top_level.txt,sha256=yCQKchWHbfV-3OuQPYRdi2loypD-nmbDJbtt3OuKKkY,6
|
8
|
-
yeref-0.25.57.dist-info/RECORD,,
|
File without changes
|
File without changes
|