资源简介
这是一个用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温度控制系统程序
相关资源
- nginx-rtmp-win32-master.rar
- FFMEPG实现h264解码
- 解码hevc解析h265流
- ffmpegh265rtmp.zip
- RTMP_H265推流直播技术研讨
- ffserver(windows下编译32位)
- qt_ffmpeg_mp4_export_and_import.zip
- 最简单的基于FFmpeg的推流器 1.2
- 简单的ffmpeg推流demo
- FFmpeg和SDL,读内存中的视频流,进行
- ffmpeg之pcm转AAC
- ffmpeg-2.8.14.tar.gz
- 利用ffmpeg的filter混音
- vs2010 ffmpeg实时解码h264码流
- ffmpeg 音视频转码代码
- windows上自己编译的最新的ffmpeg库
- Qt基于FFmpeg播放本地 H.264H264文件
- 从ffmpeg中抽取的h264解码器,可用于
- ffplay源代码
- 最简单的基于FFmpeg的推流器以推送R
- DVD文件VOB的生成代码
- FFmpeg 采集摄像头输出rtmp直播流媒体,
- 基于ffmpeg将avi视频转换为mp4视频
- (补充)修改output-example,将H.264AAC帧
- ffmpeg-win64位库
- X264实时编码,FFmpeg实时解码
- FFmpeg API读取视音频文件信息的一个工
- 使用FFmpeg采集摄像头图像和麦克风音
- opencv_ffmpeg249.dll
- FFmpeg-3.1 windows vs2013编译动态库静态库
评论
共有 条评论