![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ffmpeg
很黑的黑
这个作者很懒,什么都没留下…
展开
-
ffmpeg4.2.2打开输入文件/网络流是怎么获取流信息的
文章没啥干货,就只是自己一个疑问的记录。在工作中解决一个bug,继而引发关于流信息是怎么获取的,是在avformat_open_input()函数中已经获取了?还是要去avformat_find_stream_info()函数中获取?先看nb_streams值是在哪变化的,看变量声明得知是avformat_new_stream()中修改的/** * Number of elements in AVFormatContext.streams. * * Set b原创 2022-02-11 10:34:37 · 1665 阅读 · 0 评论 -
ffmpeg4.2.2 读文件(官方demo:avio_reading.c)
ffmpeg4.2.2 doc/examples/avio_reading.c/* * Copyright (c) 2014 Stefano Sabatini * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in ..原创 2021-12-22 11:12:36 · 1021 阅读 · 0 评论 -
ffmpeg4.2.2 文件(ftp)查询/删除/移动操作(官方demo:avio_dir_cmd.c)
/* * Copyright (c) 2014 Lukasz Marek * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including w...原创 2021-12-21 14:05:08 · 1152 阅读 · 0 评论 -
ffmpeg4.2.2 封装(muxing)文件
#include<libavformat/avformat.h>int main(int argc,char* argv[]){ AVFormatContext *inFmtCtxVideo = NULL,*inFmtCtxAudio = NULL,*outFmtCtx = NULL; int ret = 0,i = 0,frameIndex = 0; int inputVideoIndex = -1,outputVideoIndex = -1; i...原创 2021-12-14 16:36:17 · 1670 阅读 · 0 评论 -
ffmpeg4.2.2 音频编码,pcm编码成AAC
新版的ffmpeg 编码AAC只支持的AV_SAMPLE_FMT_FLTP,老版本的是AV_SAMPLE_FMT_S16,如果输入的PCM数据是AV_SAMPLE_FMT_S16的,avcodec_encode_audio2会返回-22错误.#include <libavcodec/avcodec.h>#include <libavutil/samplefmt.h>#include <libavformat/avformat.h>#includ...原创 2021-12-08 09:53:50 · 1081 阅读 · 1 评论 -
ffmpeg4.2.2 yuv编码成h264(修改官方encode_video.c)
纯属学习记录,有问题请评论指点#include <libavcodec/avcodec.h>#include <libavformat/avformat.h>#include <libavutil/opt.h>static int ptsIndex = 0;void encode(AVFormatContext* outFormatCtx,AVFrame* frame,AVPacket* packet,AVCodecContext* codecCtx,F原创 2021-12-07 10:52:19 · 681 阅读 · 0 评论 -
ffmpeg4.2.2 解封装成H264和aac
写博客主要是个记录,下面的代码是有问题的,h264文件能正常播放,音频无法播放,而且是针对flv格式做的测试#include<libavformat/avformat.h>int adts_header(char * const p_adts_header, const int data_length, const int profile, const int samplerate, const int channel原创 2021-12-02 17:52:18 · 379 阅读 · 0 评论 -
ffmpeg4.2.2 实现封装格式文件(如flv)解码成yuv420p和pcm
解码成的yuv文件用ffply测试是可以播放的,但是pcm文件播放时全是杂音,不知道是哪一步错误了,但是看ffmpeg官方demo,找不出具体问题,知道的麻烦评论区留言指点下,谢谢!!#include <stdio.h>#include <stdlib.h>#include <string.h>#include <libavcodec/avcodec.h>#include <libavformat/avformat.h>#in原创 2021-12-02 15:06:38 · 654 阅读 · 0 评论 -
ffmpeg 4.2.2 实现mp4转avi(修改官方remuxing例子)
最近想把ffmpeg官方例子过一遍,达到初步了解ffmpeg的目的,本文只是给自己一个记录,也是在网上没有找到一样的文章,发出来供大家指点。直接使用官方demo,把mp4转换成avi格式会报下面的错误(avi转MP4,MP4转其他都没问题)下面的代码,可以实现其他格式转avi,但是还是存在问题,转换完后的视频再想转回去就会丢失视频画面,只有音频了,刚开始以为是要放到av_rescale_q_rnd函数前面,测试是一样的结果,报错如下图,输出的dts和duration变了(去掉两个宏定义,就没这.原创 2021-11-23 10:40:26 · 1256 阅读 · 0 评论