资源简介
详细信息请参考:
http://blog.csdn.net/ajaxhe/article/details/7383800

代码片段和文件信息
// tutorial01.c
// Code based on a tutorial by Martin Bohme (boehme@inb.uni-luebeckREMOVETHIS.de)
// Tested on Gentoo CVS version 5/01/07 compiled with GCC 4.1.1
// A small sample program that shows how to use libavformat and libavcodec to
// read video from a file.
//
// Use
//
// gcc -o tutorial01 tutorial01.c -lavutil -lavformat -lavcodec -lz
//
// to build (assuming libavformat and libavcodec are correctly installed
// your system).
//
// Run using
//
// tutorial01 myvideofile.mpg
//
// to write the first five frames from “myvideofile.mpg“ to disk in PPM
// format.
//#include
#include
extern “C“{
#include
#include
#include
#include “jpeglib.h“ // for jpeglib
};
//实现视频帧的jpeg压缩
void saveAsJpeg(AVframe *pframeRGB int width int height int framenum)
{
char fname[128];
// AVPicture my_pic ;
struct jpeg_compress_struct cinfo;
struct jpeg_error_mgr jerr;
JSAMPROW row_pointer[1];
int row_stride;
uint8_t *buffer;
FILE *fp = NULL;
buffer = pframeRGB->data[0];
int size = sizeof(buffer);
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_compress(&cinfo);
//_snprintf(fname sizeof(fname) “frames%d.jpg“ framenum);
sprintf(fname “frames%d.jpg“ framenum);
fp = fopen(fname “wb“);
if (fp == NULL)
return;
jpeg_stdio_dest(&cinfo fp);
cinfo.image_width = width;
cinfo.image_height = height;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&cinfo);
jpeg_set_quality(&cinfo 80 true);
jpeg_start_compress(&cinfo TRUE);
row_stride = width * 3;
while (cinfo.next_scanline < height)
{
/* jpeg_write_scanlines expects an array of pointers to scanlines.
* Here the array is only one element long but you could pass
* more than one scanline at a time if that‘s more convenient.
*/
row_pointer[0] = &buffer[cinfo.next_scanline * row_stride];
jpeg_write_scanlines(&cinfo row_pointer 1);
}
jpeg_finish_compress(&cinfo);
fclose(fp);
jpeg_destroy_compress(&cinfo);
printf(“compress %d frame finished!\n“framenum) ;
return ;
}
bool saveAsBitmap(AVframe *pframeRGB int width int height int iframe)
{
FILE *pFile = NULL;
BITMAPFILEHEADER bmpheader;
BITMAPINFO bmpinfo;
uint8_t *buffer = pframeRGB->data[0]; // got the raw RGB24 data
char fileName[32];
int bpp = 24;
// open file
sprintf(fileName “frame%d.bmp“ iframe);
pFile = fopen(fileName “wb“);
if (!pFile)
return false;
bmpheader.bfType = (‘M‘ <<8)|‘B‘;
bmpheader.bfReserved1 = 0;
bmpheader.bfReserved2 = 0;
bmpheader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
bmpheader.bfSize = bmpheader.bfOffBits + width*height*bpp/8;
bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpinfo.bmiHeader.biWidth = width;
bmpinfo.bmiHeader.biHeight = -height; //reverse the image
bmpinfo.bmiHeader.biPlanes = 1;
bmpinfo.bmiHeader.b
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7770624 2012-03-08 10:55 tutorial01\Debug\avcodec-53.dll
文件 240640 2012-03-08 10:55 tutorial01\Debug\avfilter-2.dll
文件 1099264 2012-03-08 10:55 tutorial01\Debug\avformat-53.dll
文件 151040 2012-03-08 10:55 tutorial01\Debug\avutil-51.dll
文件 312320 2012-03-08 10:55 tutorial01\Debug\swscale-2.dll
文件 434056 2012-03-22 16:34 tutorial01\Debug\tutorial01.ilk
文件 56692 2012-03-08 10:55 tutorial01\ffmpeg0.10-for-win(bad)\bin\avcodec.lib
文件 2484 2012-03-08 10:55 tutorial01\ffmpeg0.10-for-win(bad)\bin\avdevice.lib
文件 35348 2012-03-08 10:55 tutorial01\ffmpeg0.10-for-win(bad)\bin\avfilter.lib
文件 46224 2012-03-08 10:55 tutorial01\ffmpeg0.10-for-win(bad)\bin\avformat.lib
文件 41838 2012-03-08 10:55 tutorial01\ffmpeg0.10-for-win(bad)\bin\avutil.lib
文件 580418 2012-03-22 15:44 tutorial01\ffmpeg0.10-for-win(bad)\bin\libjpeg.lib
文件 3804 2012-03-08 10:55 tutorial01\ffmpeg0.10-for-win(bad)\bin\swresample.lib
文件 44436 2012-03-08 10:55 tutorial01\ffmpeg0.10-for-win(bad)\bin\swscale.lib
文件 91 2012-03-08 11:33 tutorial01\ffmpeg0.10-for-win(bad)\include\inttypes.h
文件 1333 1997-10-19 03:41 tutorial01\ffmpeg0.10-for-win(bad)\include\jconfig.h
文件 13936 1997-10-19 02:59 tutorial01\ffmpeg0.10-for-win(bad)\include\jerror.h
文件 3250 1994-04-02 04:29 tutorial01\ffmpeg0.10-for-win(bad)\include\jinclude.h
文件 12553 2012-03-22 15:47 tutorial01\ffmpeg0.10-for-win(bad)\include\jmorecfg.h
文件 46205 1998-02-22 03:48 tutorial01\ffmpeg0.10-for-win(bad)\include\jpeglib.h
文件 163547 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\avcodec.h
文件 2913 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\avfft.h
文件 1931 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\dxva2.h
文件 1027 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\opt.h
文件 3895 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\vaapi.h
文件 4085 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\vda.h
文件 2848 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\vdpau.h
文件 4563 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\version.h
文件 5796 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavcodec\xvmc.h
文件 2786 2012-03-08 10:56 tutorial01\ffmpeg0.10-for-win(bad)\include\libavdevice\avdevice.h
............此处省略76个文件信息
相关资源
- QT,JPEG解码源代码(已完成)
- 将yuv各种格式的图片转换为jpg格式的
- 如何实现bmp位图透明贴图
- bmp文件读出为txt文件 txt文件写入为
- 2006年湖北工业大学409数据结构试题
- bmp2c
- BmpButton
- jpeg图像压缩实例代码
- nginx-rtmp-win32-master.rar
- 基于V4L2的视频采集,能够采集YUVJPE
- FFMEPG实现h264解码
- ffmpegh265rtmp.zip
- AlCl3抑制大鼠骨形成及BMP/Smad信号转导
- 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直播流媒体,
评论
共有 条评论