Rainbow

你好世界

今天又是被ffmpeg折腾得死去活来的一天,为了避免以后浪费时间,有必要记录一下。

硬件加速

-hwaccel <method> 可以用 -hwaccels 查看可用 method

-c:v <encoder> encoder 必须为硬件支持的编解码器:h264_qsv, hevc_qsv

质量控制

视频剪辑

-ss <hh:mm:ss> -to <hh:mm:ss> 两个开关控制起始时间和结束时间。

-f concat -i <concat_list_file> 拼接视频,concat_list_file 中需要预先定义好需要的视频文件,可以这样生成:

1
for f in *.mp4; do echo "file '$f'" >> mylist.txt; done

画面编辑

压制硬字幕(嵌入画面中)

-vf "subtitles=example_subtitle.vtt"

马赛克

1
ffmpeg -i input.mp4 -i mask.png -filter_complex "[0:v][1:v]alphamerge,avgblur=128[alf];[0:v][alf]overlay[v]" -map "[v]" -map 0:a -c:v h264_qsv -c:a copy -movflags +faststart output.mp4

avgblur=<number> 数字越大越模糊。

-i mask.png 使用 mask.png 作为遮罩,这张图片需要与视频画面大小一致,白色像素对应打码区域,黑色像素对应保持原样。 [1]


  1. https://superuser.com/a/901705 ↩︎

下载SDelete

接下来的命令默认你已经位于解压了 SDelete 的目录内,或者将其目录加入了环境变量,并且使用 cmd。
如果你使用 Powershell 或者其它终端,请自行加上绝对路径/相对路径。

在虚拟机内打开 cmd,执行命令:

1
sdelete -c -z C:

若你需要压缩其它盘符,更改 C: 即可。详细的操作说明请使用 sdelete -? 查看。

等待程序正常运行完成后,关闭虚拟机。

在宿主机上,使用 VBoxManage 工具[1],压缩已被全部设为0x00的空白空间:

1
VBoxManage modifymedium disk windows_11.vdi --compact

对于 Linux 用户,vboxmanageVBoxManage 是两个不同的命令,请注意大小写。
若要处理旧的兼容格式,请考虑 vboxmanage

阅读全文 »

发现问题

更新完VSCode,突然提示出错。询问请打开疑难解答指南以解决此问题,也可以使用不用 OS keyring 的较弱加密。

有关此提示的i18n信息
https://github.com/microsoft/vscode-loc/blob/616502b1f429c9ac0dc81004d8be2db96869f01e/i18n/vscode-language-pack-zh-hans/translations/main.i18n.json#L12221
1
2
3
4
5
6
7
8
"vs/workbench/services/secrets/electron-sandbox/secretStorageService": {
"encryptionNotAvailableJustTroubleshootingGuide": "无法识别用于在当前桌面环境中存储加密相关数据的 OS keyring。",
"isGnome": "你正在 GNOME 环境中运行,但 OS keyring 不可用用于加密。请确保已安装并运行 gnome-keyring 或其他 libsecret 兼容实现。",
"isKwallet": "你正在 KDE 环境中运行,但 OS keyring 不可用于加密。请确保 kwallet 正在运行。",
"troubleshootingButton": "打开疑难解答指南",
"usePlainText": "使用较弱的加密",
"usePlainTextExtraSentence": "请打开疑难解答指南以解决此问题,也可以使用不用 OS keyring 的较弱加密。"
},

解决问题

根据官方文档[1]的教程,试试看日志有什么报错:

1
code --verbose --vmodule="*/components/os_crypt/*=1" | less

第二行看到了问题所在:

1
[23476:0714/131505.501724:VERBOSE1:key_storage_util_linux.cc(54)] Password storage detected desktop environment: (unknown)

那问题很好解决了,直接照着官方文档改一下argv.json就行了。

~/.vscode/argv.json
1
2
3
{
"password-store": "gnome-libsecret",
}

更新(2024-02-07):对于我而言,此前设置 --password-store=gnome 是有效的,但是 VSCode 更新后,我修改了新设置 --password-store=gnome-libsecret 才修复重新出现的问题。

阅读全文 »

当通过ssh远程连接到服务器,或者在纯字符界面的tty上操作时,总之就是在无GUI情况下操作时。
使用gpg签名(或者通过git commit -S等调用gpg),会报错:

1
2
gpg: signing failed: Inappropriate ioctl for device
gpg: [stdin]: clear-sign failed: Inappropriate ioctl for device

原因是无法调用默认的/usr/bin/pinentry-gtk-2,如果你没安装GTK的话也会出现这个报错。

根据Arch Wiki介绍[1],修改.bashrc即可(zsh同理):

.bashrc
1
export GPG_TTY=$(tty)
阅读全文 »

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment