资源简介
这是一个用Ffmpeg进行h265编解码的实例,集成了demux,解码,编码相关的代码。
代码片段和文件信息
/*
* Copyright (c) 2012 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 the Software without restriction including without limitation the rights
* to use copy modify merge publish distribute sublicense and/or sell
* copies of the Software and to permit persons to whom the Software is
* furnished to do so subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS“ WITHOUT WARRANTY OF ANY KIND EXPRESS OR
* IMPLIED INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM DAMAGES OR OTHER
* LIABILITY WHETHER IN AN ACTION OF CONTRACT TORT OR OTHERWISE ARISING FROM
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @file
* Demuxing and decoding example.
*
* Show how to use the libavformat and libavcodec API to demux and
* decode audio and video data.
* @example demuxing_decoding.c
*/
#include
#include
#include
#include
static AVFormatContext *fmt_ctx = NULL;
static AVCodecContext *dec_ctx = NULL;
static AVCodecContext *video_dec_ctx = NULL *audio_dec_ctx = NULL;
static AVCodecContext *video_enc_ctx = NULL;
static int width height;
static enum AVPixelFormat pix_fmt;
static AVStream *video_stream = NULL *audio_stream = NULL;
static const char *src_filename = NULL;
static const char *dst_filename = NULL;
static const char *video_dst_filename = NULL;
static const char *audio_dst_filename = NULL;
static const char *video_re_encoded_filename = NULL;
static FILE *video_dst_file = NULL;
static FILE *audio_dst_file = NULL;
static FILE *video_re_encode_file = NULL;
static uint8_t *video_dst_data[4] = {NULL};
static int video_dst_linesize[4];
static int video_dst_bufsize;
static int video_stream_idx = -1 audio_stream_idx = -1;
static AVframe *frame = NULL;
static AVPacket pkt;
static int video_frame_count = 0;
static int audio_frame_count = 0;
/* Enable or disable frame reference counting. You are not supposed to support
* both paths in your application but pick the one most appropriate to your
* needs. Look for the use of refcount in this example to see what are the
* differences of API usage between them. */
static int refcount = 0;
static void pgm_save(unsigned char *buf int wrap int xsize int ysize
char *filename)
{
return;
FILE *f;
int i;
f = fopen(filename“w“);
fprintf(f “P5\n%d %d\n%d\n“ xsize ysize 255);
for (i = 0; i < ysize; i++)
fwrite(buf + i * wrap 1 xsize f);
fclose(f);
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 23690 2019-02-28 13:39 ffmpeg_h265_demuxing_decoding_encoding.c
- 上一篇:最经典的51单片机经典流水灯汇编程序
- 下一篇:200plc温度控制系统程序
相关资源
- ffdoc FFMPEG的最完整教程FFMPEG的源码剖
- ffmpeg完美移植到arm
- RtspServerForHisiv500
- ffmpeg_for_unity
- H.264&H.265视频压缩编码参考码率表
- TCP接收264码流,使用ffmpeg解码
- FFMpeg_SDK_详细中文指南开发手册.pdf
- HEVC TS 封装文档
- inttypes.h
- gpac库把H265与AAC封装成MP4的接口新
- 从FFMPEG中剥离出来的组播接收和发送
-
ubuntu系统ffmpeg编译deckli
nk资源包 - linux下配置ffmpeg支持x264编码
- ffmpeg播放hls视频流程代码走读
- ffdoc FFMPEG的最完整教程
- 如何用FFmpeg编写一个简单播放器
- ffmpeg摄像头数据h264编码并封装avi
- windows下使用MinGW+msys编译ffmpeg.docx
- libffmpeg.so动态库
- rtp解包组包.zip
- 从网络抓包中提取RTP包,RTP解包为H
- ffmpeg最新版本编译的ffplay
- FFmpeg Tutorial.pdf(中文版)
- H265编码解码/推流
-
coreutil文件包括pr.exe和li
nk.exe - FFMpeg源码
- ffmpeg源码整体分析
- ffmpeg 绝对有用的音频和视频的截取与
- h264 h265 rtp打包
- ffmpeg 编译依赖头文件KHR、AMF、ffnvco
评论
共有 条评论