关于运行ffserver有错误
From Ffmpeg工程组
错误如下:
checkout了一个ffmpeg的包 编译了,也安装上了。 按照doc中的说明执行 ffserver -f doc/ffserver.conf 的时候显示 [hui@dh trunk]$ ./ffserver -f doc/ffserver.conf Codecs do not match for stream 2 ffserver started. 这应该是有错误吧,后来看到有一个tests文件夹,cd,然后 [hui@dh trunk]$ ../ffserver -f test.conf ffserver started. 然后就没“not”之类的提示了,估计是可以了,这个doc/ffserver.conf也是有问题的/????????????????就发布 了????????????????
2.3 How do I make it work?First, build the kit. It *really* helps to have installed LAME first. Then when you run the ffserver ./configure, make sure that you have the --enable-mp3lame flag turned on. LAME is important as it allows for streaming audio to Windows Media Player. Don't ask why the other audio types do not work. As a simple test, just run the following two command lines (assuming that you have a V4L video capture card): ./ffserver -f doc/ffserver.conf &./ffmpeg http://localhost:8090/feed1.ffmAt this point you should be able to go to your Windows machine and fire up Windows Media Player (WMP). Go to Open URL and enter http://<linuxbox>:8090/test.asfYou should (after a short delay) see video and hear audio. WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to
尤其是上面的文档,执行完./ffserver -f doc/ffserver.conf &后先是刚才的那个错误提示,由于多次未成功现在很是恼火(偶得气量不大),有问 题????????不可能吧!!可是提示有错误呀???!!!不管它,继续执行 ./ffmpeg http://localhost:8090/feed1.ffm又有了新的提示: [hui@dh trunk]$ ./ffmpeg http://localhost:8090/feed1.ffm FFmpeg version SVN-r9022, Copyright (c) 2000-2007 Fabrice Bellard, et al. configuration: --prefix=../installdir libavutil version: 49.4.0 libavcodec version: 51.40.4 libavformat version: 51.12.1 built on May 14 2007 16:38:55, gcc: 3.2.2 20030222 (Red Hat Linux 3.2.2-5) Could not read stream parameters from 'http://localhost:8090/feed1.ffm'
相关讨论结果如下:
ffserver启动之后就会监听8090端口,这个端口号应该在conf文件中可配置。ffserver启动后会创建一临时文件feed1.ffm,文件大小大概是4096B,里面只 有头信息,是ffserver根据conf文件的配置生成的。 ffmpeg http://localhost:8090/feed1.ffm,它在做什么呢?大概是这样的,与ffserver建立http连接,然后从ffserver获取音频和视频的配置信息,然 后尝试用这些信息初始化设备和codec,所以看不到ffmpeg加一大堆参数启动。 ffmpeg启动工作后,会把编码后的数据通过udp发给ffserver,ffserver接收到数据后循环的写入feed1.ffm文件,应该是做缓冲。一边写,一边监听网络上的 动静。
ffmpeg 的main()入口是有参数的,就是argv数组地址和参数个数 而在ffserver中 有一个startchd()函数,其中有一个启动子进程的函数execvp(),正是通过这个函数,ffserver把ffserver.conf中的一些有关媒体的 配置信息通过argv数组传递给了ffmpeg,然后ffmpeg就进行数据采集或者格式转换的工作,转换之后的结果以feed1.ffm 文件存放在/tmp目录下,由 ffserver读取并监听网络,这就是ffserver多媒体服务器。
在解析参数的时候,调用opt_output_file,这里面要创建输出文件,对于filename为"http://localhost:8090/feed1.ffm"来说,调用url_fopen是建立 了和ffserver的连接。 再看视频输出的地方,do_video_out,需要把encodec后的数据写入文件(av_interleaved_write_frame),这个地方调用了s->oformat->write_packet (),对于s->filename为"http://localhost:8090/feed1.ffm"来说,这里就是利用先前的连接把数据传给ffserver,以feed1.ffm文件的格式。
有关该问题的讨论帖可参考ffmpeg工程组论坛中的相关讨论:
[运行ffserver有错误]
