Ffmpeg 打开轴M1011-w摄像机的RTSP流,得到';处理输入时发现无效数据';错误(但并非总是)

Ffmpeg 打开轴M1011-w摄像机的RTSP流,得到';处理输入时发现无效数据';错误(但并非总是),ffmpeg,rtsp,Ffmpeg,Rtsp,经过几个令人沮丧的小时后,我决定看看是否有人能帮我解决这个恼人的问题 对于我正在进行的一个项目,我想从Axis(M1011-w)摄像机记录h.264 mp4中的RTSP流。我已经用openRTSP和ffmpeg尝试过了,得到了不同的结果。因为我需要在整个录制过程中录制并同时剪切视频片段,所以我希望以大约2-3秒的时间分段录制,这样我就可以简单地使用concat从较长的视频录制中快速创建较短的视频 首先,我通过使用openRTSP简单地将流捕获到原始H264,并在openRTSP仍在该文件中写入时

经过几个令人沮丧的小时后,我决定看看是否有人能帮我解决这个恼人的问题

对于我正在进行的一个项目,我想从Axis(M1011-w)摄像机记录h.264 mp4中的RTSP流。我已经用openRTSP和ffmpeg尝试过了,得到了不同的结果。因为我需要在整个录制过程中录制并同时剪切视频片段,所以我希望以大约2-3秒的时间分段录制,这样我就可以简单地使用concat从较长的视频录制中快速创建较短的视频

首先,我通过使用openRTSP简单地将流捕获到原始H264,并在openRTSP仍在该文件中写入时以ffmpeg打开输出文件来实现这一点。但是,这不是很可靠,也不是所有的相机的工作。而且,每次我想剪切一小段15秒的文件时,需要打开大约1-2GB的文件,这既不是很高效也不是很快

现在,我使用了一个ffmpeg命令,它可以工作,但并不总是这样。它有时抛出一个错误,有时它只是工作。如果我试图同时捕获2个或更多流,它总是失败

我正在从ffmpeg网站(Mac OS X Yosemite)运行最新的ffmpeg,并尝试了早期版本。。我已将摄像头固件更新为最新版本,路由器在本地运行,没有防火墙。它以前工作过,但非常不可靠。。 也许有些简单的事情我没有看到

相机的帧速率约为30640 x 480。GOP设置为20,因此每20帧为一个i帧。这些片段播放得非常好,没有任何小故障,在录制成功运行的输出时,播放得非常好

使用VLC从摄像机播放视频也可以很好地工作,openRTSP也可以从中录制视频,而不会出现任何问题

命令:

<pre>./ffmpeg -rtsp_transport tcp -fflags igndts -stimeout 100000 -t 3600 -i rtsp://root:fieldback@192.168.1.13/axis-media/media.amp?streamprofile=Quality -f segment -map 0:0 -c copy -segment_format mp4 -segment_time 2 -segment_time_delta 0.0166666666667 -reset_timestamps 1 -segment_list_entry_prefix 13/ -segment_list ./videos/18/200/cam_13.ffconcat ./videos/18/200/13/%09d.mp4 -loglevel debug</pre>
/ffmpeg-rtsp\U传输tcp-fflags igndts-TIMEOUT 100000-t 3600-irtsp://root:fieldback@192.168.1.13/axis media/media.amp?streamprofile=质量-f段-映射0:0-c副本-段\格式mp4-段\时间2-段\时间增量0.016666667-重置\时间戳1-段\列表\条目\前缀13/-段\列表./videos/18/200/cam_13.ffconcat./videos/18/200/13/%09d.mp4-日志级调试
控制台输出


ffmpeg版本2.4.3-tessus版权所有(c)2000-2014 ffmpeg开发者
构建于2014年11月3日23:01:10,苹果LLVM版本6.0(clang-600.0.54)(基于LLVM 3.5svn)
配置:--cc=/usr/bin/clang--prefix=/Users/tessus/data/ext/ffmpeg/sw--as=yasm--extra-version=tessus--disable shared--enable static--disable ffplay--enable gpl--enable pthreads--enable postproc--enable-libmp3lame--enable libthera--enable libvorbis--enable-libx264--enable-libx265--enable libxvided libspeex--启用bzlib--enable zlib--enable libopencore amrnb--enable libopencore amrwb--enable libxavs--enable libsoxr--enable libwavpack--enable-version3--enable libvo aacenc--enable libvpx--enable libgsm--enable libopus--enable libmodplug--enable fontconconfig--enable libfreetype--enable libass enable libble--启用筛选器--禁用indev=qtkit--禁用indev=x11grab\u xcb--启用运行时cpudetect
libavutil 54。7.100 / 54.  7.100
libavcodec56。1.100 / 56.  1.100
libav56格式。4.101 / 56.  4.101
libav56设备。0.100 / 56.  0.100
libavfilter 5。1.100 /  5.  1.100
libswscale 3。0.100 /  3.  0.100
libswresample1。1.100 /  1.  1.100
Libroc 53。0.100 / 53.  0.100
分割命令行。
读取选项'-rtsp_传输'。。。匹配为AVOption“rtsp_transport”,参数为“tcp”。
读取选项'-fflags'。。。作为避免选项“fflags”与参数“igndts”匹配。
读取选项“-stimeout”。。。与参数“100000”匹配作为避免选项“刺激”。
正在读取选项'-t'。。。与参数“3600”匹配为选项“t”(录制或转码音频/视频的“持续时间”秒)。
阅读选项'-i'。。。匹配为输入文件,参数为'rtsp://root:fieldback@192.168.1.13/axis介质/介质放大器?streamprofile=质量'。
正在读取选项'-f'。。。作为选项“f”(强制格式)与参数“segment”匹配。
正在读取选项'-map'。。。匹配为参数为“0:0”的选项“映射”(设置输入流映射)。
正在读取选项'-c'。。。作为选项“c”(编解码器名称)与参数“copy”匹配。
读取选项“-段\格式”。。。匹配为AVOption“segment_format”和参数“mp4”。
阅读选项“-段时间”。。。与参数“2”匹配为避免选项“分段时间”。
读取选项“-段时间增量”。。。与参数“0.0166667”匹配为避免选项“段时间增量”。
正在读取选项'-reset_timestamps'。。。与参数“1”匹配为AVOption“reset_timestamps”。
阅读选项'-段\列表\条目\前缀'。。。与参数“13/”匹配为AVOption“段\列表\条目\前缀”。
阅读选项“-段列表”。。。与AVOption“segment_list”和参数匹配。/videos/18/200/cam_13.ffconcat。
阅读选项“/videos/18/200/13/%09d.mp4”。。。匹配为输出文件。
正在读取选项'-loglevel'。。。匹配为选项“loglevel”(设置日志级别)和参数“debug”。
已完成命令行的拆分。
解析一组选项:全局。
使用参数debug应用选项loglevel(设置日志级别)。
已成功分析一组选项。
解析一组选项:输入文件rtsp://root:fieldback@192.168.1.13/axis介质/介质放大器?streamprofile=质量。
使用参数3600应用选项t(录制或转码音频/视频的“持续时间”秒)。
已成功分析一组选项。
打开输入文件:rtsp://root:fieldback@192.168.1.13/axis介质/介质放大器?streamprofile=质量。
[rtsp@0x7FDAA4800F000]SDP:
v=0
o=IP4 192.168.1.13中的-1288009478499165 1288009478499165
s=媒体介绍
e=无
c=在IP4中为0.0.0.0
b=AS:50000
t=0
a=控制:rtsp://192.168.
<pre>
ffmpeg version 2.4.3-tessus Copyright (c) 2000-2014 the FFmpeg developers
 built on Nov  3 2014 23:01:10 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
 configuration: --cc=/usr/bin/clang --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-libsoxr --enable-libwavpack --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --disable-indev=qtkit --disable-indev=x11grab_xcb --enable-runtime-cpudetect
 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
 libpostproc    53.  0.100 / 53.  0.100
Splitting the commandline.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument 'igndts'.
Reading option '-stimeout' ... matched as AVOption 'stimeout' with argument '100000'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '3600'.
Reading option '-i' ... matched as input file with argument 'rtsp://root:fieldback@192.168.1.13/axis-media/media.amp?streamprofile=Quality'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'segment'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:0'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-segment_format' ... matched as AVOption 'segment_format' with argument 'mp4'.
Reading option '-segment_time' ... matched as AVOption 'segment_time' with argument '2'.
Reading option '-segment_time_delta' ... matched as AVOption 'segment_time_delta' with argument '0.0166666666667'.
Reading option '-reset_timestamps' ... matched as AVOption 'reset_timestamps' with argument '1'.
Reading option '-segment_list_entry_prefix' ... matched as AVOption 'segment_list_entry_prefix' with argument '13/'.
Reading option '-segment_list' ... matched as AVOption 'segment_list' with argument './videos/18/200/cam_13.ffconcat'.
Reading option './videos/18/200/13/%09d.mp4' ... 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 rtsp://root:fieldback@192.168.1.13/axis-media/media.amp?streamprofile=Quality.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 3600.
Successfully parsed a group of options.
Opening an input file: rtsp://root:fieldback@192.168.1.13/axis-media/media.amp?streamprofile=Quality.
[rtsp @ 0x7fdaa480f000] SDP:
v=0
o=- 1288009478499165 1288009478499165 IN IP4 192.168.1.13
s=Media Presentation
e=NONE
c=IN IP4 0.0.0.0
b=AS:50000
t=0 0
a=control:rtsp://192.168.1.13:554/axis-media/media.amp?streamprofile=Quality
a=range:npt=0.000000-
m=video 0 RTP/AVP 96
b=AS:50000
a=framerate:30.0
a=transform:1,0,0;0,1,0;0,0,1
a=control:rtsp://192.168.1.13:554/axis-media/media.amp/trackID=1?streamprofile=Quality
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=420029; sprop-parameter-sets=Z0IAKeNQFAe2AtwEBAaQeJEV,aM48gA==

[rtsp @ 0x7fdaa480f000] video codec set to: h264
[rtsp @ 0x7fdaa480f000] RTP Packetization Mode: 1
[rtsp @ 0x7fdaa480f000] RTP Profile IDC: 42 Profile IOP: 0 Level: 29
[rtsp @ 0x7fdaa480f000] Extradata set to 0x7fdaa3d021e0 (size: 30)!
rtsp://root:fieldback@192.168.1.13/axis-media/media.amp?streamprofile=Quality: Invalid data found when processing input
</pre>