网站首页 > 技术教程 正文
一、Ffmpeg说明
- 协议层:该层处理流媒体协议的数据解析与封装,包括http,rtmp,rtsp,file等
- 容器层:该层处理多媒体容器的解析和封装,包括mp4,flv,mkv等
- 编解码层:该层负责音视频编解码,包括h264,h265,mp3,aac等
- 原始数据层:该层负责原始音视频数据的处理,如视频像素格式转换,缩放,裁剪,过滤,音频重采样,过滤等,处理对象是pcm,yuv,rgb等原始数据。
- 设备层:负责音视频播放及采集
ffmpeg 库说明
- livavformat 作用于协议层和容器层,依赖于libavcodec。
- libavcodec 作用于编解码层。
- ibswscale,libswresample,libavfilter作用于原始数据层。
- libavdevice 作用于设备层。
- livavutil 是基础公共模块,上面各个类库都会依赖于它。
二、打印一些配置值的代码实现
1. 新建QT控制台项目
设置 ffmpeg 库
QT += core
QT -= gui
TARGET = ffmpeg2
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH +="D:\\tools\\ffmpeg\\win32\\dev\\include"
LIBS += -LD:\tools\ffmpeg\win32\dev\lib -lavutil -lavformat -lavcodec -lavdevice -lavfilter -lpostproc -lswresample -lswscale
2. 修改main
#include <QCoreApplication>
#include <QDebug>
#define __STDC_CONSTANT_MACORS
#ifdef _WIN32
//windows
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libavfilter/avfilter.h"
}
#else
//linux
#ifdef __cplusplus
extern "C"
{
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfilter.h>
#ifdef __cplusplus
};
#endif
#endif
//FIX
struct URLProtocol;
/**
* @brief urlprotocolinfo protocol support information
* @return
*/
char * urlprotocolinfo(){
char *info=(char*)malloc(40000);
memset(info,0,40000);
av_register_all();
struct URLProtocol *pup = NULL;
// Input
struct URLProtocol **p_temp = &pup;
avio_enum_protocols((void **)p_temp,0);
while((*p_temp)!=NULL){
sprintf(info, "%s[In ][%10s]\n", info, avio_enum_protocols((void **)p_temp, 0));
}
pup = NULL;
// output
avio_enum_protocols((void**)p_temp,1);
while((*p_temp)!=NULL){
sprintf(info, "%s[Out][%10s]\n", info, avio_enum_protocols((void **)p_temp, 1));
}
return info;
}
char * avformatinfo(){
char * info=(char*)malloc(40000);
memset(info,0,40000);
av_register_all();
AVInputFormat *if_temp = av_iformat_next(NULL);
AVOutputFormat *of_temp = av_oformat_next(NULL);
// INPUT
while(if_temp!=NULL){
sprintf(info, "%s[In ] %10s \n",info,if_temp->name);
if_temp = if_temp->next;
}
while(of_temp!=NULL){
sprintf(info, "%s[Out ] %10s \n" , info,of_temp->name);
of_temp = of_temp->next;
}
return info;
}
/**
* @brief avcodecinfo AVCodec support information
* @return
*/
char * avcodecinfo(){
char *info=(char *)malloc(40000);
memset(info,0,40000);
av_register_all();
AVCodec *c_temp = av_codec_next(NULL);
while(c_temp!=NULL){
if (c_temp->decode!=NULL){
sprintf(info, "%s[Dec]", info);
}
else{
sprintf(info, "%s[Enc]", info);
}
switch (c_temp->type){
case AVMEDIA_TYPE_VIDEO:
sprintf(info, "%s[Video]", info);
break;
case AVMEDIA_TYPE_AUDIO:
sprintf(info, "%s[Audio]", info);
break;
default:
sprintf(info, "%s[Other]", info);
break;
}
sprintf(info, "%s %10s\n", info, c_temp->name);
c_temp=c_temp->next;
}
return info;
}
/**
* AVFilter Support Information
*/
char * avfilterinfo()
{
char *info=(char *)malloc(40000);
memset(info,0,40000);
avfilter_register_all();
AVFilter *f_temp = (AVFilter *)avfilter_next(NULL);
while (f_temp != NULL){
sprintf(info, "%s[%15s]\n", info, f_temp->name);
f_temp=f_temp->next;
}
return info;
}
/**
* Configuration Information
*/
char * configurationinfo()
{
char *info=(char *)malloc(40000);
memset(info,0,40000);
av_register_all();
sprintf(info, "%s\n", avcodec_configuration());
return info;
}
int main(int argc, char *argv[])
{
qDebug() << "Hello begining" <<endl;
QCoreApplication a(argc, argv);
char *infostr=NULL;
infostr = configurationinfo();
qDebug() << " <<Configuration>> " << infostr << endl;
free(infostr);
infostr = urlprotocolinfo();
qDebug() << " <<URLProtocol>> " << infostr << endl;
free(infostr);
infostr = avformatinfo();
qDebug() << " <<AVFormat>> " << infostr << endl;
free(infostr);
infostr = avcodecinfo();
qDebug() << " <<AVCodec>> " << infostr << endl;
free(infostr);
infostr=avfilterinfo();
qDebug() << " <<AVFilter>> " << infostr << endl;
free(infostr);
return a.exec();
}
运行效果:
猜你喜欢
- 2024-11-06 Qt音视频开发9-ffmpeg录像存储(nba比赛录像回放)
- 2024-11-06 音视频开源基础 - ffmpeg命令(ffmpeg音频处理)
- 2024-11-06 ffmpeg常用命令行集锦(ffmpeg 命令大全)
- 2024-11-06 音视频开发7. ffmpeg 几个重要结构体
- 2024-11-06 超详细的手把手下载安装FFmpeg整个过程,你学会了吗?
- 2024-11-06 FFmpeg硬解码(ffmpeg硬解码和直接使用cuda的区别)
- 2024-11-06 mPEG-Lys(MAL)-DBCO,甲氧基PEG赖氨酸马来酰亚胺二苯并环辛炔
- 2024-11-06 音视频流媒体高级开发(FFmpeg6.0/WebRTC/RTMP/RTSP/编码解码)
- 2024-11-06 FFmpeg在windows的安装、合并、切片、.m4s、.m3u8处理
- 2024-11-06 完美解决Linux环境编译ffmpeg库(linux编译环境配置)
你 发表评论:
欢迎- 最近发表
-
- Win11学院:如何在Windows 11上使用WSL安装Ubuntu
- linux移植(Linux移植freemodbus)
- 独家解读:Win10预览版9879为何无法识别硬盘
- 基于Linux系统的本地Yum源搭建与配置(ISO方式、RPM方式)
- Docker镜像瘦身(docker 减小镜像大小)
- 在linux上安装ollama(linux安装locale)
- 渗透测试系统Kali推出Docker镜像(kali linux渗透测试技术详解pdf)
- Linux环境中部署Harbor私有镜像仓库
- linux之间传文件命令之Rsync傻瓜式教程
- 解决ollama在linux中安装或升级时,通过国内镜像缩短安装时长
- 标签列表
-
- 下划线是什么 (87)
- 精美网站 (58)
- qq登录界面 (90)
- nginx 命令 (82)
- nginx .http (73)
- nginx lua (70)
- nginx 重定向 (68)
- Nginx超时 (65)
- nginx 监控 (57)
- odbc (59)
- rar密码破解工具 (62)
- annotation (71)
- 红黑树 (57)
- 智力题 (62)
- php空间申请 (61)
- 按键精灵 注册码 (69)
- 软件测试报告 (59)
- ntcreatefile (64)
- 闪动文字 (56)
- guid (66)
- abap (63)
- mpeg 2 (65)
- column (63)
- dreamweaver教程 (57)
- excel行列转换 (56)
本文暂时没有评论,来添加一个吧(●'◡'●)