请参阅编辑2。问题已更新。
错误 1: 将加密数据写入套接字失败 av_interleaved_write_frame():I/O 错误
错误 2: (libx264)转换失败!
我正在尝试使用网络摄像头作为 FFmpeg 的数据输入进行流式传输,但除了流式传输之外,我还需要流式传输视频。只需几分钟即可使用相同的命令实现这两个功能。
(如果单独放置,录音代码可以完美运行,因为流式传输代码不起作用并且会出现相同的错误。)
还需要说明的是,服务器一切正常。
FFmpeg代码:
ffmpeg -f dshow -rtbufsize 2048M -i "video=Integrated Webcam" -t 300 -c:v libx264
-segment_atclocktime 1 -segment_format mp4 meuvideo.mp4 -f mpegts -q:v 5 -codec:v
mpeg1video https://urlexemplo.com.br:8081/rota
日志:
ffmpeg started on 2017-11-20 at 15:52:22
Report written to "ffmpeg-20171120-155222.log"
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.1.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --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-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, dshow, from 'video=Integrated Webcam':
Duration: N/A, start: 9581.085000, bitrate: N/A
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
https://urlexemplo.com.br:8081/rota: Unknown error
我运行了-report命令,生成了一份报告。这里不能直接粘贴,因为太大了,可以在链接中找到:
https://www.dropbox.com/s/ow76gddst98iolt/ffmpeg-20171120-155222.log?dl=0
无论我如何编写 FFmpeg 的代码,输出的 url 总是会出现错误。是否有任何特定方法可以通过 HTTP 传输视频?缺少任何命令并导致错误?
编辑1:
为了测试,我将地址 udp://@xxx.xxx:1234(xxx.xxx -> IP)放在 url 位置并运行命令,使用 VLC 观看流媒体,并且它仍然在请求的五分钟内适当地录制视频。
问题仍然存在:是否有任何用于处理 HTTP 地址的特殊参数?
编辑2:
最后一个问题解决了。他们给了我错误的 URL。不需要指定端口。现在这个错误是另一个我不知道如何解决的错误,我没有找到所呈现错误的参考资料。
ffmpeg started on 2017-11-28 at 11:15:52
Report written to "ffmpeg-20171128-111552.log"
ffmpeg version 3.3.3
Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 7.1.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --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-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
libavdevice 57. 6.100 / 57. 6.100
libavfilter 6. 82.100 / 6. 82.100
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, dshow, from 'video=Integrated Webcam':
Duration: N/A, start: 50683.124000, bitrate: N/A
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #0:0 -> #1:0 (rawvideo (native) -> mpeg1video (native))
Press [q] to stop, [?] for help
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000000e888e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000000e888e0] profile High 4:2:2, level 3.0, 4:2:2 8-bit
[libx264 @ 0000000000e888e0] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to './videos/meu_video2017-11-28_11-15-51-950.mp4':
Metadata:
encoder : Lavf57.71.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv422p, 640x480, q=-1--1, 30 fps, 10000k tbn, 30 tbc
Metadata:
encoder : Lavc57.89.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Output #1, mpegts, to 'https://urlexemplo.com.br/rota':
Metadata:
encoder : Lavf57.71.100
Stream #1:0: Video: mpeg1video, yuv420p, 640x480, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc
Metadata:
encoder : Lavc57.89.100 mpeg1video
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Past duration 0.687492 too large
Past duration 0.679985 too large
Past duration 0.609367 too large
Past duration 0.609993 too large
frame= 32 fps=0.0 q=0.0 q=5.0 size= 0kB time=00:00:00.83 bitrate= 0.0kbits/s dup=10 drop=0 speed=1.65x
frame= 51 fps= 39 q=29.0 q=5.0 size= 3kB time=00:00:01.43 bitrate= 18.0kbits/s dup=24 drop=0 speed= 1.1x
frame= 56 fps= 31 q=29.0 q=5.0 size= 13kB time=00:00:01.56 bitrate= 69.5kbits/s dup=28 drop=0 speed=0.855x
frame= 60 fps= 23 q=29.0 q=5.0 size= 25kB time=00:00:01.66 bitrate= 123.1kbits/s dup=31 drop=0 speed=0.638x
frame= 84 fps= 26 q=26.0 q=5.0 size= 129kB time=00:00:02.46 bitrate= 427.3kbits/s dup=49 drop=0 speed=0.774x
frame= 111 fps= 30 q=29.0 q=5.0 size= 283kB time=00:00:03.40 bitrate= 683.0kbits/s dup=69 drop=0 speed=0.906x
C:\apity-desktop-node\src\ffmpeg.js:332 frame= 147 fps= 35 q=29.0 q=5.0 size= 515kB time=00:00:04.60 bitrate= 916.9kbits/s dup=96 drop=0 speed=1.08x
frame= 163 fps= 34 q=29.0 q=5.0 size= 620kB time=00:00:05.16 bitrate= 983.2kbits/s dup=108 drop=0 speed=1.09x
(...)
frame= 890 fps= 31 q=29.0 q=5.0 size= 5339kB time=00:00:29.40 bitrate=1487.6kbits/s dup=653 drop=0 speed=1.01x
frame= 902 fps= 31 q=29.0 q=5.0 size= 5416kB time=00:00:29.80 bitrate=1488.9kbits/s dup=662 drop=0 speed=1.01x
[tls @ 0000000000e9a040] Writing encrypted data to socket failed
av_interleaved_write_frame(): I/O error
Error writing trailer of https://urlexemplo.com.br:/rota: I/O error
frame= 919 fps= 29 q=-1.0 Lq=5.0 size= 5861kB time=00:00:30.53 bitrate=1572.4kbits/s dup=675 drop=0 speed=0.972x
video:6157kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[tls @ 0000000000e9a040] Writing encrypted data to socket failed
[tls @ 0000000000e9a040] Failed to send close message
[libx264 @ 0000000000e888e0] frame I:230 Avg QP:17.57 size: 25800
[libx264 @ 0000000000e888e0] frame P:243 Avg QP:25.21 size: 167
[libx264 @ 0000000000e888e0]
frame B:446 Avg QP:25.19 size: 35
[libx264 @ 0000000000e888e0] consecutive B-frames: 27.1% 5.7% 56.8% 10.4%
[libx264 @ 0000000000e888e0] mb I I16..4: 15.5% 73.8% 10.7%
[libx264 @ 0000000000e888e0] mb P I16..4: 0.5% 0.5% 0.0% P16..4: 3.6% 0.1% 0.4% 0.0% 0.0% skip:94.9%
[libx264 @ 0000000000e888e0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.9% 0.0% 0.0% direct: 0.0% skip:99.1% L0: 1.1% L1:98.9% BI: 0.0%
[libx264 @ 0000000000e888e0] 8x8 transform intra:73.5% inter:100.0%
[libx264 @ 0000000000e888e0] coded y,uvDC,uvAC intra: 51.1% 99.7% 98.6% inter: 0.1% 1.2% 0.0%
[libx264 @ 0000000000e888e0] i16 v,h,dc,p: 35% 27% 19% 19%
[libx264 @ 0000000000e888e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 21% 25% 4% 4% 3% 5% 2% 3%
[libx264 @ 0000000000e888e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 50% 21% 15% 3% 4% 2% 3% 1% 1%
[libx264 @ 0000000000e888e0] i8c dc,h,v,p: 75% 5% 9% 12%
[libx264 @ 0000000000e888e0] Weighted P-Frames: Y:0.8% UV:0.4%
[libx264 @ 0000000000e888e0] ref P L0: 72.5% 1.8% 18.5% 7.2%
[libx264 @ 0000000000e888e0] ref B L0: 91.4% 8.6%
[libx264 @ 0000000000e888e0]
ref B L1: 100.0% 0.0%
[libx264 @ 0000000000e888e0] kb/s:1564.33
Conversion failed!
看起来错误是 I/O 和视频转换。 错误 1:将加密数据写入套接字失败 av_interleaved_write_frame():I/O 错误
错误 2:(libx264)转换失败!
报告太大,这里放不下,所以我会放上链接: https://www.dropbox.com/s/azfrmvnurypjjte/ffmpeg-20171128-111552.log?dl=0