如何从ffserver流音频

时间:2019-05-16 22:06:08

标签: ffmpeg streaming rtsp ffserver matroska

我尝试流式传输2个文件-1.mkv不带音频(可以流式传输),而2.mkv带有使用我无法流式传输的Vorbis编解码器编码的音频。对于编码,我使用了

ffmpeg -i 2.mp4 -strict -2 -c:a vorbis ex.mkv 

它可以和ffplay一起玩

服务器日志:

Fri May 17 00:49:08 2019 Opening feed file '1.mkv' for stream 'test1-rtsp'
Fri May 17 00:49:08 2019 [matroska,webm @ 0x200746c0]Unknown entry 0x55B0
Thu Dec 14 21:35:00 1950 [h264 @ 0x2007dcc0]gray chroma
Fri May 17 00:49:08 2019 [h264 @ 0x2007dcc0]error while decoding MB 18 1, bytestream 1989
Fri May 17 00:49:08 2019 [h264 @ 0x2007dcc0]concealing 432 DC, 432 AC, 432 MV errors in I frame
Fri May 17 00:49:08 2019 Opening feed file '2.mkv' for stream 'test2-rtsp'
Fri May 17 00:49:08 2019 [matroska,webm @ 0x200746c0]Unknown entry 0x55B0
Fri May 17 00:49:08 2019 FFserver started.
Fri May 17 00:49:25 2019 [matroska,webm @ 0x20080de0]Unknown entry 0x55B0
Fri May 17 00:49:25 2019 127.0.0.1:33582 - - "PLAY test2-rtsp/streamid=0 RTP/UDP"
Fri May 17 00:49:25 2019 127.0.0.1 - - [SETUP] "rtsp://127.0.0.1:7654/test2-rtsp/ RTSP/1.0" 200 2553

客户端日志:

Bad packed header lengths (30,0,1250,2673)
[udp @ 00000236f6318500] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 00000236f63185c0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 00000236f633dc40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 00000236f634df00] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[rtsp @ 00000236f63153c0] method SETUP failed: 503 Service Unavailable
rtsp://127.0.0.1:7654/test2-rtsp: Server returned 5XX Server Error reply

配置ffserver文件:

Port 8090
BindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 500000
CustomLog -
NoDaemon

RTSPPort 7654
RTSPBindAddress 0.0.0.0

<Stream test1-rtsp>
    Format rtp
    File "1.mkv"
</Stream>
<Stream test2-rtsp>
    Format rtp
    Strict -2
    AudioCodec vorbis
    File "2.mkv"
</Stream>

1 个答案:

答案 0 :(得分:0)

先转换

ffmpeg -i input.mkv -c:v libx264 -c:a libvo_aacenc -b:a 128k output.mp4

然后流

ffmpeg -i output.mp4 -vcodec libx264 -tune zerolatency -crf 18 http://localhost:1234/feed1.ffm

此外,您还可以通过指定输入编解码器和输出编解码器将它们两者合并为一个脚本。但是需要继续尝试