【问题标题】:ffmpeg live rtmp stream does not start to process for long timeffmpeg live rtmp流长时间没有开始处理
【发布时间】:2013-08-06 14:54:02
【问题描述】:

我在 h264 中有由 flash 播放器创建的 rtmp 流,但是当我使用 ffmpeg 将其转换为视频或缩略图时,它有时会在很长一段时间后工作,有时会不起作用,但如果我使用 Flash Media 实时编码器创建流相同的 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

当我停止流时,它会快速创建一个缩略图文件,因为正在运行的流是一个问题。

【问题讨论】:

标签: ffmpeg


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-16
    • 1970-01-01
    • 2012-01-06
    • 2019-03-20
    • 2018-07-16
    • 2013-03-21
    • 2021-01-24
    • 2015-01-31
    相关资源
    最近更新 更多