ffmpeg+D3D实现的MFC音视频播放器,支持录像、截图、音视频播放、码流信息显示等功能

一、简介

    本播放器是在vs2019 x86下开发,通过ffmpeg实现拉流解码功能,通过D3D实现视频的渲染功能。截图功能采用libjpeg实现,可以截取jpg图片,图片的默认保存路径是在C:\MYRecPath中。录像功能采用封装好的类Mp4Record实现,在Mp4Record类中主要还是采用ffmpeg的相关函数方法进行mp4视频的录制。音频的播放采用DirectSound实现,将ffmpeg解码后的音频数据存储到DirectSound的buffer中,再调用DirectSound的play实现对音频的播放功能。码流信息的显示,通过D3D的文本绘制实现。本播放器提供源码下载,直接下载请点击最后的下载链接。

二、界面展示

在这里插入图片描述

三、相关代码

开始播放

int CVideoPlayer::StartPlay(const char* sUrl)
{m_bStop = false;m_nVideoIndex = -1;m_nAudioIndex = -1;int i = 0, res = 0,  nValue = 0;char buf[64] = { 0 };m_bPlaying = false;AVStream* in_stream;_snprintf_s(m_sConnectUrl, sizeof(m_sConnectUrl), sizeof(m_sConnectUrl) - 1, "%s", sUrl);//av_register_all();avformat_network_init();AVDictionary* optionsDict = nullptr;av_dict_set(&optionsDict, "rtsp_transport", "tcp", 0);av_dict_set(&optionsDict, "stimeout", "5000000", 0);av_dict_set(&optionsDict, "buffer_size", "8192000", 0);av_dict_set(&optionsDict, "recv_buffer_size", "8192000", 0);m_lastReadPacktTime = av_gettime();m_pAVFmtCxt = avformat_alloc_context();m_pAVFmtCxt->interrupt_callback.opaque = this;m_pAVFmtCxt->interrupt_callback.callback = decodeInterruptCb;res = avformat_open_input(&m_pAVFmtCxt, m_sConnectUrl, NULL, &optionsDict);if (res < 0){myprint("avformat_open_input fail: %d", res);return -1;}if (!m_pAVFmtCxt){return -1;}m_pAVFmtCxt->probesize = 100 * 1024;    m_pAVFmtCxt->max_analyze_duration = 1 * AV_TIME_BASE; res = avformat_find_stream_info(m_pAVFmtCxt, NULL);if (res < 0){myprint("error %x in avformat_find_stream_info\n", res);return -1;}av_dump_format(m_pAVFmtCxt, 0, m_sConnectUrl, 0);for (i = 0; i < m_pAVFmtCxt->nb_streams; i++){if (m_pAVFmtCxt->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO){m_nVideoIndex = i;}else if (m_pAVFmtCxt->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {m_nAudioIndex = i;}myprint("m_pAVFmtCxt->streams[i]->codec->codec_type:%d", m_pAVFmtCxt->streams[i]->codecpar->codec_type);}//videoindex not findif (m_nVideoIndex == -1){myprint("can't find video stream.");return -1;}m_pCodec = avcodec_find_decoder(m_pAVFmtCxt->streams[m_nVideoIndex]->codecpar->codec_id);if (!m_pCodec){myprint("video decoder not found\n");return -1;}if (m_bSupportAudio && m_nAudioIndex != -1){myprint("start audio decoder \n");if (!m_pAudioCodecCxt)m_pAudioCodecCxt = avcodec_alloc_context3(NULL);auto pAudioCodecpar = m_pAVFmtCxt->streams[m_nAudioIndex]->codecpar;avcodec_parameters_to_context(m_pAudioCodecCxt, pAudioCodecpar);m_pAudioCodec = avcodec_find_decoder(pAudioCodecpar->codec_id);if (nullptr == m_pAudioCodec || nullptr == m_pAudioCodecCxt){myprint("audio decoder not found\n");return -1;}m_pSwrContext = swr_alloc_set_opts(0,                                 av_get_default_channel_layout(m_channels_play),AV_SAMPLE_FMT_S16,                         m_nSampleRate,                     av_get_default_channel_layout(m_pAudioCodecCxt->channels),m_pAudioCodecCxt->sample_fmt,       m_pAudioCodecCxt->sample_rate,      0,0);auto ret = swr_init(m_pSwrContext);if (ret < 0){myprint("Failed to swr_init(pSwrContext);");return -1;}if (InitDirectSound() == FALSE)m_bSupportAudio = false;}m_CodecId = m_pCodec->id;if(!m_pCodecCxt)m_pCodecCxt = avcodec_alloc_context3(NULL);avcodec_parameters_to_context(m_pCodecCxt, m_pAVFmtCxt->streams[m_nVideoIndex]->codecpar);if (m_pCodecCxt){if (m_pCodecCxt->width == 0 || m_pCodecCxt->height == 0){myprint("m_pCodecCxt->width:%d, m_pCodecCxt->height:%d", m_pCodecCxt->width, m_pCodecCxt->height);return -1;}}elsereturn -1;AVCodecContext* temp_codecctx = m_pCodecCxt;memcpy(temp_codecctx, m_pCodecCxt, sizeof(m_pCodecCxt));if (m_pCodecCxt->codec_type == AVMEDIA_TYPE_VIDEO){myprint("Soft Solution");avcodec_close(m_pCodecCxt);m_pCodecCxt = temp_codecctx;m_pCodecCxt->thread_count = 4;if (m_Dxva2D3DRender.InitD3DRender(m_showWnd, m_pCodecCxt->width, m_pCodecCxt->height) == false){myprint("InitD3DRender fail");}m_pOutBuffer = (uint8_t*)av_malloc(av_image_get_buffer_size(AV_PIX_FMT_YUV420P, m_pCodecCxt->width, m_pCodecCxt->height, 1));if (nullptr == m_pOutBuffer)return -1;av_image_fill_arrays(m_pFrameBGR->data, m_pFrameBGR->linesize, m_pOutBuffer, AV_PIX_FMT_YUV420P, m_pCodecCxt->width, m_pCodecCxt->height, 1); //填充AVFrame数据缓冲m_pImgConvertCtx = sws_getContext(m_pCodecCxt->width, m_pCodecCxt->height, m_pCodecCxt->pix_fmt, m_pCodecCxt->width, m_pCodecCxt->height, AV_PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL);if (nullptr == m_pImgConvertCtx)return -1;m_nActualWidth = m_pCodecCxt->width;m_nActualHeight = m_pCodecCxt->height;res = avcodec_open2(m_pCodecCxt, m_pCodec, NULL);if (res < 0){myprint("avcodec_open2 video fail  error:%x", res);return -1;}}if (m_bSupportAudio && m_pAudioCodecCxt){if (m_pAudioCodecCxt->codec_type == AVMEDIA_TYPE_AUDIO){res = avcodec_open2(m_pAudioCodecCxt, m_pAudioCodec, NULL);if (res < 0){myprint("avcodec_open2 audio fail  error:%x", res);avcodec_close(m_pAudioCodecCxt);return -1;}myprint("===Audio Message===");myprint(" bit_rate = %d ", m_pAudioCodecCxt->bit_rate);myprint(" sample_rate = %d ", m_pAudioCodecCxt->sample_rate);myprint(" channels = %d ", m_pAudioCodecCxt->channels);myprint(" code_name = %s ", m_pAudioCodecCxt->codec->name);myprint(" block_align = %d ", m_pAudioCodecCxt->block_align);}}m_pDecodeThread = (my_thread_t*)my_malloc(sizeof(my_thread_t));if (nullptr != m_pDecodeThread){m_bDecodeThreadRun = true;res = my_thread_create(m_pDecodeThread, ThreadDecode, this);if (res == -1){myprint("my_thread_create ThreadDecode failed  res:%x", res);return -1;}}return 0;
}

停止播放

void CVideoPlayer::StopPlay()
{m_bPlaying = false;m_CaptureAudio.SetGrabAudioFrames(FALSE, NULL);m_CaptureAudio.Close();m_bStopAudio = true;while (!m_AudioPlayQue.empty()){m_AudioPlayQue.pop();}while (!m_AudioTalkQue.empty()){EnterCriticalSection(&m_talklock);m_AudioTalkQue.pop();LeaveCriticalSection(&m_talklock);}m_bDecodeThreadRun = false;if (m_pDecodeThread){my_thread_join(m_pDecodeThread);my_free(m_pDecodeThread);m_pDecodeThread = nullptr;}if (m_pAudioPlayThread) {SetEvent(m_event);if (m_pAudioPlayThread->handle) {my_thread_join(m_pAudioPlayThread);m_pAudioPlayThread->handle = nullptr;}}if (m_pDSBuffer8){m_pDSBuffer8->Stop();m_pDSBuffer8->Restore();}m_Dxva2D3DRender.UnitD3DRender();if (m_pCodecCxt){avcodec_close(m_pCodecCxt);}if (m_pAudioCodecCxt){avcodec_close(m_pAudioCodecCxt);}if (m_pSwrContext){swr_free(&m_pSwrContext);m_pSwrContext = nullptr;}if (m_pAVFmtCxt) {avformat_close_input(&m_pAVFmtCxt);avformat_free_context(m_pAVFmtCxt);m_pAVFmtCxt = nullptr;}}

解码线程

void CVideoPlayer::DecodeAndShow()
{if (m_pAVFmtCxt == nullptr || m_pCodecCxt == nullptr)return;AVPacket pkt = { 0 };m_bPlaying = true;uint8_t* pBuffer;bool bEnoughSpace = true;int nTimeCnt = 0;int res = 0;struct SwsContext* img_convert_ctx = nullptr;int nRectDrawWait = 0;bool bRecordLastIFrame = false;int num_av_read_frame_err = 0;int num_stream_index_err = 0;uint8_t * outData[2] = {0};outData[0] = (uint8_t*)av_malloc(1152 * 8);outData[1] = (uint8_t*)av_malloc(1152 * 8);uint8_t* pktdata;int pktsize;int len = 0;bool bPushAudioToQueue = false;m_bStopAudio = false;CRect ShowRect;AVFrame* pAvFrame = av_frame_alloc();if (nullptr == pAvFrame)return;AVFrame* pFrameRGB = av_frame_alloc();if (nullptr == pFrameRGB)return;int numBytes = av_image_get_buffer_size(AV_PIX_FMT_RGB24, m_pCodecCxt->width, m_pCodecCxt->height, 1);pBuffer = (uint8_t*)av_malloc(numBytes);if (nullptr == pBuffer)return;av_image_fill_arrays(pFrameRGB->data,pFrameRGB->linesize, pBuffer, AV_PIX_FMT_RGB24, m_pCodecCxt->width, m_pCodecCxt->height, 1);img_convert_ctx = sws_getCachedContext(img_convert_ctx, m_pCodecCxt->width, m_pCodecCxt->height,m_pCodecCxt->pix_fmt, m_pCodecCxt->width, m_pCodecCxt->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR/*SWS_BICUBIC*/, NULL, NULL, NULL);//Audioif (m_bSupportAudio && m_pAudioPlayThread){res = my_thread_create(m_pAudioPlayThread, ThreadAudioPlay, this);if (res < 0)myprint("my_thread_create ThreadAudioPlay fail");}while (m_bDecodeThreadRun && !m_bQuit){if (m_bPause){Sleep(100);continue;}{if (m_bReconnect){myprint("bReConnect = true, break");break;}}m_lastReadPacktTime = av_gettime();if (av_read_frame(m_pAVFmtCxt, &pkt) >= 0){num_av_read_frame_err = 0;if (pkt.stream_index == m_nVideoIndex || pkt.stream_index == m_nAudioIndex){if (m_bRecord)//Record{if (nTimeCnt != 0 || (!bRecordLastIFrame && pkt.flags == AV_PKT_FLAG_KEY)) {if (m_sRecPath[0] != '\0' && nTimeCnt++ % 200 == 0){bEnoughSpace = CheckRemainSpace(m_sRecPath);if (bEnoughSpace == true){myprint("bEnoughSpace = true");}elsemyprint("bEnoughSpace = false");}m_nRecordCurrentTime = time(NULL);if ((m_nRecordCurrentTime - m_nRecordStartTime) >= (m_nRecordTime * 60)){myprint("Record Finsh!");stopRecord();}else if (bEnoughSpace == false){myprint("bEnoughSpace == false");stopRecord();}else{AVPacket* pPkt = av_packet_clone(&pkt);m_mp4Recorder.saveOneFrame(*pPkt, m_CodecId);av_packet_free(&pPkt);}}bRecordLastIFrame = pkt.flags == AV_PKT_FLAG_KEY;}elsenTimeCnt = 0;}if (pkt.stream_index == m_nVideoIndex){num_stream_index_err = 0;nTimeCnt = 0;if (pkt.flags == 1)bPushAudioToQueue = true;if (nullptr == m_pCodecCxt || nullptr == pAvFrame) {myprint("m_pCodecCxt == NULL || pAvFrame == NULL");break;}int gotvframe = 0;auto sd_ret = avcodec_send_packet(m_pCodecCxt, &pkt);if (sd_ret != 0 && sd_ret != AVERROR(EAGAIN)) {myprint("avcodec_send_packet err, rt=%d", sd_ret);enableReConnect();}else {while (gotvframe == 0 && !m_bQuit) {gotvframe = avcodec_receive_frame(m_pCodecCxt, pAvFrame);if (gotvframe == 0){try{GetShowRectSize(&ShowRect);}catch (const std::exception&){myprint("GetClientRect throw, error");break;}m_nCurPKSize = pkt.size;   SetStreamInfoToD3d();if (pAvFrame->width != m_nActualWidth || pAvFrame->height != m_nActualHeight){myprint("video size change reconnect...");enableReConnect();m_nActualWidth = pAvFrame->width;m_nActualHeight = pAvFrame->height;av_packet_unref(&pkt);continue;}if (m_pImgConvertCtx && m_pFrameBGR && m_pOutBuffer && pAvFrame){sws_scale(m_pImgConvertCtx, (const uint8_t* const*)pAvFrame->data, pAvFrame->linesize, 0,m_pCodecCxt->height, m_pFrameBGR->data, m_pFrameBGR->linesize);{                                    try{int re = 5;for (int i = 0; m_bPlaying && re == 5 && i < 10; ++i) {     // LockRect失败时重复尝试,最多10次re = m_Dxva2D3DRender.D3DSoftDisplayFrame(m_pOutBuffer, pAvFrame->width, pAvFrame->height, ShowRect);Sleep(1);}}catch (int re){myprint("m_Dxva2D3DRender.InitD3DRender again");if (m_Dxva2D3DRender.InitD3DRender(m_showWnd, m_pCodecCxt->width, m_pCodecCxt->height) == false){myprint("m_Dxva2D3DRender.InitD3DRender again fail");av_packet_unref(&pkt);continue;}}}                                }if (m_bCapture /*&& pkt.flags == 1*/ && img_convert_ctx){sws_scale(img_convert_ctx, (const uint8_t* const*)pAvFrame->data, pAvFrame->linesize, 0, m_pCodecCxt->height,pFrameRGB->data, pFrameRGB->linesize);SaveIFrameImage(pFrameRGB->data[0], m_pCodecCxt->width, m_pCodecCxt->height);m_bCapture = false;}}}}}else if (pkt.stream_index == m_nAudioIndex){num_stream_index_err = 0;if (m_bSupportAudio) {pktdata = pkt.data;pktsize = pkt.size;if (pktsize > 0){int gotframe = 0;if (nullptr == m_pAudioCodecCxt || nullptr == pAvFrame) {myprint("m_pAudioCodecCxt == NULL || pAvFrame == NULL");break;}len = avcodec_send_packet(m_pAudioCodecCxt, &pkt);if (len != 0 && len != AVERROR(EAGAIN)){pktsize = 0;myprint("avcodec_send_packet len < 0");break;}auto data_size = av_get_bytes_per_sample(m_pAudioCodecCxt->sample_fmt); if (data_size < 0) {myprint("Failed to calculate data size\n");break;}while (gotframe == 0 && !m_bQuit) {gotframe = avcodec_receive_frame(m_pAudioCodecCxt, pAvFrame);if (!gotframe){if (bPushAudioToQueue == true && m_bEnableAudio && !m_bStopAudio){audio_frame_t audioFrame;numBytes = av_get_bytes_per_sample(AV_SAMPLE_FMT_S16);auto dstNbSamples = av_rescale_rnd(pAvFrame->nb_samples,m_src_sample_rate,pAvFrame->sample_rate,AV_ROUND_ZERO);int data_size = 0;try{auto nb = swr_convert(m_pSwrContext,(uint8_t**)outData,dstNbSamples,(const uint8_t**)pAvFrame->data,pAvFrame->nb_samples);data_size = av_samples_get_buffer_size(nullptr, m_channels_play, nb, AV_SAMPLE_FMT_S16, 1);}catch (const std::exception&){m_bSupportAudio = false;myprint("swr_convert throw err, set m_bSupportAudio false");continue;}int copy_size = 0; int copy_ptr = 0;                              for (int isub = data_size; isub > 0; isub -= copy_size) {if (isub > m_audio_buffer_notify_size) {copy_size = m_audio_buffer_notify_size;copy_ptr = data_size - isub;}elsecopy_size = isub;audioFrame.data_size = copy_size;memcpy(audioFrame.data, outData[0] + copy_ptr, copy_size);EnterCriticalSection(&m_lock);m_AudioPlayQue.push(audioFrame);LeaveCriticalSection(&m_lock);}}}}}}}else if (++num_stream_index_err > 20) {myprint("pkt.stream_index unfind, %d",pkt.stream_index);enableReConnect();}av_packet_unref(&pkt);}else {if (++num_av_read_frame_err > 10) {myprint("num_av_read_frame_err is more than 10");enableReConnect();}}}if (m_bDecodeThreadRun) {myprint("m_bDecodeThreadRun is true");enableReConnect();}if (pAvFrame)av_free(pAvFrame);if (pFrameRGB)av_free(pFrameRGB);if (pBuffer)av_free(pBuffer);if (img_convert_ctx)sws_freeContext(img_convert_ctx);if (outData[0] && outData[1]){av_free(outData[0]);av_free(outData[1]);outData[0] = 0;outData[1] = 0;}
}

四、相关下载

链接: 可执行程序下载

链接: 源码下载

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

NodeJS 百度智能云文本转语音(实测)

现在文本转语音的技术已经非常完善了&#xff0c;尽管网络上有许多免费的工具&#xff0c;还是测试了专业的服务&#xff0c;选择了百度的TTS服务。 于是&#xff0c;在百度智能云注册和开通了文本转语音的服务&#xff0c;尝试使用NodeJS 实现文本转语音服务。但是百度的文档实…

信也科技和云杉网络的AI可观测性实践分享

1. 信也科技 2、云杉网络 2.1 中国移动

解析煤矿一张图

解析煤矿一张图 ​ 煤矿一张图是指通过数字化、智能化技术将煤矿的各项信息、数据和资源进行集中展示和管理&#xff0c;形成一个综合的可视化平台。这一平台将矿井的地理信息、设备状态、人员位置、安全生产、环境监测等信息整合成一个统一的“图形”&#xff0c;以便于管理者…

SpringBootTest常见错误解决

1.启动类所在包错误 问题 由于启动类所在包与需要自动注入的类的包不在一个包下&#xff1a; 启动类所在包&#xff1a; com.exmaple.test_02 但是对于需要注入的类却不在com.exmaple.test_02下或者其子包下&#xff0c;就会导致启动类无法扫描到该类&#xff0c;从而无法对…

Java 全栈知识体系

包含: Java 基础, Java 部分源码, JVM, Spring, Spring Boot, Spring Cloud, 数据库原理, MySQL, ElasticSearch, MongoDB, Docker, k8s, CI&CD, Linux, DevOps, 分布式, 中间件, 开发工具, Git, IDE, 源码阅读&#xff0c;读书笔记, 开源项目...

高效管理生产线:哪些项目管理工具最适合制造企业?

制造业的生产管理往往涉及复杂的流程和多部门协作&#xff0c;如何确保各环节顺利对接、信息准确传递&#xff0c;是每一家制造企业都在不断优化的问题。面对这些管理难题&#xff0c;越来越多的制造企业引入了项目管理软件&#xff0c;通过直观的任务分配、进度跟踪、数据反馈…

微信小程序 https://thirdwx.qlogo.cn 不在以下 downloadFile 合法域名列表中

授权登录后&#xff0c;拿到用户头像进行加载&#xff0c;但报错提示&#xff1a; https://thirdwx.qlogo.cn 不在以下 downloadFile 合法域名列表中 解决方法一&#xff08;未完全解决&#xff0c;临时处理&#xff09;&#xff1a;在微信开发者工具将不校验...勾上就可以访问…

Android - Pixel 6a 手机OS 由 Android 15 降级到 Android 14 操作记录

Pixel 6a 手机由 Android 14 升级到 Android 15了&#xff0c;但是由于一些原因又想降级回 Android 14&#xff0c; 能降吗&#xff1f;该怎么降级呢&#xff1f;本篇文章来记述实际操作过程&#xff0c;希望能给想做相同操作的人一些帮助。 答案当然是能降&#xff0c;而且我…

SOL链上Meme生态的崛起与未来#Dapp开发#链游#交易所#公链搭建

近年来&#xff0c;随着区块链技术的普及和NFT文化的流行&#xff0c;meme&#xff08;网络迷因&#xff09;逐渐成为区块链生态中的重要组成部分。meme不仅是一种互联网文化符号&#xff0c;更逐步渗透进了去中心化金融&#xff08;DeFi&#xff09;、NFT和元宇宙等多个领域&a…

C++模板特化实战:在使用开源库boost::geometry::index::rtree时,用特化来让其支持自己的数据类型

用自己定义的数据结构作为rtree的key。 // rTree的key struct OverlapKey {using BDPoint boost::geometry::model::point<double, 3, boost::geometry::cs::cartesian>; //双精度的点using MyRTree boost::geometry::index::rtree<OverlapKey, boost::geometry::in…

面试编程题目(一)细菌总数计算

题目如图&#xff1a; 第一题&#xff1a; import lombok.AllArgsConstructor; import lombok.Data;import java.util.Arrays; import java.util.Collections; import java.util.List;/*** description: 细菌实体类* author: zhangmy* Version: 1.0* create: 2021-03-30 11:2…

论文阅读《Neural Map Prior for Autonomous Driving》

目录 摘要1 介绍2 相关工作 摘要 高精&#xff08;HD&#xff09;语义地图对于在城市环境中行驶的自动驾驶汽车至关重要。传统的离线高精地图是通过劳动密集型的手动标注创建的&#xff0c;不仅成本高昂&#xff0c;而且无法及时更新。最近&#xff0c;研究人员提出根据在线传…

计算机网络 (5)数据通信的基础知识

前言 数据通信是一种以信息处理技术和计算机技术为基础的通信方式&#xff0c;它通过数据通信系统将数据以某种信号方式从一处传送到另一处&#xff0c;为计算机网络的应用和发展提供了技术支持和可靠的通信环境&#xff0c;是现代通信技术的关键部分。 一、数据通信的基本概念…

C++- 基于多设计模式下的同步异步日志系统

第一个项目:13万字,带源代码和详细步骤 目录 第一个项目:13万字,带源代码和详细步骤 1. 项目介绍 2. 核心技术 3. 日志系统介绍 3.1 为什么需要⽇志系统 3.2 ⽇志系统技术实现 3.2.1 同步写⽇志 3.2.2 异步写⽇志 4.知识点和单词补充 4.1单词补充 4.2知识点补充…

element plus的表格内容自动滚动

<el-table:data"tableData"ref"tableRef"borderstyle"width: 100%"height"150"><el-table-column prop"date" label"名称" width"250" /><el-table-column prop"name" label&…

丹摩征文活动 |【前端开发】HTML+CSS+JavaScript前端三剑客的基础知识体系了解

前言 &#x1f31f;&#x1f31f;本期讲解关于HTMLCSSJavaScript的基础知识&#xff0c;小编带领大家简单过一遍~~~ &#x1f308;感兴趣的小伙伴看一看小编主页&#xff1a;GGBondlctrl-CSDN博客 &#x1f525; 你的点赞就是小编不断更新的最大动力 …

ComfyUI-image2video模型部署教程

一、介绍 本项目基于ComfyUI进行部署&#xff0c;在上面可以简单实现图片到视频的效果。也就是可以通过给定一张图片&#xff0c;实现的功能是图片动起来。 二、部署 要求显存&#xff1a;VAE解码需要13G以上 1. 部署ComfyUI 本篇的模型部署是在ComfyUI的基础上进行&#x…

Ajax获取PHP端csv转的json数据并js前端排序与分页

<?php setlocale(LC_ALL, C); //window:删除行首双斜杠if($_GET["act"]"list"){ $csvFile book.csv; // 文件路径&#xff1a;制表符分隔文件 $data []; if (($handle fopen($csvFile, r)) ! false) {$header fgetcsv($handle,0,"\t"); …

基于树莓派的边缘端 AI 目标检测、目标跟踪、姿态估计 视频分析推理 加速方案:Hailo with ultralytics YOLOv8 YOLOv11

文件大纲 加速原理硬件安装软件安装基本设置系统升级docker 方案Demo 测试目标检测姿态估计视频分析参考文献前序树莓派文章hailo加速原理 Hailo 发布的 Raspberry Pi AI kit 加速原理,有几篇文章介绍的不错 https://ubuntu.com/blog/hackers-guide-to-the-raspberry-pi-ai-ki…

PETR/PETRv2/StreamPETR论文阅读

1. PETR PETR网络结构如下&#xff0c;主要包括image-backbone&#xff0c;3D Coordinates Generator&#xff0c;3D Position Encoder&#xff0c;transformer Decoder四个模块。 把N 个视角的图像输入到骨干网络中以提取 2D 多视图特征。在 3D 坐标生成器中&#xff0c;首先…