-
CentOS配置named作为DNS解析服务
```yuminstallbindbind-utilsfirewall-cmd--permanent--add-service=dnsfirewall-cmd--reloadvim/etc/named.conf---listen-onport53{any;};listen-on-v6port53{any;};allow-query{any;};---vim/etc/named.rfc1912.zones---zone"acgist.com"IN{typemaster;file"/etc/acgist.com.zone";};---vim/etc/acgist.com.zone---;@=本域$TTL1D@INSOA@acgist.com.(01H10M1D3H)INNS@;@INA127.0.0.1;wwwtestINA10.0.0.1;子域demoINA10.255.163.252;子域---chownnamed:named/etc/acgist.com.zonesystemctlrestartnamedsystemctlenablenamednslookupacgist.com127.0.0.1nsloo...
CentOS named DNS -
FFmpeg片段
##SDP输入```constAVInputFormat*iformat=av_find_input_format("sdp");AVDictionary*format_opts=NULL;av_dict_set(&format_opts,"sdp_flags","custom_io",0);avformat_open_input(&inputFormatCtxPtr,"video.sdp",iformat,&format_opts);```##RTP配置```AVDictionary*options=NULL;//av_dict_set(&options,"pkt_size","1400",0);//av_dict_set(&options,"buffer_size","102400",0);//av_dict_set(&options,"send_buffer_size","102400",0);av_opt_set_int(outputFormatCtxPtr->priv_data,"payload_type",96,0);avio_open2(&a...
FFmpeg -
技术路线
整理一下以后技术路线##操作系统LinuxDebianUbuntuWindows##业务后台DubboSpringBootSpringCloudSpringCloudAlibaba##音视频FFmpegOpenCVWebRTCMediasoup##网络编程TCP/IPTCP/UDP/RTP/HTTP...socket/asio/muduo/libcurl/libev/libuv/libevent##人工智能PyTorchlibtorchTensorRTOpenVINOONNXRuntime##硬件CPUGPUMEM##分析调试gdbperfgprofvalgrind>真别再去看什么嵌入式开发、驱动开发了🤡🤡🤡学不动了,现在需要的是深度了不是广度了。
技术路线 -
FFmpeg内存模式fmp4
```if(!this->start){//I帧AVDictionary*options=nullptr;//frag_keyframe+empty_moov//frag_keyframe+empty_moov+default_base_moof//frag_keyframe+delay_moov+default_base_moof+faststart//Winh264_mf可以使用delay_moov|empty_moov//Linuxlibx264只能使用delay_moov否则空头可能解析失败av_dict_set(&options,"movflags","frag_keyframe+delay_moov+default_base_moof+faststart",0);avformat_write_header(this->formatCtx,&options);av_dict_free(&options);this->start=true;}```网上很多都是`empty_moov`但是`Linux`使用`MediaSource`播放保存,改成`delay_m...
FFmpeg FMP4 -
C++一些错误
##死锁```terminatecalledafterthrowinganinstanceof'std::system_error'what():Resourcedeadlockavoided已中止(核心已转储)```这个问题在`Windows`上面是没问题的,但是`Linux`就是出现,最后发现原来是`std::async`执行需要释放完成才能结束线程。##CUDA```2024-12-2520:56:05.198288284[E:onnxruntime:face-feature,cuda_call.cc:123CudaCall]CUDAfailure700:anillegalmemoryaccesswasencountered;GPU=0;hostname=dmx-SYS-7048GR-TR;file=/onnxruntime_src/onnxruntime/core/providers/cuda/gpu_data_transfer.cc;line=63;expr=cudaMemcpyAsync(dst_data,src_data,bytes,cudaMemcpyHostToDevice,static_c...
C++ ONNX CUDA -
FFmpeg内存模式和文件模式
不用写出文件直接读取编码数据```aliang::media::VideoEncoderencoder(1080,1080);//文件模式//AVFormatContext*outputCtx=avformat_alloc_context();//avformat_alloc_output_context2(&outputCtx,NULL,NULL,"D:/tmp/aliang1.mp4");//AVStream*video_stream=avformat_new_stream(outputCtx,NULL);//avcodec_parameters_from_context(video_stream->codecpar,encoder.codecCtx);//avio_open(&outputCtx->pb,"D:/tmp/aliang1.mp4",AVIO_FLAG_WRITE);//AVDictionary*options=nullptr;////frag_keyframe+empty_moov////frag_keyframe+empty_moov+default_base...
FFmpeg -
debian多语言
```#修改sudoaptinstalllocalessudodpkg-reconfigurelocales#查看所有locale-a#查看当前locale```
debian -
AI技术选型
##编程语言`python`没办法必须了解,几乎所有训练框架都是`python`。```c++python```##训练框架```pytorchlibtorchtensorflowPaddlePaddlescikit-learn```##部署环境```ggmltensorrtopenvinoonnxruntime```##其他框架```dlibfaissollamaopencvffmpeg```
AI -
H2数据库修复
最近有些简单项目直接使用内嵌的`H2`数据库,但是单元测试跑着跑着文件损坏了,使用下面命令可以修复:```#原始JDBC链接:jdbc:h2:file:./hfx.db#导出SQL文件java-cp.\h2-2.2.224.jarorg.h2.tools.Recover-dbhfx.db#修改旧的文件名称hfx.db.mv.db->hfx.db.mv.db.backupjava-cp.\h2-2.2.224.jarorg.h2.tools.RunScript-urljdbc:h2:file:./hfx.db-script.\hfx.db.h2.sql```旧的文件建议保留,没有问题以后再删除。
H2 -
Java通过FFmpeg实现rtp多路推流
```packagecom.acgist.stream;importjava.io.File;importjava.io.IOException;importjava.io.InputStream;importjava.io.OutputStream;importjava.net.DatagramPacket;importjava.net.DatagramSocket;importjava.net.InetAddress;importjava.net.InetSocketAddress;importjava.nio.ByteBuffer;importjava.security.cert.X509Certificate;importjava.util.ArrayList;importjava.util.List;importjava.util.Map;importjava.util.Properties;importjava.util.Timer;importjava.util.TimerTask;importjava.util.concurrent.TimeUnit;importjavax.net.ssl.H...
Java FFmpeg RTP -
Debian解决vim乱码
```vim/etc/vim/vimrc---setfileencodings=utf-8,gbk,gb2312settermencoding=utf-8setencoding=prc---```
debian vim -
Linux配置24小时制
```vim/etc/locale.conf---LANG=zh_CN.utf8LANGUAGE=zh_CN.utf8---source/etc/locale.confvim/etc/default/locale---LANG=zh_CN.utf8LANGUAGE=zh_CN.utf8---source/etc/default/locale```
Linux -
C++ STL ranges
`C++20`在`STL`库里面提供`ranges`头文件,通过这个可以实现类似`Java`流一样的链式编程:```#include#include#includeintmain(){std::vectorv{1,2,3,4};autoc{v|std::ranges::views::filter([](constauto&i){returni%2==0;})|std::ranges::views::reverse|std::ranges::views::take(1)};for(constauto&x:v){std::cout<<x<<'\n';}std::cout<<"===="<<'\n';for(constauto&x:c){std::cout<<x<<'\n';}return0;}``````g++-std=c++20demo.cpp```
C++ STL rnages views -
Android使用termux模拟Linux环境
最近研究怎么在`Android`上面运行`SpringBoot`项目,发现使用`termux`可以模拟`Linux`环境。参考地址:```https://github.com/termux/termux-app/releaseshttps://mirrors.tuna.tsinghua.edu.cn/help/termux/```##安装`SSH````#查看IPifconfig#安装服务pkginstallopenssh#查看账号whoami#设置密码passwd#启动服务sshd#查看端口(需要root权限)netstat-alt```>默认`ssh`端口`8022`##JDK11下载默认`JDK`版本`17`,其他版本下载:```https://github.com/Hax4us/javahttps://github.com/hfib/openjdk11-termuxhttps://github.com/xiliuya/openjdk11-termuxhttps://github.com/SHivnaTH13/Termux-OpenJDKhttps://github.com/Lzhiyong/te...
termux Android -
Git重置提交记录
`Git`重置提交记录,删除旧的所有记录重新提交:```#创建空白分支gitcheckout--orphanresetgitadd.gitcommit-m"[+]init"#删除旧的分支gitbranch-Dmaster#修改新的分支gitbranch-mmaster#覆盖远程分支gitpush-foriginmaster```
GIT -
C++泛型
```/data/lifuren/core/src/source/config/Config.cpp:Inlambdafunction:/data/lifuren/core/src/source/config/Config.cpp:90:55:error:expectedprimary-expressionbefore‘>’token90|autox=client.as();|^/data/lifuren/core/src/source/config/Config.cpp:90:57:error:expectedprimary-expressionbefore‘)’token90|autox=client.as();|^/data/lifuren/core/src/source/config/Config.cpp:Inlambdafunction:/data/lifuren/core/src/source/config/Config.cpp:25:55:error:expectedprimary-expressionbefore‘>’token25|conststd::string&vk=...
C++ -
SpringAI Ollama
今天发现原来还有`SpringAI`这个东西,用来和`Ollama`对接非常方便。##ollama```mkdir-p/data/ollamacondacreate--nameollamapython=3.11condaactivateollamacurl-fsSLhttps://ollama.com/install.sh|shollamapullglm4ollamapullquentinz/bge-large-zh-v1.5condadeactivate```##添加依赖```io.springboot.aispring-ai-ollama-spring-boot-starter1.0.3```##测试代码```@TestpublicvoidtestApi(){finalOllamaApiapi=newOllamaApi("http://192.168.8.50:11434");finalOllamaChatClientclient=newOllamaChatClient(api,OllamaOptions.create().withModel("glm4"));finalScannerscanner=ne...
ollama SpringAI -
SpringBoot3.x学习
`SpringBoot3.x`支持了很多新的特性:`native`/`JDK17`/`WebClient`/`RestClient`/`HTTPInterface`等等。总结一些问题:####`RestClient`乱码```finalRestClientclient=RestClient.builder().baseUrl("https://www.acgist.com").messageConverters((list)->{list.forEach(v->{if(vinstanceofStringHttpMessageConverterx){x.setDefaultCharset(StandardCharsets.UTF_8);}});}).build();```###`WebClient`/`RestClient`/`RestTemplate````@Bean@ConditionalOnMissingBeanRestClient.BuilderrestClientBuilder(RestClientBuilderConfigurerrestClientBuilderConfigurer){...
SpringBoot -
RNNOISE模型训练
#RNNOISE模型训练##环境```sudoaptinstallvimparallelsudoaptinstallbuild-essentialsudoaptinstallpython3python3-pipsudoaptinstallffmpeglibtoolautoconfvim~/.pip/pip.conf---[global]index-url=https://pypi.tuna.tsinghua.edu.cn/simple---pip3installtqdmtorchnumpy```##数据```#提取ffmpeg.exe-i.\source.wav-ar48000-ac1-fs16le-c:apcm_s16lenoise.pcmffmpeg.exe-i.\source.ts-vn-ar48000-ac1-fs16le-c:apcm_s16lenoise.pcm#去掉超过0.4秒的静音ffmpeg-ar48000-ac1-fs16le-inoise.1.pcm-afsilenceremove=stop_periods=-1:stop_duration=0.4:stop_threshold=-60d...
rnnoise -
C++字面量前后缀
```#自动推导usingnamespacestd::string_literals;autoa="1234"s;#自动推导usingnamespacestd::string_view_literals;autoa="1234"sv;#多行文本R"(acgistacgist)"#u8、u、U、Lchar8_t、char16_t、char32_t、wchar_t```#LULLLULL
C++