资源简介
结合网友的反馈,修改了头文件和库文件路径,解决了不能编译的问题
修改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
相关资源
- ffmpeg-win64位库
- X264实时编码,FFmpeg实时解码
- FFmpeg API读取视音频文件信息的一个工
- 使用FFmpeg采集摄像头图像和麦克风音
- opencv_ffmpeg249.dll
- FFmpeg-3.1 windows vs2013编译动态库静态库
- 基于FFmpeg4.0.2的AAC编码器
- FFmpeg获取网络摄像头数据解码
- Qt写的Windows下屏幕录制程序源码
- Windows下使用FFMPEG解码AAC文件并使用
- ffmpeg转换MP4为JPG帧图片
- ffmpeg解码sdl播放h264
- 最简单的利用ffmpeg获取视频的图片
- 最简单的基于FFmpeg的编码器 1.2
- vs2012调试ffmpeg.c
- 基于FFMPEG SDK流媒体开发1---解码媒体文
- ffmpeg 源码demo
- 最简单的基于FFMPEG的AVDevice的 1.2
- 最简单的基于FFMPEG的音频编码器 1.1
- 最简单的基于FFMPEG+SDL的视频播放器
- ffmpeg提取mp4关键帧保存为jpg.zip
- mp4_play.zip
- ffmpeg+qt的简单播放器
- 使用ffmpeg将多张图片生成H264裸流并获
- ffmpeg h264 转换jpg
- 利用FFmpeg将Jpeg图片转为任意视频容器
-
KindEditor与jwpla
yer集成,优化kindEdi - ffmpeg exeWINXP的最后一个可运行版本
- 最简单的基于FFMPEG的视频编码器修正
- mp4测试视频,可以用它测试处理MP4文
评论
共有 条评论