我正在尝试接收编码为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。
我想,也许这是反向路径过滤的问题(如链接中所述),但是/etc/sysctl.conf中没有设置rp_filter。我不太清楚从这里做什么,感谢任何帮助。
编辑:我删除了@,但这没有任何改变。
有效的vlc命令是:
vlc --miface eth1 rtp://@239.192.1.2:1234
答案 0 :(得分:1)
我能够通过使用localaddr参数来解决问题。我没有意识到主机正在发送eth1接口,我必须指定要监听的接口。我会留下问题以防其他人遇到类似的问题。
有效的命令:ffmpeg -i udp://IP:PORT?localaddr=IP2 outfile.h264