1,451
社区成员
发帖
与我相关
我的任务
分享
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(rtspPath);
grabber.setOption("rtsp_transport", "tcp");
grabber.start();
但是问题是,在50帧后,grabber.grab();返回的全部都是null了。想不明白是什么原因。会不会是rtsp传输过来的数据太多,而ffmpeg处理的太慢而导致的呢?
Input #0, rtsp, from 'rtsp://admin:123123@192.168.1.64:554/Streaming/Channels/1':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.040000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709), 2560x1440, 25 fps, 25 tbr, 90k tbn
[swscaler @ 000000001be02720] deprecated pixel format used, make sure you did set range correctly
[rtsp @ 0000000000f8c9a0] max delay reached. need to consume packet
[rtsp @ 0000000000f8c9a0] RTP: missed 4188 packets
[rtsp @ 0000000000f8c9a0] RTP: PT=60: bad cseq 61ae expected=5152
[rtsp @ 0000000000f8c9a0] max delay reached. need to consume packet
[rtsp @ 0000000000f8c9a0] RTP: missed 4189 packets
[rtsp @ 0000000000f8c9a0] max delay reached. need to consume packet
[rtsp @ 0000000000f8c9a0] RTP: missed 96 packets
[h264 @ 000000001a9fbfe0] left block unavailable for requested intra mode
[h264 @ 000000001a9fbfe0] error while decoding MB 0 67, bytestream 23926
[h264 @ 000000001a9fbfe0] concealing 3729 DC, 3729 AC, 3729 MV errors in P frame
[swscaler @ 000000001be02720] deprecated pixel format used, make sure you did set range correctly
[rtsp @ 0000000000f8c9a0] max delay reached. need to consume packet
[rtsp @ 0000000000f8c9a0] RTP: missed 99 packets
ffserver -f /etc/ffserver.conf
启动时, 打开网页上的 http:localhost:9999/teststat.html
查看ffserver的运行情况,网页是刷不出来的?感觉我的ffserver是没有启动的,这个和我的配置文件有怎么关联呢?还是和安装的过程有关联?
(3)大哥有没推荐的安装教程,能让小我对比着研究下
最后真心谢谢,一路的陪伴<Feed feed1.ffm>
File ./feed1.ffm
FileMaxSize 100M
ACL allow localhost
</Feed>
还是第二种:<Feed feed1.ffm>
File ./feed1.ffm
FileMaxSize 100M
ACL allow 127.0.0.1
</Feed>
进行测试,提示的错误均是一样
ffserver部分
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$ ffserver -f /etc/ffserver.conf
ffserver version N-82475-g83a139e Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/home/bra-fei/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/bra-fei/ffmpeg_build/include --extra-ldflags=-L/home/bra-fei/ffmpeg_build/lib --bindir=/home/bra-fei/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
libavutil 55. 40.100 / 55. 40.100
libavcodec 57. 66.103 / 57. 66.103
libavformat 57. 57.100 / 57. 57.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 67.100 / 6. 67.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Fri Nov 25 15:05:09 2016 Codecs do not match for stream 0
Fri Nov 25 15:05:09 2016 [ffm @ 0x2a46fe0]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Fri Nov 25 15:05:09 2016 FFserver started.
Fri Nov 25 15:05:35 2016 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Segmentation fault (core dumped)
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$
vlc部分:
url:http://localhost:9999/test.flv
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$ sudo ufw disable
[sudo] password for bra-fei:
Firewall stopped and disabled on system startup
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$ vlc
VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
[0xf3f068] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0x7f5744001088] access_http access error: failed to read answer
[0x7f5744001088] main access error: connection failed: Connection refused
[0x7f5744001088] access_http access error: cannot connect to localhost:9999
[0x7f5744001088] main access error: connection failed: Connection refused
[0x7f5744001088] access_mms access error: cannot connect to localhost:9999
[0x7f5748000c08] main input error: open of `http://localhost:9999/test.flv' failed
ffmpeg部分
ffmpeg -f rtsp -rtsp_transport tcp -i rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream http://localhost:9999/feed1.ffm
提示的错误:
frame= 590 fps= 26 q=3.7 size= 6220kB time=00:00:23.56 bitrate=2162.7kbits/s
frame= 602 fps= 26 q=3.4 size= 6336kB time=00:00:24.04 bitrate=2159.1kbits/s
frame= 616 fps= 26 q=4.0 size= 6460kB time=00:00:24.60 bitrate=2151.2kbits/s
frame= 629 fps= 26 q=3.3 size= 6564kB time=00:00:25.12 bitrate=2140.6kbits/s
frame= 641 fps= 26 q=3.3 size= 6668kB time=00:00:25.60 bitrate=2133.8kbits/s
frame= 654 fps= 26 q=2.7 size= 6780kB time=00:00:26.12 bitrate=2126.4kbits/s
av_interleaved_write_frame(): Connection reset by peer
Error writing trailer of http://localhost:9999/feed1.ffm: Connection reset by peerframe= 666 fps= 26 q=2.3 Lsize= 6916kB time=00:00:26.60 bitrate=2129.9kbits/s dup=0 drop=4 speed=1.03x
video:6878kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.556541%
Conversion failed!
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$
没打开vlc之前,感觉ffmpeg应该已经和ffserver链接起来,应该将视频流传送到ip的监听端口了,按照提示也没整出什么来,指点下迷津,谢谢,
备注:ffmpeg安装完成以后所有的函数我没动过,
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$ sudo ufw disable
[sudo] password for bra-fei:
Firewall stopped and disabled on system startup
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$ vlc
VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
[0x157f068] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0x7f538c0026c8] main stream error: cannot pre fill buffer
[0x7f538c0026c8] main stream error: cannot pre fill buffer
[0x7f538c0026c8] main stream error: cannot pre fill buffer
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$ vlc
VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
[0x23f1068] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[0x7fe568000fa8] access_http access error: failed to read answer
[0x7fe568000fa8] main access error: connection failed: Connection refused
[0x7fe568000fa8] access_http access error: cannot connect to localhost:9999
[0x7fe568000fa8] main access error: connection failed: Connection refused
[0x7fe568000fa8] access_mms access error: cannot connect to localhost:9999
[0x7fe570000c08] main input error: open of `http://localhost:9999/test.flv' failed
frame=18194 fps= 25 q=4.8 size= 178988kB time=00:12:07.72 bitrate=2014.9kbits/s
frame=18208 fps= 25 q=4.9 size= 179112kB time=00:12:08.28 bitrate=2014.7kbits/s
frame=18221 fps= 25 q=4.4 size= 179228kB time=00:12:08.80 bitrate=2014.6kbits/s
frame=18233 fps= 25 q=4.2 size= 179348kB time=00:12:09.28 bitrate=2014.6kbits/s
frame=18246 fps= 25 q=5.6 size= 179496kB time=00:12:09.80 bitrate=2014.8kbits/s
frame=18260 fps= 25 q=4.1 size= 179608kB time=00:12:10.36 bitrate=2014.6kbits/s
frame=18274 fps= 25 q=4.0 size= 179716kB time=00:12:10.92 bitrate=2014.2kbits/s
frame=18287 fps= 25 q=3.9 size= 179860kB time=00:12:11.44 bitrate=2014.4kbits/s
frame=18300 fps= 25 q=4.0 size= 179976kB time=00:12:11.96 bitrate=2014.3kbits/s
av_interleaved_write_frame(): Connection reset by peer
Error writing trailer of http://localhost:9999/feed1.ffm: Connection reset by peerframe=18306 fps= 25 q=5.3 Lsize= 180084kB time=00:12:12.20 bitrate=2014.8kbits/s dup=0 drop=4 speed= 1x
video:179175kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.507253%
Conversion failed!
little-fly@ubuntu:~$ ffmpeg -f rtsp -rtsp_transport tcp -i rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream http://localhost:9999/feed1.ffm
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 8 2016 05:20:06 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --enable-shared --prefix=/usr/local/ffmpeg
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
Input #0, rtsp, from 'rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.240000, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 1280x720, 25 fps, 25 tbr, 90k tbn, 50 tbc
[http @ 0x26578c0] HTTP error 503 Server too busy
http://localhost:9999/feed1.ffm: Input/output error
little-fly@ubuntu:~$ ffmpeg -f rtsp -i -rtsp_transport tcp rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream http://localhost:9999/feed1.ffm
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 8 2016 05:20:06 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --enable-shared --prefix=/usr/local/ffmpeg
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
[tcp @ 0x22ad8a0] Connection to tcp://:554?timeout=0 failed (Connection refused), trying next address
[tcp @ 0x22ad8a0] Connection to tcp://:554?timeout=0 failed: Connection refused
-rtsp_transport: Input/output error
于是在另外一台笔记本ubuntu系统上从新跑了一次 (不是虚拟机),链接的问题没有出现但是却会有如下的故障
bra-fei@brafei-Compaq-CQ45-Notebook-PC:~$ ffmpeg -f rtsp -i rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream http://localhost:9999/feed1.ffm
ffmpeg version N-82475-g83a139e Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/home/bra-fei/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/bra-fei/ffmpeg_build/include --extra-ldflags=-L/home/bra-fei/ffmpeg_build/lib --bindir=/home/bra-fei/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
libavutil 55. 40.100 / 55. 40.100
libavcodec 57. 66.103 / 57. 66.103
libavformat 57. 57.100 / 57. 57.100
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 67.100 / 6. 67.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, rtsp, from 'rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.240000, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 1280x720, 25 fps, 25 tbr, 90k tbn, 50 tbc
Output #0, ffm, to 'http://localhost:9999/feed1.ffm':
Metadata:
title : Media Presentation
creation_time : now
encoder : Lavf57.57.100
Stream #0:0: Video: flv1 (flv), yuv420p, 1280x720, q=2-31, 2000 kb/s, 25 fps, 1000k tbn, 25 tbc
Metadata:
encoder : Lavc57.66.103 flv
Side data:
cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
Press [q] to stop, [?] for help
[rtsp @ 0x31f43a0] max delay reached. need to consume packet
[rtsp @ 0x31f43a0] RTP: missed 15 packets
frame= 32 fps=0.0 q=2.0 size= 476kB time=00:00:01.24 bitrate=3144.7kbits/s[rtsp @ 0x31f43a0] max delay reached. need to consume packet
[rtsp @ 0x31f43a0] RTP: missed 28 packets
[h264 @ 0x32fd080] out of range intra chroma pred mode
[h264 @ 0x32fd080] error while decoding MB 77 8
[h264 @ 0x32fd080] concealing 2932 DC, 2932 AC, 2932 MV errors in I frame
frame= 42 fps= 42 q=2.0 size= 640kB time=00:00:01.64 bitrate=3196.9kbits/sframe= 57 fps= 37 q=2.1 size= 844kB time=00:00:02.24 bitrate=3086.6kbits/sframe= 70 fps= 34 q=2.6 size= 1012kB time=00:00:02.76 bitrate=3003.7kbits/sframe= 83 fps= 33 q=3.1 size= 1172kB time=00:00:03.28 bitrate=2927.1kbits/s[rtsp @ 0x31f43a0] max delay reached. need to consume packet
[rtsp @ 0x31f43a0] RTP: missed 10 packets
[h264 @ 0x32fd080] out of range intra chroma pred mode
[h264 @ 0x32fd080] error while decoding MB 75 8
[h264 @ 0x32fd080] concealing 2934 DC, 2934 AC, 2934 MV errors in I frame
frame= 96 fps= 31 q=4.7 size= 1320kB time=00:00:03.80 bitrate=2845.6kbits/sframe= 109 fps= 30 q=2.5 size= 1560kB time=00:00:04.32 bitrate=2958.2kbits/sframe= 122 fps= 30 q=5.6 size= 1676kB time=00:00:04.84 bitrate=2836.7kbits/sframe= 135 fps= 29 q=7.4 size= 1792kB time=00:00:05.36 bitrate=2738.8kbits/s[rtsp @ 0x31f43a0] max delay reached. need to consume packet
[rtsp @ 0x31f43a0] RTP: missed 39 packets
[h264 @ 0x32fd080] corrupted macroblock 5 10 (total_coeff=-1)
[h264 @ 0x32fd080] error while decoding MB 5 10
[h264 @ 0x32fd080] concealing 2844 DC, 2844 AC, 2844 MV errors in I frame
frame= 148 fps= 29 q=10.3 size= 1904kB time=00:00:05.88 bitrate=2652.6kbits/frame= 161 fps= 28 q=9.8 size= 2020kB time=00:00:06.40 bitrate=2585.6kbits/s dup=0 drop=4 speed=1.13x
[3]+ Stopped ffmpeg -f rtsp -i rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream http://localhost:9999/feed1.ffm
劳烦能再指导下么?sudo vi /etc/ffserver.conf
HTTPPort 9999
RTSPPort 9990
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -
<Feed feed1.ffm>
File ./feed1.ffm
FileMaxSize 10M
ACL allow localhost
</Feed>
<Stream test.flv>
Feed feed1.ffm
Format flv
# VideoCodec libx264
VideoFrameRate 25
VideoBitRate 2000
VideoSize 1280x720
# AVPresetVideo default
# AVPresetVideo baseline
AVOptionVideo flags +global_header
# AudioBitRate 24
# AudioChannels 1
# AudioSampleRate 44100
AVOptionAudio flags +global_header
</Stream>
<Stream teststat.html>
Format status
</Stream>
开启ffserver
ffserver -f /etc/ffserver.conf
ffserver version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 8 2016 05:20:06 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --enable-shared --prefix=/usr/local/ffmpeg
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
Wed Nov 23 19:06:22 2016 FFserver started
开启ffmpeg提示了个错误
ffmpeg -f rtsp -i rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream http://localhost:9999/feed1.ffm
ffmpeg version 2.4.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 8 2016 05:20:06 with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --enable-shared --prefix=/usr/local/ffmpeg
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
[rtsp @ 0x11cfc20] UDP timeout, retrying with TCP
[rtsp @ 0x11cfc20] method PAUSE failed: 551 Option not supported
[rtsp @ 0x11cfc20] Could not find codec parameters for stream 0 (Video: h264): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream: could not find codec parameters
Input #0, rtsp, from 'rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream':
Metadata:
title : Media Presentation
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264, 90k tbr, 90k tbn, 180k tbc
[http @ 0x11f3b20] HTTP error 503 Server too busy
http://localhost:9999/feed1.ffm: Input/output error
其中的rtsp://admin:SELJQJ00@192.168.31.247:554/h264/ch1/main/av_stream是我摄像头的视频流部分,ffmpeg这个程序我只完成编译安装,编码配置文件什么的没有动过,还请指出面对这个错误时,该从哪里入手,尝试了很久也没有进展