音视频
文章平均质量分 64
agentky
这个作者很懒,什么都没留下…
展开
-
基于ffmpeg和SDL的音视频播放器
基于ffmpeg和SDL的音视频播放器花了挺长时间给代码加了超级详细的注释实现的功能:音视频同步播放一.播放器的多线程模型本文从播放器的多线程的模型开始分析播放器的源码1.主线程我们的设计思路是主线程不添加过多的业务逻辑,专注于SDL事件的响应,提高用户的响应速度 首先要介绍一个超级重要的结构体VidoeState,这里面存放了视频文件的信息(上下文、解码器、各种参数等)和写代码过程中要使用的数据结构(队列、index、锁等),这个结构体要作为函数参数把各个线程串起来。主线程首先做了一些初原创 2021-05-30 22:10:48 · 354 阅读 · 0 评论 -
ffmpeg实现简单的音频编码
音频使用的不多,大致流程跟视频编码差不多#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include <libavcodec/avcodec.h>#include <libavutil/channel_layout.h>#include <libavutil/common.h>#include <libavutil/frame.h>#in原创 2021-01-07 15:49:10 · 187 阅读 · 0 评论 -
ffmpeg实现简单视频解码(将视频文件分解为单张RGB图片)
参考链接官网https://ffmpeg.org/doxygen/3.4/decode_video_8c-example.htmlhttps://blog.csdn.net/u014162133/article/details/81131339核心流程及API//处理输入/* register all formats and codecs */av_register_all();/* open input file, and allocate format context */avform原创 2021-01-06 21:37:49 · 1016 阅读 · 1 评论 -
ffmpeg 实现初步视频编码
参考资料编解码API详解(这个博主写的还挺多,有时间可以看看)https://www.cnblogs.com/leisure_chn/p/10584925.html官网demohttp://ffmpeg.org/doxygen/trunk/encode__video_8c_source.html直接上代码吧#include <stdio.h>#include <stdlib.h>#include <string.h>#include <libavc原创 2020-12-30 11:18:38 · 176 阅读 · 1 评论 -
ffmpeg实现两个文件的音频、视频流抽取与合成(小咖秀)
整体思路简要分析1.初始化准备工作分别打开文件 探测信息给AVstream等一些空白参数赋值avformat_open_inputavformat_find_stream_info创建输出上下文根据文件名分配合适的输出文件AVFormatContext 管理结构avformat_alloc_output_context2寻找第一个视频中最好的音频流和第二个文件中最好的视频流,并返回流的索引av_find_best_stream2.准备输出内容创建音频输出流(视频同理)avforma原创 2020-12-29 14:36:14 · 904 阅读 · 0 评论 -
ffmpeg知识整理
一:ffmpeg的模型1:转码模型转码基本流程:flv格式数据–>h264/aac数据–>yuv/pcm数据–>h264/aac数据–>mp4格式数据。a:我们把flv格式数据或者mp4格式数据这一层叫做mux/demux层或者复用层有些人习惯于叫做封装层,这里叫做mux/demux层下面同理。b:我们把h264/aac数据这一层叫做编解码层或者codec/decode,这里叫做codec/decode层下面同理。c:我们把yuv/pcm数据这一层叫做原始数据层或者Raw转载 2020-12-29 13:15:19 · 318 阅读 · 0 评论 -
ffmpeg 视频封装格式转换(ex:flv mp4 mkv mov互转)
这个代码是不改变音视频的编码格式的,只改变封装格式,源文件为MP4(h264+acc),那么理论上支持h264+acc的封装格式都可以互转#include <libavutil/timestamp.h>#include <libavformat/avformat.h>static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag){ AVRatio原创 2020-12-18 20:29:55 · 1537 阅读 · 1 评论 -
抽取一个多媒体文件中的视频流
核心流程:打开mp4文件并打开目标文件用于存储H264数据fopen(dst_fileName, “wb”);err_code = avformat_open_input(&fmt_ctx, src_fileName, NULL, NULL);初始化 AVPacketav_init_packet(&pkt);//找到最好的video流video_stream_index = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1,原创 2020-12-15 22:15:54 · 174 阅读 · 0 评论 -
两种方法实现抽取一个视频文件中音频流(基于ffmpeg)
使用到的ffmpeg APIav_log_set_level() 设置日志打印的标准, 高于这个标准的将不会打印av_log() 打印ffmpeg中的日志,当做printf用av_dump_format()av_register_all()avformat_open_input()avformat_close_input()av_find_best_stream()av_init_packet()av_packet_unref()av原创 2020-12-07 22:02:31 · 771 阅读 · 0 评论 -
FFmpeg 中比较重要的函数以及数据结构
FFmpeg 中比较重要的函数以及数据结构如下:数据结构:(1) AVFormatContext(2) AVOutputFormat(3) AVInputFormat(4) AVCodecContext(5) AVCodec(6) AVFrame(7) AVPacket(8) AVPicture(9) AVStream初始化函数:(1) av_register_all()(2) avcodec_open()(3) avcodec_close()(4) av_open_i转载 2020-12-07 10:00:27 · 504 阅读 · 0 评论 -
ffmpeg基本目录、文件、日志操作
main.c#include <stdio.h>#define __STDC_CONSTANT_MACROS#ifdef __cplusplusextern "C" {#endif#include <libavcodec/avcodec.h>#include <libavformat/avformat.h>#include <libavfilter/avfilter.h>#include <libavutil/log.h>#i原创 2020-12-05 21:41:09 · 1170 阅读 · 0 评论 -
ffmpeg命令
原创 2020-11-27 19:37:28 · 71 阅读 · 0 评论