windows下 ffmpeg ffserver的搭建

u010512936 2013-04-30 08:19:14

Windows平台,
Cygwin下编译 ffmpeg,
具体编译流程描述如下:
(1)./configure --enable-memalign-hack --enable-ffserver --enable-network --enable-protocols --enable-muxers --enable-libmp3lame --enable-protocol=file --enable-protocol=pipe --enable-protocol=udp --enable-protocol=tcp --enable-protocol=http --disable-yasm
(2)make
(3)make install

ffmpeg ffserver实时播放mp3失败,播放本地mp3文件没问题。已经下载多个ffmpeg的源码(ffmpeg-0.11.3,ffmpeg-0.6,ffmpeg-0.8.5,ffmpeg-0.9.2,ffmpeg-1.0.6,ffmpeg-1.2,ffmpeg-20130418-git-ee94362)编译出来都播放不成功,不知是哪配置有问题还是怎么回事,还请高手帮忙分析分析指点指点,分享下使用ffmpeg使用心得和经验,不甚感激!
ffserver.conf的内容如下:
Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
#NoDaemon
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 1M
ACL allow 127.0.0.1
</Feed>

#本地mp3文件
<Stream test1.mp3>
File "c:\ffmpeg\test2.mp3"
Format mp3
#NoVideo
</Stream>

#本地mp3文件
<Stream 1.mp3>
File "c:\ffmpeg\1.mp3"
Format mp3
#NoVideo
</Stream>

#实时mp3
<Stream test.mp3>
Feed feed1.ffm
Format mp3
NoVideo
Preroll 3
</Stream>

1、实时播网口来的数据(本地端口6677,tcp协议,pcm数据):
命令:ffmpeg -f s16le -ac 1 -ar 224000 -acodec pcm_s16le -i tcp://127.0.0.1:6677?li
sten http://127.0.0.1:8090/feed1.ffm
现象:
ffmpeg version 1.0.6 Copyright (c) 2000-2013 the FFmpeg developers
built on Apr 30 2013 14:53:28 with gcc 3.4.4 (GCC) (cygming special, gdc 0.12,
using dmd 0.125)
configuration: --enable-memalign-hack --enable-ffserver --enable-network --ena
ble-protocols --enable-muxers --enable-libmp3lame --enable-protocol=file --enabl
e-protocol=pipe --enable-protocol=udp --enable-protocol=tcp --enable-protocol=ht
tp --disable-yasm
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
Tue Apr 30 15:00:26 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
[s16le @ 0x10028840] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, s16le, from 'tcp://127.0.0.1:6677?listen':
Duration: N/A, start: 0.000000, bitrate: 3584 kb/s
Stream #0:0: Audio: pcm_s16le, 224000 Hz, mono, s16, 3584 kb/s
Tue Apr 30 15:00:32 2013 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':
Metadata:
encoder : Lavf54.29.104
Stream #0:0: Audio: mp3, 22050 Hz, mono, s32, 128 kb/s
Stream #0:1: Audio: ac3, 22050 Hz, mono, flt, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le -> libmp3lame)
Stream #0:0 -> #0:1 (pcm_s16le -> ac3)
Press [q] to stop, [?] for help
Tue Apr 30 15:00:37 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:00:43 2013 [ffm @ 0x100588e0]invalid stream index 81
Tue Apr 30 15:00:50 2013 [ffm @ 0x1004be00]invalid stream index 81
Tue Apr 30 15:00:50 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:00:51 2013 [ffm @ 0x1004be00]invalid stream index 81
Tue Apr 30 15:00:51 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:00:52 2013 [ffm @ 0x1004be00]invalid stream index 81
Tue Apr 30 15:00:52 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:00:52 2013 [ffm @ 0x1004be00]invalid stream index 81
Tue Apr 30 15:00:52 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:00:53 2013 [ffm @ 0x1004be00]invalid stream index 81
Tue Apr 30 15:00:53 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:00:55 2013 [ffm @ 0x1004be00]invalid stream index 81
Tue Apr 30 15:01:00 2013 [ffm @ 0x1006a140]invalid stream index 81
size= 1144kB time=00:00:35.39 bitrate= 264.8kbits/s
ue Apr 30 15:01:04 2013 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 1171456
Tue Apr 30 15:01:04 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:01:04 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:01:04 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:01:04 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 580


2、实时播本地文件
命令: ffmpeg -i test.mp3 http://127.0.0.1:8090/feed1.ffm
现象1:
ffmpeg version 1.0.6 Copyright (c) 2000-2013 the FFmpeg developers
built on Apr 30 2013 14:53:28 with gcc 3.4.4 (GCC) (cygming special, gdc 0.12,
using dmd 0.125)
configuration: --enable-memalign-hack --enable-ffserver --enable-network --ena
ble-protocols --enable-muxers --enable-libmp3lame --enable-protocol=file --enabl
e-protocol=pipe --enable-protocol=udp --enable-protocol=tcp --enable-protocol=ht
tp --disable-yasm
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
[mp3 @ 0x100286c0] max_analyze_duration 5000000 reached at 5015510
Input #0, mp3, from 'test.mp3':
Metadata:
encoder : Lavf55.2.100
Duration: 00:05:54.97, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
Tue Apr 30 15:04:54 2013 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':
Metadata:
encoder : Lavf54.29.104
Stream #0:0: Audio: mp3, 22050 Hz, mono, s32, 128 kb/s
Stream #0:1: Audio: ac3, 22050 Hz, mono, flt, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 -> libmp3lame)
Stream #0:0 -> #0:1 (mp3 -> ac3)
Press [q] to stop, [?] for help
Tue Apr 30 15:04:56 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:04:59 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:05:00 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:05:02 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Tue Apr 30 15:05:03 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 163
Trying to remove 576 samples, but que empty63.7kbits/s
size= 11432kB time=00:05:55.00 bitrate= 263.8kbits/s
video:0kB audio:11094kB subtitle:0 global headers:0kB muxing overhead 3.046556%
Tue Apr 30 15:05:04 2013 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 11706368


现象2:
Tue Apr 30 15:33:45 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 161
ffmpeg version 0.9.2, Copyright (c) 2000-2012 the FFmpeg developers
built on Apr 30 2013 15:26:42 with gcc 3.4.4 (cygming special, gdc 0.12, using
dmd 0.125)
configuration: --enable-memalign-hack --enable-demuxers --enable-ffserver --en
able-network --enable-protocols --enable-muxers --enable-libmp3lame --enable-pro
tocol=file --enable-protocol=pipe --enable-protocol=udp --enable-protocol=tcp --
enable-protocol=http --disable-yasm
libavutil 51. 32. 0 / 51. 32. 0
libavcodec 53. 42. 4 / 53. 42. 4
libavformat 53. 24. 2 / 53. 24. 2
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 53. 0 / 2. 53. 0
libswscale 2. 1. 0 / 2. 1. 0
[mp3 @ 0x10024c40] max_analyze_duration 5000000 reached at 5015510
Input #0, mp3, from 'test.mp3':
Metadata:
encoder : Lavf55.2.100
Duration: 00:05:54.97, start: 0.000000, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
Tue Apr 30 15:33:46 2013 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4149
[ac3 @ 0x10029c20] channel_layout not specified
[ac3 @ 0x10029c20] No channel layout specified. The encoder will guess the layou
t, but it might be incorrect.
Output #0, ffm, to 'http://127.0.0.1:8090/feed1.ffm':
Metadata:
encoder : Lavf53.24.2
Stream #0:0: Audio: mp3, 22050 Hz, 1 channels, s16, 128 kb/s
Stream #0:1: Audio: ac3, 22050 Hz, mono, flt, 128 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 -> libmp3lame)
Stream #0:0 -> #0:1 (mp3 -> ac3)
Press [q] to stop, [?] for help
Tue Apr 30 15:33:47 2013 [ffm @ 0x1003dba0]resyncing/s
Tue Apr 30 15:33:47 2013 [ffm @ 0x1003dba0]cannot find FFM syncword
Tue Apr 30 15:33:47 2013 [ffm @ 0x1003dba0]invalid stream index 203
Tue Apr 30 15:33:47 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 161
Tue Apr 30 15:33:50 2013 [ffm @ 0x1003dba0]resyncing/s
Tue Apr 30 15:33:50 2013 [ffm @ 0x1003dba0]cannot find FFM syncword
Tue Apr 30 15:33:50 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 161
Tue Apr 30 15:33:52 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 161
Tue Apr 30 15:33:53 2013 127.0.0.1 - - [GET] "/test.mp3 HTTP/1.1" 200 161
Truncating packet of size 1024 to 544ate= 263.7kbits/s
Truncating packet of size 1024 to 1
size= 11432kB time=00:05:54.98 bitrate= 263.8kbits/s
video:0kB audio:11094kB global headers:0kB muxing overhead 3.046556%
Tue Apr 30 15:33:55 2013 127.0.0.1 - - [POST] "/feed1.ffm HTTP/1.1" 200 11706368


在线播放也未播出声音来:
截图:




另外:
编译好几个版本的时候也遇到同一个问题:
报ffmpeg\libavutil下的error.c文件中的语句出错
ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size));
参考编译通过的版本后将此语句改为
ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
编译通过。
...全文
1082 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

2,543

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧