资源简介
结合网友的反馈,修改了头文件和库文件路径,解决了不能编译的问题
修改output-example,将H.264,AAC帧保存到mp4容器中
参考链接:
http://blog.csdn.net/ajaxhe/article/details/7603333

代码片段和文件信息
/*
* Libavformat API example: Output a media file in any supported
* libavformat format. The default codecs are used.
*
* Copyright (c) 2003 Fabrice Bellard
*
* 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.
*/
#include
#include
#include
#include
//#include
#include
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
extern “C“{
#include
#include
};
#undef exit
/* 5 seconds stream duration */
#define STREAM_DURATION 5.0
#define STREAM_frame_RATE 25 /* 25 images/s */
#define STREAM_NB_frameS ((int)(STREAM_DURATION * STREAM_frame_RATE))
#define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */
static int sws_flags = SWS_BICUBIC;
/**************************************************************/
/* audio output */
float t tincr tincr2;
int16_t *samples;
uint8_t *audio_outbuf;
int audio_outbuf_size;
int audio_input_frame_size;
/*
* add an audio output stream
*/
static AVStream *add_audio_stream(AVFormatContext *oc int codec_id)
{
AVCodecContext *c;
AVStream *st;
st = av_new_stream(oc 1);
if (!st) {
fprintf(stderr “Could not alloc stream\n“);
exit(1);
}
c = st->codec;
c->codec_id = (CodecID)codec_id;
c->codec_type = AVMEDIA_TYPE_AUDIO;
/* put sample parameters */
c->sample_fmt = AV_SAMPLE_FMT_S16;
c->sample_rate = 8000;
c->channels = 1;
c->bit_rate = 16000;
// some formats want stream headers to be separate
if(!strcmp(oc->oformat->name “mp4“) || !strcmp(oc->oformat->name “mov“) || !strcmp(oc->oformat->name “3gp“))
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
return st;
}
static void open_audio(AVFormatContext *oc AVStream *st)
{
AVCodecContext *c;
AVCodec *codec;
c = st->codec;
/* find the audio encoder */
codec = avcodec_fin
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 12463104 2011-06-24 02:20 output-example\Debug\avcodec-53.dll
文件 55296 2011-06-24 02:20 output-example\Debug\avdevice-53.dll
文件 798720 2011-06-24 02:20 output-example\Debug\avfilter-2.dll
文件 1296384 2011-06-24 02:20 output-example\Debug\avformat-53.dll
文件 133120 2011-06-24 02:20 output-example\Debug\avutil-51.dll
文件 664 2012-03-16 19:53 output-example\Debug\output-example.exp
文件 1868 2012-03-16 19:53 output-example\Debug\output-example.lib
文件 233984 2011-06-24 02:20 output-example\Debug\swscale-2.dll
文件 91 2012-03-11 10:32 output-example\include\inttypes.h
文件 139382 2011-06-24 02:20 output-example\include\libavcodec\avcodec.h
文件 2913 2011-06-24 02:20 output-example\include\libavcodec\avfft.h
文件 1802 2011-06-24 02:20 output-example\include\libavcodec\dxva2.h
文件 267 2011-06-24 02:20 output-example\include\libavcodec\opt.h
文件 3895 2011-06-24 02:20 output-example\include\libavcodec\vaapi.h
文件 2848 2011-06-24 02:20 output-example\include\libavcodec\vdpau.h
文件 2655 2011-06-24 02:20 output-example\include\libavcodec\version.h
文件 5796 2011-06-24 02:20 output-example\include\libavcodec\xvmc.h
文件 2056 2011-06-24 02:20 output-example\include\libavdevice\avdevice.h
文件 2364 2011-06-24 02:20 output-example\include\libavfilter\avcodec.h
文件 35514 2011-06-24 02:20 output-example\include\libavfilter\avfilter.h
文件 4748 2011-06-24 02:20 output-example\include\libavfilter\avfiltergraph.h
文件 1592 2011-06-24 02:20 output-example\include\libavfilter\vsink_buffer.h
文件 1600 2011-06-24 02:20 output-example\include\libavfilter\vsrc_buffer.h
文件 59748 2011-06-24 02:20 output-example\include\libavformat\avformat.h
文件 24719 2011-06-24 02:20 output-example\include\libavformat\avio.h
文件 2994 2011-06-24 02:20 output-example\include\libavformat\version.h
文件 1438 2011-06-24 02:20 output-example\include\libavutil\adler32.h
文件 1635 2011-06-24 02:20 output-example\include\libavutil\aes.h
文件 3079 2011-06-24 02:20 output-example\include\libavutil\attributes.h
文件 4256 2011-06-24 02:20 output-example\include\libavutil\audioconvert.h
............此处省略76个文件信息
- 上一篇:EDA课程设计大全,很多完整的课程设计
- 下一篇:黑客必备工具集合.zip
相关资源
- H.264编码器流程图
- MP4编解C源代码
- H.264视频编码基本知识
- 监控专用MP4文件播放器
- nginx-rtmp-win32-master.rar
- FFMEPG实现h264解码
- ffmpegh265rtmp.zip
- mp4转TS工具
- 格式工厂所缺失的mp4creator.exe
- 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视频
- ffmpeg-win64位库
- X264实时编码,FFmpeg实时解码
- FFmpeg API读取视音频文件信息的一个工
评论
共有 条评论