VS2008+ffmpeg SDK3.2调试tutorial01
按F5运行,打印输出aaaa,则没问题
第4步:
将解压出来的sdk下的include目录下的所有文件夹和文件拷到vc++工程目录下的test.cpp同一个目录。我的是(C:\Users\easou\Documents\Visual Studio 2008\Projects\testffmpeg\testffmpeg),此时,目录结构如下图
第5步:
将解压出来的lib文件夹拷贝至tes.cpp同一目录下。
然后在vs2008里,单击工程右键- 属性- 常规- 附加库目录 填入$(SolutionDir)\$(ProjectName)\lib
属性- 链接器- 附加依赖项 填入avcodec.lib avdevice.lib avfilter.lib avformat.lib avutil.lib swscale.lib 点击确定
第6步:
将tutorial01.c的内容复制到test.cpp中,并修改相关引用路径,按F7编译。F5运行
tes.cpp代码:
// Open video file if(av_open_input_file( pFormatCtx, filePath, NULL, 0, NULL)!=0) return -1; // Couldnt open file // Retrieve stream information if(av_find_stream_info(pFormatCtx) 0) return -1; // Couldnt find stream information // Dump information about file onto standard error dump_format(pFormatCtx, 0, filePath, 0); // Find the first video stream videoStream=-1; for(i=0; i pFormatCtx- nb_streams; i++) if(pFormatCtx- streams[i]- codec- codec_type==CODEC_TYPE_VIDEO) { videoStream=i; break; } if(videoStream==-1) return -1; // Didnt find a video stream // Get a pointer to the codec context for the video stream pCodecCtx=pFormatCtx- streams[videoStream]- codec; // Find the decoder for the video stream pCodec=avcodec_find_decoder(pCodecCtx- codec_id); if(pCodec==NULL) { fprintf(stderr, "Unsupported codec!\n"); return -1; // Codec not found } // Open codec if(avcodec_open(pCodecCtx, pCodec) 0) return -1; // Could not open codec // Allocate video frame pFrame=avcodec_alloc_frame(); // Allocate an AVFrame structure pFrameRGB=avcodec_alloc_frame(); if(pFrameRGB==NULL) return -1; // Determine required buffer size and allocate buffer numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx- width, pCodecCtx- height); buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); // Assign appropriate parts of buffer to image planes in pFrameRGB // Note that pFrameRGB is an AVFrame, but AVFrame is a superset // of AVPicture avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24, pCodecCtx- width, pCodecCtx- height); // Read frames and save first five frames to disk i=0; while(av_read_frame(pFormatCtx, packet) =0) { if(packet.stream_index==videoStream) { // Decode video frame avcodec_decode_video(pCodecCtx, pFrame, frameFinished,packet.data, packet.size); if(frameFinished) { // Convert the image from its native format to RGB img_convert_ctx = sws_getContext(pCodecCtx- width, pCodecCtx- height,pCodecCtx- pix_fmt, pCodecCtx- width, pCodecCtx- height,PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL); // Convert the image from its native format to RGB sws_scale(img_convert_ctx, pFrame- data, pFrame- linesize,0, pCodecCtx- height, pFrameRGB- data, pFrameRGB- linesize); if(++i =5) SaveFrame(pFrameRGB, pCodecCtx- width, pCodecCtx- height,i); } } // Free the packet that was allocated by av_read_frame av_free_packet( packet); } // Free the RGB image av_free(buffer); av_free(pFrameRGB); // Free the YUV frame av_free(pFrame); // Close the codec avcodec_close(pCodecCtx); // Close the video file av_close_input_file(pFormatCtx); printf("执行完毕\n"); system("pause"); return 0;
这里可能出现的问题比较多,主要有:
1、找不到stdint.h这个文件,将出现问题的头文件中的“include stdint.h ”改为“include "stdint.h"”即可
2、无法解析的外部符号 _img_convert,参考文章http://witmax.cn/ffmpeg-img-convert.html
3、运行时会出现找不到avformat.dll的对话框,将sdk下的bin文件下的dll文件都拷贝到工程目录下的debug文件夹解决。
4、信息窗出现 testffmpeg.exe: 本机”已退出,返回值为 -1字样。检查一下,是否没有将你的test.mp4拷到tes.cpp同一个目录下,mp4文件网上随便找一个就可以。提供我的视频一个http://115.com/file/e7f1ylpy
最后按F5出现命令窗口如下,调试通过
到test.cpp文件的目录下看一下,多出了5个ppm文件
可以用acd查看
x64dbg 插件开发SDK环境配置 x64dbg 是一款开源的应用层反汇编调试器,旨在对没有源代码的可执行文件进行恶意软件分析和逆向工程,同时 x64dbg 还允许用户开发插件来扩展功能,插件开发环境的配置非常简单,如下将简单介绍x64dbg是如何配置开发环境以及如何开发插件的。
美摄SDK的使用(一)—— 产品介绍美摄SDK的使用(二)—— 框架介绍美摄SDK的使用(三)—— 短视频的录制工具类的封装美摄SDK的使用(四)—— 短视频的编辑工具类的封装
其实做实物是因为好多人看了我的文章之后还是会遇到各种各样的问题,然后呢真是让亲们搞的自己好累.......所以就想着如果亲们用自己做的板子,出现什么问题能够快速的解决,,而且更能够帮助别人快速学会使用模块,,我的初衷是但凡能够帮助到的地方一定要做到尽善尽美,,可能像我这种搞技术总是想把自己做的事情做到完美而已.
autodesk fbx sdk sample里面的工程无法调试解决方法 1、项目属性- 常规中的目标文件名改为1 2、链接器- 调试中的生成程序数据库文件改成:$(OutDir)1.pdb 3、连接器- 常规中的输出文件改成:$(OutDir)1.exe PS:我预估不能调试的原因是是生成的pdb被覆盖了,不过不知道哪里设置,这个方法能解决问题先用了,哪位有...
相关文章
- 使用通用SOP8转接板调试半桥驱动芯片
- 调试机械臂一体化控制电路:STM32F103控制器初步调试
- Linux 内核测试和调试(5)
- android 通过WIFI调试和adb指令推送文件到安卓设备
- android js调试
- 《Effective Debugging:软件和系统调试的66个有效方法》——第19条:使调试任务自动化
- 使用Genymotion调试出现错误INSTALL_FAILED_CPU_ABI_INCOMPATIBLE解决办法
- Vue 之 Vue Cli Html 移动端调试调试工具简单使用说明(Eruda、vConsole)
- 移动应用调试之 Inspect
- 【BUG调试】——OSError: Caught OSError in DataLoader worker process 0