ffmpeg live rtmp stream没有开始处理很长时间

时间:2013-08-06 14:54:03

标签: ffmpeg

我有h264中由flash播放器创建的rtmp流,但是当我使用ffmpeg将其转换为视频或tumbnail时,它会在非常长的时间后工作,有些时候不起作用但是如果我使用Flash Media live encoder创建一个流相同的FMS服务器下面的命令工作正常。同时,如果我在播放器中尝试流,它运行良好。

我正在使用IP,因此我认为DNS解析问题是不可能的。

ffmpeg -i rtmp://xxx.xxx.xx.xx/live/bdeef2c065509361e78fa8cac90aac741cc5ee29 -r 1 -an -updatefirst 1 -y thumbnail.jpg

Following is when it worked aftre 15 - 20 minutes 

ffmpeg -i "rtmp://xxx.xxx.xx.xx/live/bdeef2c065509361e78fa8cac90aac741cc5ee29 live=1" -r 1 -an -updatefirst 1 -y thumb.jpg
[root@test ~]# ffmpeg -i rtmp://38.125.41.20/live/bdeef2c065509361e78fa8cac90aac741cc5ee29 -r 1 -an -updatefirst 1 -y thumbnail.jpg
ffmpeg version N-49953-g7d0e3b1-syslint Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 14 2013 15:29:40 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.103 / 54. 91.103
  libavformat    54. 63.100 / 54. 63.100
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 37.101 /  3. 37.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[flv @ 0x14c0100] Stream #1: not enough frames to estimate rate; consider increasing probesize
[flv @ 0x14c0100] Could not find codec parameters for stream 1 (Audio: none, 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv @ 0x14c0100] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://xxx.xxx.xx.xx/bdeef2c065509361e78fa8cac90aac741cc5ee29':
  Metadata:
    keyFrameInterval: 15
    quality         : 90
    level           : 3.1
    bandwith        : 0
    codec           : H264Avc
    fps             : 15
    profile         : baseline
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 15 tbr, 1k tbn, 30 tbc
    Stream #0:1: Audio: none, 0 channels
Output #0, image2, to 'thumbnail.jpg':
  Metadata:
    keyFrameInterval: 15
    quality         : 90
    level           : 3.1
    bandwith        : 0
    codec           : H264Avc
    fps             : 15
    profile         : baseline
    encoder         : Lavf54.63.100
    Stream #0:0: Video: mjpeg, yuvj420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 1 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
frame= 2723 fps=1.3 q=1.6 size=N/A time=00:45:23.00 bitrate=N/A dup=8 drop=12044

并通过关闭运行正在发布视频的Flash播放器的浏览器来停止流,我得到以下内容

[flv @ 0x23684e0] Could not find codec parameters for stream 1 (Audio: none, 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv @ 0x23684e0] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://xxx.xxx.xx.xx/live/bdeef2c065509361e78fa8cac90aac741cc5ee29':
  Metadata:
    keyFrameInterval: 15
    quality         : 90
    bandwith        : 0
    level           : 3.1
    codec           : H264Avc
    fps             : 15
    profile         : baseline
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 15 tbr, 1k tbn, 30 tbc
    Stream #0:1: Audio: none, 0 channels

如果我停止流,它会快速创建一个缩略图文件,其中正在运行的流是一个问题。

1 个答案:

答案 0 :(得分:0)

我找到了原因和原因,如果由flash创建的流没有选择麦克风,则音频通道在rtmp发布的流中为0,因此rtmp的音频编解码器部分进入某种循环而不返回并走得更远。我找到了原因。但寻找一种方法摆脱如果这个循环没有音频通道。可能可能需要修改rtmp的源代码并再次编译。