编译Android版本的OpenSSL

将android-ndk-r20b和openssl-master解压在同一层目录,在此目录创建脚本bld.sh,内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
 
BASE_DIR=/home/sdb/android/ndk-r20b
 
export ANDROID_NDK_HOME=${BASE_DIR}/android-ndk-r20b
 
PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
 
cd openssl-master/
 
#./Configure --prefix=${BASE_DIR}/openssl-arm32 android-arm -D__ANDROID_API__=29
./Configure --prefix=${BASE_DIR}/openssl-arm32 android-arm -D__ANDROID_API__=16
#./Configure --prefix=${BASE_DIR}/openssl-x86 android-x86 -D__ANDROID_API__=16
 
make
make install

运行bld.sh脚本就会生成OpenSSL库文件。

How to build rtsp stream from a mp4 file to test EuhatRtsp

First, convert mp4 file to h264 file, save script below as convert.bat

1
2
3
ffmpeg.exe -i %1 -s 1920x1080 -b:v 1536K -an output.mp4
ffmpeg -i output.mp4 -codec copy -bsf: h264_mp4toannexb -f h264 output.264
#ffmpeg -i test.264 -vcodec copy -f mp4 test.mp4

drag a mp4 file over convert.bat, after a while, output.264 will be generated. download h264LiveMediaServer.zip, unzip as h264LiveMediaServer.exe, move it to the same directory with output.264, just double click and run h264LiveMediaServer.exe, it will notify you the rtsp url, then input the url in the url edit box on the EuhatRtsp Demo app ui, click begin button, wait several seconds, you will see the video rendering in EuhatRtsp.

Before running h264LiveMediaServer.exe, vc2019 x86 Redistributable must be installed.

Visit H264LiveMediaServer on Github to get the source code.

删除win10下的20G恢复分区

现在很多笔记本都内置了一块固态硬盘用于跑win10系统,用磁盘管理工具可以发现这块硬盘上有20G的恢复分区休眠着,本来固态硬盘的大小就捉襟见肘,而这20G能否删除呢?

如果win10用得得心应手,不担心以后会出现系统要恢复出厂设置的问题,并且在磁盘管理工具中看到的这二十多G分区在系统分区之后,则可以删除这20G分区,并合到系统分区中。我是指不重装系统或不用专业的磁盘分区移动软件的情况下。

由于是系统运行在系统分区中,只能用winpe装U盘引导机器去干这件事。

方法如下:

  1. 网上有各种各样的winpe iso可供下载,但考虑到安全性,还是到微软官网下载adk之类的包。
  2. 装完后,以管理员方式运行“部署和映像工具环境”。
  3. 运行命令

    1
    2
    
    copype amd64 d:\WinPE_amd64
    MakeWinPEMedia /UFD d:\WinPE_amd64 P:

    其中P:为插入的U盘盘符。

  4. 如果提示格式化错误,运行命令

    1
    
    MakeWinPEMedia /ISO d:\WinPE_amd64 d:\winpe.iso

    再参见在linux虚拟机中将ISO写入U盘

  5. 机器插入U盘后开机,比如DELL G7是开机时反复点击F12键,而不是一直按着F12不动,进入bios,设置成non-secure boot,再重启进入winpe环境。
  6. 进去后就一个dos窗口,运行diskpart,在此程序里多敲help看命令帮助,list是查看磁盘、分区等信息,select是进入磁盘,再进入分区,把系统分区后的分区都delete掉,再将系统分区extend到之后的所有空闲空间。注意这里操作一定要小心再小心,因为没有OS的保护,一不小心会把系统分区或引导分区删了,那就game over了,小心小心再小心!
  7. 完成扩容后,exit退出重启,再反复点击F12键进bios设成为secure boot,再重启进入win10,就可看到c:盘增加了十几G的空间了。

Failed to format -2147024809

直接用adk里的MakeWinPEMedia写winpe到U盘里报标题这个错误,所以我们换一种思路,用MakeWinPEMedia生成iso,再在linux环境将iso擦写到U盘里。

先以管理员方式运行“部署和映像工具环境”
输入

1
MakeWinPEMedia /ISO d:\euhat\WinPE_amd64 d:\winpe.iso

成功后,将winpe.iso拷贝到ubuntu linux虚拟机或实机里面。
我们现在以vmware的ubuntu虚拟机为例,为了使虚拟机正常识别U盘,需要做两件事

  1. 以管理员方式运行vmware player或workstation。
  2. ubuntu虚拟机设置里USB控制器兼容性中选择正确的版本,新买的机器一般选USB 3.0以上。这一步骤若选错,在vmware工具条上将U盘连接到虚拟机里时会提示“无法连接到理想的主机控制器。将尝试将该设备连接到可用的最佳主机控制器”不成功的错误,那时再重复此步骤选择其它USB控制器版本试试。

启动ubuntu虚拟机,打开终端以root身份运行

1
fdisk -l

通过看容量找到U盘的设备路径,如我这里是/dev/sdb,则再运行

1
2
dd if=/home/euhat/Desktop/winpe.iso of=/dev/sdb
sync

这样winpe就写入U盘了,正常从虚拟机、Windows卸载U盘后,再插到机器上用U盘引导试试!

Golang备忘录

1
go env -w GOPROXY=https://goproxy.cn

To debug in VSCode, write .vscode/launch.json

1
2
3
4
5
6
7
8
9
10
11
12
13
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "program": "${workspaceFolder}/main.go",
            "args": ["-h", "192.168.11.128", "-user", "test", "-pwd", "123123", "-p", "1-65535"]
       }
    ]
}

refer to: https://blog.csdn.net/qq_22211217/article/details/101854419