FFMPEG尝试接收rtp/udp流时卡住了

4

我正在尝试接收一个以h264编码的udp流。我使用的命令是:

ffmpeg -v 9 -loglevel 99 -re -i "udp://239.192.1.2:1234" outfile.h264

我收到的输出是:
ffmpeg version 3.2.2-1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 6.2.1 (Debian 6.2.1-5) 20161124


configuration: --prefix=/usr --extra-version=1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-libopencv --enable-frei0r --enable-libx264 --enable-chromaprint --enable-shared
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Reading option '-i' ... matched as input url with argument 'udp://@239.192.1.2:1234'.
Reading option 'outffff.h264' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url udp://@239.192.1.2:1234.
Applying option re (read input at native frame rate) with argument 1.
Successfully parsed a group of options.
Opening an input file: udp://@239.192.1.2:1234.
[udp @ 0x7f6638a36280] No default whitelist set
[udp @ 0x7f6638a36280] end receive buffer size reported is 131072
[AVIOContext @ 0x7f6638a56840] Statistics: 0 bytes read, 0 seeks

这个问题显然是因为ffmpeg进程没有检测到该地址上的任何传入数据包,导致进程挂起。但我可以使用vlc接收流,所以我知道数据包正在到达。这里是类似问题的链接:Here is a link to a similar problem
我认为,也许这是反向路径过滤的问题(如链接中所述),但rp_filter在/etc/sysctl.conf中未设置。我不太确定接下来该怎么做,非常感谢您的帮助。
编辑:我去掉了@符号,但这没有改变什么。
能工作的vlc命令是:
vlc --miface eth1 rtp://@239.192.1.2:1234
1个回答

4
我使用localaddr参数解决了问题。我没有意识到主机在eth1接口上发送,所以我必须指定要监听的接口。如果其他人有类似的问题,我会留下这个问题。
有效的命令: ffmpeg -i udp://IP:PORT?localaddr=IP2 outfile.h264

1
你应该配置多播路由以避免麻烦。 - aergistal
这对我们解决了一个奇怪的问题,该问题在更新Windows 10后有时会发生。更新后,NIC的顺序发生了变化,我们发出的ffprobe命令不再起作用。我们被迫回滚更新或重新安装操作系统。将近三年过去了,你真的帮了我们大忙!谢谢 =) - BlueStrat

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接