继续上篇的进程,解决问题无果的情况下开始放弃这个尝试。
试着解决问题的过程中,发现我使用的tutorial版本很老,下载ffmpeg1.2.4,SDL1.2.15再次编译发现错误一大堆。
为了能使用库里面的源码,因此希望能将整个代码加入编译的空间。
找到了zita的博文,地址为:http://blog.youkuaiyun.com/ttxgz/article/details/7871743
在此表示对zita的深深感谢!
基本按图索骥的操作,但是在Segmentation fault出错上问题有了分歧。
只有反复调试了。
先加入打印信息
printf("avformat_open_input\n");
fflush(stdin)
printf("avformat_find_stream_info\n");
fflush(stdin)
发现第二个都不打印。只好另出方法。使用gdb断点调试
运行
#gdb ./tutorial01
#b 74
#run sunset.mp4
#step
#n
终于发现是因为AVFormatContext *pFormatCtx 的定义问题
改为 AVFormatContext *pFormatCtx =NULL;
问题解决!
看来版本之间差异太大,导致初学者头疼不已!
接着尝试tutorial02.c
编译成功。
运行./tutorial sunset.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sunset.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp42mp41
creation_time : 2011-08-24 22:13:08
Duration: 00:00:14.97, start: 0.000000, bitrate: 207 kb/s
Stream #0:0(und): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 206 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 23.98 tbc
Metadata:
creation_time : 2011-08-24 22:13:08
handler_name : Apple Video Media Handler
SDL: could not set video mode - exiting
SDL显示出错。
多次查找问题,未果!
解决问题待续。。。
本文记录了作者在尝试使用FFmpeg和SDL进行音视频处理时遇到的问题及解决过程,特别是解决了因版本差异导致的编译错误,并分享了调试技巧。

被折叠的 条评论
为什么被折叠?



