资源简介
详细信息请参考:
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个文件信息
相关资源
- 支持OpenCV3.2的opencv_ffmpeg.7z
-
Mpla
yer.exe 最新版 - 图像处理标准测试图lena+couple+BaboonR
- libjpeg-turbo-1.2.1.tar.gz
- ffmpeg 硬件加速
- FFmpeg解码MP4分别播放YUV视频和PCM音频
- 图标仓库三千多个经典图标
- zw_JPEG400.zip
- libmp3lame(3.100)_iOS静态库支持arm64v
- 触摸屏BMP图标大全
- JPEG 编解码的程序大全我搜集的所有程
- JPEG标准中文版
- ffmpeg(amr转换mp3).exe.zip
- STM32F407+OV7725+BMP+SD卡
- libjpeg-turbo.rar
- zw_csharp_ffmpeg_rtsp_demo.zip
- 比较新版本的ffmpeg.exe
- IBM-PC汇编语言程序设计沈美明第二版
- BMP格式的人脸图库
-
ijkpla
yer-anddroid编译好的so库 已经非 - ORL人脸库_92x112
- bmp图片转yuv420
- 遥感的K均值分类方法进行bmp图像的分
- bmp转gcode
- mjpeg_viewer_win软件
- 编译FFmpeg3.2.2生成的库文件及头文件
- STM32F103系列采用模拟IIC方式驱动了B
- Yale人脸识别图片库bmp
- decode_video.tar.gz
- mrf导航画面制作
评论
共有 条评论