最简单的基于 FFmpeg 的内存读写的例子:内存转码器

最简单的基于 FFmpeg 的内存读写的例子:内存转码器

  • 最简单的基于 FFmpeg 的内存读写的例子:内存转码器
    • 正文
    • 源程序
    • 结果
    • 工程文件下载
    • 参考链接

最简单的基于 FFmpeg 的内存读写的例子:内存转码器

参考雷霄骅博士的文章,链接:最简单的基于FFmpeg的内存读写的例子:内存播放器

正文

之前的所有有关 FFmpeg 的例子都是对文件进行操作的。实际上,并不是所有视频的编码,解码都是针对文件进行处理的。有的时候需要的解码的视频数据在一段内存中。例如,通过其他系统送来的视频数据。同样,有的时候编码后的视频数据也未必要保存成一个文件。例如,要求将编码后的视频数据送给其他的系统进行下一步的处理。以上两种情况就要求 FFmpeg 不仅仅是对文件进行“读,写”操作,而是要对内存进行“读,写”操作。因此打算记录的两个例子就是使用 FFmpeg 对内存进行读写的例子。

这篇文章记录一个基于 FFmpeg 的内存转码器。该转码器可以使用 FFmpeg 读取内存中的数据,转码为 H.264 之后再将数据输出到内存。

关于如何从内存中读取数据在这里不再详述,可以参考文章:《ffmpeg 从内存中读取数据(或将数据输出到内存)》。

FFmpeg 读写内存的关键点就两个:

第一,初始化自定义的 AVIOContext,指定自定义的回调函数。示例代码如下:

//AVIOContext中的缓存
unsigned char *aviobuffer=(unsigned char*)av_malloc(32768);
AVIOContext *avio=avio_alloc_context(aviobuffer, 32768,0,NULL,read_buffer,NULL,NULL);
pFormatCtx->pb=avio;
 
if(avformat_open_input(&pFormatCtx,NULL,NULL,NULL)!=0){
	printf("Couldn't open inputstream.(无法打开输入流)\n");
	return -1;
}

上述代码中,自定义了回调函数 read_buffer()。在使用 avformat_open_input() 打开媒体数据的时候,就可以不指定文件的 URL 了,即其第 2 个参数为 NULL(因为数据不是靠文件读取,而是由 read_buffer() 提供)。

第二,自己写回调函数。注意函数的参数和返回值(尤其是返回值)。示例代码如下:

//Callback
int read_buffer(void *opaque, uint8_t *buf, int buf_size){
	if(!feof(fp_open)){
		inttrue_size=fread(buf,1,buf_size,fp_open);
		return true_size;
	}else{
		return -1;
	}
}

当系统需要数据的时候,会自动调用该回调函数以获取数据。这个例子为了简单,直接使用 fread() 读取数据至内存。回调函数需要格外注意它的参数和返回值。

转码实际上就是解码和编码的结合。该方面的知识可以参考文章:

  1. 解码:100行代码实现最简单的基于FFMPEG+SDL的视频播放器(SDL1.x)
  2. 编码:最简单的基于FFMPEG的视频编码器(YUV编码为H.264)
  3. 转码: 最简单的基于FFMPEG的转码程序

程序的流程图如下图所示。从图中可以看出,首先分别初始化了输入和输出的 AVFormatContext。然后首先解码输入的 AVPacket,得到存储像素数据(YUV420P 格式)的 AVFrame,然后编码 AVFrame 为 H.264 的 AVPacket,最后将编码后的 AVPacket 输出。

在这里插入图片描述

源程序

/**
* 最简单的基于FFmpeg的内存读写例子(内存转码器)
* Simplest FFmpeg mem Transcoder
*
* 源程序:
* 雷霄骅,张晖
* leixiaohua1020@126.com
* 中国传媒大学/数字电视技术
* Communication University of China / Digital TV Technology
* http://blog.csdn.net/leixiaohua1020
*
* 修改:
* 刘文晨 Liu Wenchen
* 812288728@qq.com
* 电子科技大学/电子信息
* University of Electronic Science and Technology of China / Electronic and Information Science
* https://blog.csdn.net/ProgramNovice
*
* 本程序实现了任意格式视频数据(例如 MPEG2)转码为 H.264 码流数据。
* 本程序并不是对文件进行处理,而是对内存中的视频数据进行处理。
* 它从内存读取数据,并且将转码后的数据输出到内存中。
* 是最简单的使用 FFmpeg 读写内存的例子。
*
* This software convert video bitstream (Such as MPEG2) to H.264
* bitstream. It read video bitstream from memory (not from a file),
* convert it to H.264 bitstream, and finally output to another memory.
* It's the simplest example to use FFmpeg to read (or write) from
* memory.
*
*/

#include "stdafx.h"

#include <stdio.h>

#define __STDC_CONSTANT_MACROS

#ifdef _WIN32
// Windows
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavutil/avutil.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
};
#else
// Linux...
#ifdef __cplusplus
extern "C"
{
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libavutil/opt.h>
#include <libavutil/pixdesc.h>
#ifdef __cplusplus
};
#endif
#endif

FILE *fp_open;
FILE *fp_write;

// Read File
int read_buffer(void *opaque, uint8_t *buf, int buf_size)
{
	if (!feof(fp_open))
	{
		int true_size = fread(buf, 1, buf_size, fp_open);
		return true_size;
	}
	else
	{
		return -1;
	}
}

// Write File
int write_buffer(void *opaque, uint8_t *buf, int buf_size)
{
	if (!feof(fp_write))
	{
		int true_size = fwrite(buf, 1, buf_size, fp_write);
		return true_size;
	}
	else
	{
		return -1;
	}
}

int flush_encoder(AVFormatContext *fmt_ctx, unsigned int stream_index)
{
	int ret;
	int got_frame;
	AVPacket enc_pkt;

	if (!(fmt_ctx->streams[stream_index]->codec->codec->capabilities &
		CODEC_CAP_DELAY))
		return 0;
	while (1)
	{
		av_log(NULL, AV_LOG_INFO, "Flushing stream #%u encoder\n", stream_index);
		//ret = encode_write_frame(NULL, stream_index, &got_frame);
		enc_pkt.data = NULL;
		enc_pkt.size = 0;
		av_init_packet(&enc_pkt);
		ret = avcodec_encode_video2(fmt_ctx->streams[stream_index]->codec, &enc_pkt,
			NULL, &got_frame);
		av_frame_free(NULL);
		if (ret < 0)
			break;
		if (!got_frame)
		{
			ret = 0;
			break;
		}
		// prepare packet for muxing
		enc_pkt.stream_index = stream_index;
		enc_pkt.dts = av_rescale_q_rnd(enc_pkt.dts,
			fmt_ctx->streams[stream_index]->codec->time_base,
			fmt_ctx->streams[stream_index]->time_base,
			(AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
		enc_pkt.pts = av_rescale_q_rnd(enc_pkt.pts,
			fmt_ctx->streams[stream_index]->codec->time_base,
			fmt_ctx->streams[stream_index]->time_base,
			(AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
		enc_pkt.duration = av_rescale_q(enc_pkt.duration,
			fmt_ctx->streams[stream_index]->codec->time_base,
			fmt_ctx->streams[stream_index]->time_base);
		av_log(NULL, AV_LOG_DEBUG, "Muxing frame.\n");
		// mux encoded frame
		ret = av_write_frame(fmt_ctx, &enc_pkt);
		if (ret < 0)
			break;
	}
	return ret;
}


int main(int argc, char* argv[])
{
	int ret;
	AVFormatContext *ifmt_ctx = NULL;
	AVFormatContext *ofmt_ctx = NULL;
	AVPacket packet, enc_pkt;
	AVFrame *frame = NULL;
	enum AVMediaType type;
	unsigned int stream_index;
	unsigned int i = 0;
	int got_frame, enc_got_frame;

	AVStream *out_stream;
	AVStream *in_stream;
	AVCodecContext *dec_ctx, *enc_ctx;
	AVCodec *encoder;

	fp_open = fopen("cuc60anniversary_start.ts", "rb");	// 视频源文件 
	fp_write = fopen("cuc60anniversary_start.h264", "wb+"); // 输出文件

	av_register_all();
	ifmt_ctx = avformat_alloc_context();
	avformat_alloc_output_context2(&ofmt_ctx, NULL, "h264", NULL);

	unsigned char* inbuffer = NULL;
	unsigned char* outbuffer = NULL;
	inbuffer = (unsigned char*)av_malloc(32768);
	outbuffer = (unsigned char*)av_malloc(32768);
	AVIOContext *avio_in = NULL;
	AVIOContext *avio_out = NULL;
	// open input file
	avio_in = avio_alloc_context(inbuffer, 32768, 0, NULL, read_buffer, NULL, NULL);
	if (avio_in == NULL)
		goto end;

	ifmt_ctx->pb = avio_in;
	ifmt_ctx->flags = AVFMT_FLAG_CUSTOM_IO;
	if ((ret = avformat_open_input(&ifmt_ctx, "whatever", NULL, NULL)) < 0)
	{
		av_log(NULL, AV_LOG_ERROR, "Cannot open input file.\n");
		return ret;
	}
	if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) < 0)
	{
		av_log(NULL, AV_LOG_ERROR, "Cannot find stream information.\n");
		return ret;
	}
	for (i = 0; i < ifmt_ctx->nb_streams; i++)
	{
		AVStream *stream;
		AVCodecContext *codec_ctx;
		stream = ifmt_ctx->streams[i];
		codec_ctx = stream->codec;
		// Reencode video & audio and remux subtitles etc
		if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
		{
			// Open decoder
			ret = avcodec_open2(codec_ctx,
				avcodec_find_decoder(codec_ctx->codec_id), NULL);
			if (ret < 0)
			{
				av_log(NULL, AV_LOG_ERROR, "Failed to open decoder for stream #%u.\n", i);
				return ret;
			}
		}
	}

	// Print some input information
	//av_dump_format(ifmt_ctx, 0, "whatever", 0);

	// open output file
	avio_out = avio_alloc_context(outbuffer, 32768, 1, NULL, NULL, write_buffer, NULL);
	if (avio_out == NULL)
		goto end;
	//avio_out->write_packet=write_packet;
	ofmt_ctx->pb = avio_out;
	ofmt_ctx->flags = AVFMT_FLAG_CUSTOM_IO;
	for (i = 0; i < 1; i++)
	{
		out_stream = avformat_new_stream(ofmt_ctx, NULL);
		if (!out_stream)
		{
			av_log(NULL, AV_LOG_ERROR, "Failed allocating output stream.\n");
			return AVERROR_UNKNOWN;
		}
		in_stream = ifmt_ctx->streams[i];
		dec_ctx = in_stream->codec;
		enc_ctx = out_stream->codec;
		if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
		{
			encoder = avcodec_find_encoder(AV_CODEC_ID_H264);
			enc_ctx->height = dec_ctx->height;
			enc_ctx->width = dec_ctx->width;
			enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio;
			enc_ctx->pix_fmt = encoder->pix_fmts[0];
			enc_ctx->time_base = dec_ctx->time_base;
			//enc_ctx->time_base.num = 1;
			//enc_ctx->time_base.den = 25;
			// H.264的必备选项,没有就会错
			enc_ctx->me_range = 16;
			enc_ctx->max_qdiff = 4;
			enc_ctx->qmin = 10;
			enc_ctx->qmax = 51;
			enc_ctx->qcompress = 0.6;
			enc_ctx->refs = 3;
			enc_ctx->bit_rate = 500000;

			ret = avcodec_open2(enc_ctx, encoder, NULL);
			if (ret < 0)
			{
				av_log(NULL, AV_LOG_ERROR, "Cannot open video encoder for stream #%u.\n", i);
				return ret;
			}
		}
		else if (dec_ctx->codec_type == AVMEDIA_TYPE_UNKNOWN)
		{
			av_log(NULL, AV_LOG_FATAL, "Elementary stream #%d is of unknown type, cannot proceed.\n", i);
			return AVERROR_INVALIDDATA;
		}
		else
		{
			// if this stream must be remuxed
			ret = avcodec_copy_context(ofmt_ctx->streams[i]->codec,
				ifmt_ctx->streams[i]->codec);
			if (ret < 0)
			{
				av_log(NULL, AV_LOG_ERROR, "Copying stream context failed.\n");
				return ret;
			}
		}
		if (ofmt_ctx->oformat->flags & AVFMT_GLOBALHEADER)
			enc_ctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
	}

	// Print some output information
	//av_dump_format(ofmt_ctx, 0, "whatever", 1);

	// init muxer, write output file header
	ret = avformat_write_header(ofmt_ctx, NULL);
	if (ret < 0)
	{
		av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file.\n");
		return ret;
	}

	i = 0;
	// read all packets
	while (1)
	{
		i++;
		if ((ret = av_read_frame(ifmt_ctx, &packet)) < 0)
			break;
		stream_index = packet.stream_index;
		if (stream_index != 0)
			continue;
		type = ifmt_ctx->streams[packet.stream_index]->codec->codec_type;
		av_log(NULL, AV_LOG_DEBUG, "Demuxer gave frame of stream_index %u.\n",
			stream_index);

		av_log(NULL, AV_LOG_DEBUG, "Going to reencode the frame.\n");
		frame = av_frame_alloc();
		if (!frame)
		{
			ret = AVERROR(ENOMEM);
			break;
		}
		// 解压缩时间戳
		packet.dts = av_rescale_q_rnd(packet.dts,
			ifmt_ctx->streams[stream_index]->time_base,
			ifmt_ctx->streams[stream_index]->codec->time_base,
			(AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
		// 显示时间戳
		packet.pts = av_rescale_q_rnd(packet.pts,
			ifmt_ctx->streams[stream_index]->time_base,
			ifmt_ctx->streams[stream_index]->codec->time_base,
			(AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
		// 解码输入文件
		ret = avcodec_decode_video2(ifmt_ctx->streams[stream_index]->codec, frame,
			&got_frame, &packet);
		printf("Decode 1 Packet\tsize:%d\tpts:%lld.\n", packet.size, packet.pts);

		if (ret < 0)
		{
			av_frame_free(&frame);
			av_log(NULL, AV_LOG_ERROR, "Decoding failed.\n");
			break;
		}
		if (got_frame)
		{
			frame->pts = av_frame_get_best_effort_timestamp(frame);
			frame->pict_type = AV_PICTURE_TYPE_NONE;

			enc_pkt.data = NULL;
			enc_pkt.size = 0;
			av_init_packet(&enc_pkt);
			ret = avcodec_encode_video2(ofmt_ctx->streams[stream_index]->codec, &enc_pkt,
				frame, &enc_got_frame);

			printf("Encode 1 Packet\tsize:%d\tpts:%lld.\n", enc_pkt.size, enc_pkt.pts);

			av_frame_free(&frame);
			if (ret < 0)
				goto end;
			if (!enc_got_frame)
				continue;
			// prepare packet for muxing
			enc_pkt.stream_index = stream_index;
			enc_pkt.dts = av_rescale_q_rnd(enc_pkt.dts,
				ofmt_ctx->streams[stream_index]->codec->time_base,
				ofmt_ctx->streams[stream_index]->time_base,
				(AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
			enc_pkt.pts = av_rescale_q_rnd(enc_pkt.pts,
				ofmt_ctx->streams[stream_index]->codec->time_base,
				ofmt_ctx->streams[stream_index]->time_base,
				(AVRounding)(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));
			enc_pkt.duration = av_rescale_q(enc_pkt.duration,
				ofmt_ctx->streams[stream_index]->codec->time_base,
				ofmt_ctx->streams[stream_index]->time_base);
			av_log(NULL, AV_LOG_INFO, "Muxing frame %d.\n", i);
			// mux encoded frame
			av_write_frame(ofmt_ctx, &enc_pkt);
			if (ret < 0)
				goto end;
		}
		else
		{
			av_frame_free(&frame);
		}

		av_free_packet(&packet);
	}

	// flush encoders
	for (i = 0; i < 1; i++)
	{
		// flush encoder
		ret = flush_encoder(ofmt_ctx, i);
		if (ret < 0)
		{
			av_log(NULL, AV_LOG_ERROR, "Flushing encoder failed.\n");
			goto end;
		}
	}

	// Write file trailer
	av_write_trailer(ofmt_ctx);

end:
	// avio_in 释放之前需要先释放 avio_in->buffer, 否则会出现内存泄漏
	av_free(avio_in->buffer);
	av_freep(&avio_in);
	av_free(avio_out->buffer);
	av_freep(&avio_out);

	av_free(inbuffer);
	av_free(outbuffer);
	av_free_packet(&packet);
	av_frame_free(&frame);
	avformat_close_input(&ifmt_ctx);
	avformat_free_context(ofmt_ctx);

	//fcloseall();
	fclose(fp_open);
	fclose(fp_write);

	if (ret < 0)
		av_log(NULL, AV_LOG_ERROR, "Error occurred.\n");

	return (ret ? 1 : 0);
}

结果

一开始会报错:

在这里插入图片描述

属性页将 SDL 检查设置为否:

在这里插入图片描述

程序的运行结果如下:

在这里插入图片描述

输入文件:

在这里插入图片描述

输出文件:

在这里插入图片描述

工程文件下载

GitHub:UestcXiye / Simplest-FFmpeg-Memory-Transcoder

CSDN:Simplest FFmpeg Memory Transcoder.zip

参考链接

  1. ffmpeg 从内存中读取数据(或将数据输出到内存)
  2. 100行代码实现最简单的基于FFMPEG+SDL的视频播放器(SDL1.x)
  3. 最简单的基于FFMPEG的视频编码器(YUV编码为H.264)
  4. 最简单的基于FFMPEG的转码程序

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/444561.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

利用华为CodeArts持续交付项目演示流程

软件开发生产线&#xff08;CodeArts&#xff09;是面向开发者提供的一站式云端平台&#xff0c;即开即用&#xff0c;随时随地在云端交付软件全生命周期&#xff0c;覆盖需求下发、代码提交、代码检查、代码编译、验证、部署、发布&#xff0c;打通软件交付的完整路径&#xf…

C语言:通讯录(纯代码)

目录 背景&#xff1a;VS2019编译器 创建文件&#xff1a; contact.h代码&#xff1a; test.c代码&#xff1a; contact.c代码&#xff1a; 背景&#xff1a;VS2019编译器 创建文件&#xff1a; contact.h代码&#xff1a; #pragma once#include <string.h> #includ…

GTH手册学习注解

CPLL的动态配置 终于看到有这个复位功能了 QPLL SWITCHing需要复位 器件级RESET没发现有管脚引出来 两种复位方式&#xff0c;对应全复位和器件级复位 对应的复位功能管脚 改那个2分频的寄存器说明段&#xff0c;复位是自动发生的&#xff1f;说明可能起效了&#xff0c;但是分…

STM32---通用定时器(二)相关实验

写在前面&#xff1a;前面我们学习了基本定时器、通用定时器的相关理论部分&#xff0c;了解到通用定时器的结构框图&#xff0c;总共包含六大模块&#xff1a;时钟源、控制器、时基单元、输入捕获、公共部分以及输出捕获。对相关模块的使用也做详细的讲解。本节我们主要是对上…

【NR 定位】3GPP NR Positioning 5G定位标准解读(八)- OTDOA定位

前言 3GPP NR Positioning 5G定位标准&#xff1a;3GPP TS 38.305 V18 3GPP 标准网址&#xff1a;Directory Listing /ftp/ 【NR 定位】3GPP NR Positioning 5G定位标准解读&#xff08;一&#xff09;-CSDN博客 【NR 定位】3GPP NR Positioning 5G定位标准解读&#xff08;…

少儿编程 蓝桥杯青少组科技素养题 信息素养真题及解析第25套

少儿编程 科技素养 信息素养真题第25套 1、旅行结束之后&#xff0c;回到家的小蓝决定将照片备份在云端的网盘上。备份照片主要占用的是小蓝家的( )带宽 A、下行 B、上行 C、文件 D、数据 答案&#xff1a;B 考点分析&#xff1a;主要考查网络相关知识&#xff0c;要将照…

多种方法求解数组排序

&#x1d649;&#x1d65e;&#x1d658;&#x1d65a;!!&#x1f44f;&#x1f3fb;‧✧̣̥̇‧✦&#x1f44f;&#x1f3fb;‧✧̣̥̇‧✦ &#x1f44f;&#x1f3fb;‧✧̣̥̇:Solitary_walk ⸝⋆ ━━━┓ - 个性标签 - &#xff1a;来于“云”的“羽球人”。…

基于GAN对抗网进行图像修复

一、简介 使用PyTorch实现的生成对抗网络&#xff08;GAN&#xff09;模型&#xff0c;包括编码器&#xff08;Encoder&#xff09;、解码器&#xff08;Decoder&#xff09;、生成器&#xff08;ResnetGenerator&#xff09;和判别器&#xff08;Discriminator&#xff09;。…

CSS中有哪些方式可以隐藏页面元素(区别详解)

文章目录 一、前言二、实现方式display:nonevisibility:hiddenopacity:0设置height、width属性为0position:absoluteclip-path小结 三、区别参考文献 一、前言 在平常的样式排版中&#xff0c;我们经常遇到将某个模块隐藏的场景 通过css隐藏元素的方法有很多种&#xff0c;它…

HttpURLConnection详解及使用

HttpURLConnection 请求响应流程 设置连接参数的方法 setAllowUserInteractionsetDoInputsetDoOutputsetIfModifiedSincesetUseCachessetDefaultAllowUserInteractionsetDefaultUseCaches 发送URL请求 建立实际连接之后&#xff0c;就是发送请求&#xff0c;把请求参数传到…

探讨系统测试的最佳实践与思维模式!

这是测试活动过程详解系列的最后一篇文章。之前的想法&#xff0c;是对测试过程各重要环节进行拆解&#xff0c;然后介绍这个环节重点要做的事情&#xff0c;为什么要做这些事&#xff0c;以及注意事项。 前面几篇文章分别介绍了单元测试、集成测试、回归测试阶段要解决的问题…

初识C语言—初识C语言

前言 C语言全面了解&#xff0c;全貌认识 细致的学习&#xff0c;细枝末节 什么是C语言 维基百科 C 语言是一种通用的高级语言&#xff0c;最初是由丹尼斯里奇在贝尔实验室为开发 UNIX 操作系统而设计的。C 语言最开始是于 1972 年在 DEC PDP-11 计算机上被首次实现。 在 1978 …

【QT+QGIS跨平台编译】之七十六:【QGIS_Native+Qt跨平台编译】(一套代码、一套框架,跨平台编译)

文章目录 一、QGIS_Native介绍二、QGIS下载三、文件分析四、pro文件五、编译实践一、QGIS_Native介绍 QGIS_Native模块是QGIS软件的核心部分,提供了许多基本功能和核心组件,主要用于处理与底层操作系统的关系。 二、QGIS下载 QGIS网址: QGIS Source Download 三、文件分析…

苹果cms模板保护设置,防止被扒

苹果cms模板保护设置&#xff0c;防止被扒 如今互联网时代&#xff0c;网站模板前端被扒是常有的事&#xff0c;如何防止模板数据被扒&#xff1f; 保护设置方法&#xff1a; 登录宝塔 找到安装模板的网站 设置禁止访问文件 方法参考截图后缀填&#xff1a;php|html 目录填&a…

抽象的java发送邮箱2.0版本

优化了更多细节 SpringBoot3&#xff1a;前置框架 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jdbc</artifactId></dependency><dependency><groupId>org.springframewo…

Linux系统架构----nginx上构建虚拟主机

Linux系统架构----nginx上构建虚拟主机 一、构建虚拟主机概述 利用虚拟主机&#xff0c;不用为每个运行的网站提供一台单独的Nginx服务器或单独运行一组Nginx进程&#xff0c;虚拟主机提供了在同一台服务器、同一组Nginx进程上运行的多个网站的功能与Apache相同&#xff0c;N…

【OpenCV】如何在Linux操作系统下正确安装 OpenCV

前言 我是在虚拟机上跑的 Linux 5.8.0-44-generic。 配置如下&#xff1a; 目录 第一步&#xff1a;下载依赖文件 第二步&#xff1a;下载 opencv 和 opencv_contrib 源码 第三步&#xff1a;解压缩包 第四步&#xff1a;移动文件 第五步&#xff1a;生成 makefile 文件 …

深入理解 Webpack 热更新原理:提升开发效率的关键

&#x1f90d; 前端开发工程师、技术日更博主、已过CET6 &#x1f368; 阿珊和她的猫_CSDN博客专家、23年度博客之星前端领域TOP1 &#x1f560; 牛客高级专题作者、打造专栏《前端面试必备》 、《2024面试高频手撕题》 &#x1f35a; 蓝桥云课签约作者、上架课程《Vue.js 和 E…

攻击技术:命令和控制服务器(C2)是什么意思

在攻击者使用的众多策略中&#xff0c;最阴险的策略之一是命令和控制服务器&#xff08;C2&#xff09;。通过这篇文章&#xff0c;我们想准确地解释它是什么。 这些服务器充当计算机黑客行动的大脑&#xff0c;协调受感染设备的操作并允许攻击者随意操纵它们。 在网络安全领…

智慧公厕系统的组成部分有什么?

智慧公厕系统是现代城市管理中一项重要的创新&#xff0c;利用物联网、互联网、大数据、云计算、自动化控制等先进的技术手段&#xff0c;提供高效便捷的公厕服务。从信息系统的角度来看&#xff0c;智慧公厕系统主要由硬件、软件和网络组成&#xff0c;硬件、软件和网络三大部…
最新文章