分类:代码片段

27 篇文章

mysql 问题:2006, MySQL server has gone away ConnectionResetError 10054, 远程主机强迫关闭了一个现有的连接None10054None

参考文章:https://stackoverflow.com/questions/7942154/mysql-error-2006-mysql-server-has-gone-away cat /etc/my.cnf sudo vim /etc/my.cnf max_allowed_packet=5...

centos7 目录压缩

```压缩 tar -cvf log.tar ./* ``` ```下载 sz log.tar ```...

ChineseClip验证测试

~~~ import os.path import subprocess import numpy as np import torch import xlsxwriter from PIL import Image import cn_clip.clip as clip from cn_clip....

图片马赛克

...

python 生成随机颜色值

~~~ import random def random_color(): # 生成随机颜色值 r = lambda: random.randint(0, 255) color = f"#{r():02x}{r():02x}{r():02x}" print(color) return color ~...

Matplotlib中文显示问题

~~~ def show_chinese(): # 显示中文 plt.rcParams["font.sans-serif"] = ['SimHei', 'simsun', 'Songti SC', 'STFangsong'] plt.rcParams["axes.unicode_minus"] = ...

FFmpeg视频抽帧

~~~ cmd_frames = f"ffmpeg -i {video_path} -filter:v fps=1/{space} {output_img_path} -loglevel quiet" my_print(f"执行的ffmpeg命令:{cmd_frames}") ffmpeg_code...

ffmpeg视频去水印

~~~ x, y, w, h = watermark.split(",") # https://www.jianshu.com/p/dfcfd4432367 # x,y的起始值是从1开始,从0开始会报错 if int(x) == 0: x = 1 if int(y) == 0: y = 1 w, h...

ffmpeg设置字母字体和颜色

~~~ srt_path = srt_path.replace('\\', '\\\\').replace(':', '\:') # video+srt+硬字幕,默认字体和颜色 # cmd_mp4_srt = f"{FFMPEG_PATH} -i {third_video_path} -vf sub...

ffmpeg视频转为抖音形式

~~~ import subprocess def video_douyin(video_path): """ 生成抖音格式的视频 https://blog.csdn.net/weixin_28676289/article/details/112157079 htt...