打开Axis M1011-w摄像机的RTSP流会出现“处理输入时发现无效数据”错误(但并非总是如此)

时间:2014-12-02 14:34:46

标签: ffmpeg rtsp

经过一段非常令人沮丧的时间后,我决定看看是否有人可以帮助我解决这个烦人的问题..

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

首先,我设法通过简单地使用openRTSP将流捕获到原始H264,并在openRTSP仍在此文件中写入时打开ffmpeg中的输出文件。但是,这不是很可靠,并非所有相机都能为此工作。此外,它要求我每次打开大约1-2 GB的文件,我想要缩短15秒的一小部分,效率不高也不快。

现在,我有一个ffmpeg命令,我使用过哪个有效,但并非总是如此。它有时会抛出一个错误,有时它只是起作用。如果我尝试同时捕获2个或更多的流,它总是会失败。

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

相机的帧速率约为30,640 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>

控制台输出

<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>

0 个答案:

没有答案
相关问题