首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ffmpeg udp实时流发布到rtmp

ffmpeg udp实时流发布到rtmp
EN

Stack Overflow用户
提问于 2015-02-20 12:05:35
回答 1查看 9.8K关注 0票数 0

我需要做这个链: JVC to 650--UDP->localhost->ffmpeg(拷贝流)->nginx-rtmp。

在输入时,我有来自照相机的UDP流(udp://@:35501),我需要它发布到rtmp服务器(nginx和rtmp模块)。除了所有的工作-我可以在VLC上播放输入,我可以从FMLE流到nginx等等。除了,这是我第一次与ffmpeg,我不能让它工作。所以:

这是我最好的选择:

代码语言:javascript
复制
C:\ffmpeg\bin>ffmpeg -re -i udp://@:35501 -f flv "rtmp://192.168.1.17/live/live" -loglevel debug
ffmpeg version N-69972-g6c91afe Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-l
ibrtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --ena
ble-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 25.100 / 56. 25.100
  libavformat    56. 23.100 / 56. 23.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.100 /  5. 11.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Reading option '-i' ... matched as input file with argument 'udp://@:35501'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://192.168.1.17/live/live' ... matched as output file.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file udp://@:35501.
Applying option re (read input at native frame rate) with argument 1.
Successfully parsed a group of options.
Opening an input file: udp://@:35501.
[udp @ 0000000002c30760] end receive buffer size reported is 65536
[AVIOContext @ 0000000002c513c0] Statistics: 0 bytes read, 0 seeks
udp://@:35501: Immediate exit requested
Received signal 2: terminating.

C:\ffmpeg\bin>

ffmpeg配置有什么问题?

解决办法:

ffmpeg正在监听错误版本的UDP协议:

即使IPv6在网卡上也是禁用的,在系统内部,使用@允许ffmpeg侦听UDPv6。

通过使用127.0.0.1告诉ffmpeg使用干净的UDP。

谢谢,托马斯,让我有不同的想法!

EN

回答 1

Stack Overflow用户

发布于 2015-02-23 06:59:20

看来你的命令是对的,对我有用。关于这里的信息,是得到配置良好的udp连接的输出:

代码语言:javascript
复制
...
Opening an input file: udp://@:35501.
[udp @ 0x2058c80] end receive buffer size reported is 131072
[flv @ 0x20631a0] Format flv probed with size=2048 and score=100
[flv @ 0x20631a0] Before avformat_find_stream_info() pos: 13 bytes read:2099 seeks:0
[flv @ 0x20631a0] max_analyze_duration 5000000 reached at 5016000 microseconds
rfps: 29.916667 0.015099
rfps: 30.000000 0.000067
    Last message repeated 1 times
rfps: 60.000000 0.000267
    Last message repeated 1 times
rfps: 120.000000 0.001067
    Last message repeated 1 times
rfps: 240.000000 0.004267
rfps: 29.970030 0.002007
rfps: 59.940060 0.008027
[flv @ 0x20631a0] After avformat_find_stream_info() pos: 12110 bytes read:12110 seeks:0 frames:154
Input #0, flv, from 'udp://@:35501':
  Metadata:
    AspectRatioX    : 1
    AspectRatioY    : 1
    metadatacreator : GStreamer FLV muxer
    creationdate    : Mon Feb 23 6:51:54 2015
  Duration: N/A, start: 0.002000, bitrate: N/A
    Stream #0:0, 154, 1/1000: Video: h264 (High), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 1/60, 30.30 fps, 30 tbr, 1k tbn, 60 tbc
Successfully opened the file.
Parsing a group of options: output file rtmp://192.168.0.20/live/live.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://192.168.0.20/live/live.
...

这意味着您的传入流配置不好。您确定您的相机正在流到正确的协议(udp)、地址( ffmpeg主机的ip)和端口(35501)吗?也许如果你没有的话,我在这里找到了你相机的说明书:V2.pdf (LiveStreamingp.166)

我希望这会有帮助!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28628584

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档