一、编译针对iOS平台的ffmpeg库(kxmovie)
git clone git://github.com/kolyvan/kxmovie.git
cd kxmovie
git submodule update --init
rake
CoreAudio, AudioToolbox, Accelerate, QuartzCore, OpenGLES and libz.dylib,libiconv.dylib
libavcodec.a, libavformat.a, libavutil.a, libswscale.a, libswresample.a
ViewController *vc;
vc = [KxMovieViewController movieViewControllerWithContentPath:path parameters:nil];
[self presentViewController:vc animated:YES completion:nil];
[rtsp @ 0x906cc00]
UDP timeout, retrying with TCP
[rtsp
@ 0x906cc00] Nonmatching transport in server reply
[rtsp @ 0x906cc00]
Could not find codec parameters for stream 0 (Video: h264): unspecified size
Consider increasing
the value for the 'analyzeduration' and 'probesize' options
Couldn't find stream
information
跟踪代码,错误是在avformat_find_stream_info获取流信息失败的时候的时候触发。
if(avformat_find_stream_info(pFormatCtx,NULL)
< 0)
{
find stream information\n");
}
……
// Open video file
pFormatCtx = avformat_alloc_context();
//有三种传输方式:tcp
udp,强制采用tcp传输
AVDictionary*
options =
av_dict_set(&options, "rtsp_transport", "tcp", 0);
if(avformat_open_input(&pFormatCtx,
[moviePathcStringUsingEncoding:NSASCIIStringEncoding],
!= 0)
{
open file\n");
}
// Retrieve stream information
if(avformat_find_stream_info(pFormatCtx,NULL)
< 0)
{
find stream information\n");