Opening an RTSP stream of the Axis M1011-w camera gives "Invalid data found during input processing" (but not always)

After some really frustrating hours, I decided to see if anyone could help me fix this annoying issue.

For a project I am working on, I want to record an RTSP stream in h.264 mp4 from an Axis camera (M1011-w). I tried this with openRTSP and ffmpeg and got different results. Since I need to record and cut small chunks of video from the overall recording at the same time, I want to record in segments of about 2-3 seconds so that I can just use concat to quickly create shorter videos from a longer video.

At first I succeeded by simply capturing the stream in raw H264 using openRTSP and opening the output file in ffmpeg while openRTSP was still writing to that file. But this is not very reliable, and not all cameras work for this. Also, it requires me to open files of about 1-2 GB each time I want to cut a small section of 15 seconds, not very efficient and fast.

I now have a ffmpeg command that I used and which worked, but not always. Sometimes it generates an error, sometimes it just works. If I try to capture 2 streams or more at the same time, it always fails.

I am running the latest version of ffmpeg from the ffmpeg website (Mac OS X Yosemite) and tried an earlier version. I have updated the camera firmware to the latest version and the router is running locally without a firewall. It worked before, but is very unreliable. Maybe something simple I don't see?

The camera frame rate is around 30, 640 x 480. The GOP is set to 20, so every 20 frames are i-frames. The segments play nicely without crashing and when concatenated, the result of a successful run works fine ...

Playing video from the camera using VLC also works great and openRTSP can also record from it without any hickups.

Command:

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

      

Console output

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

      

+3


source to share





All Articles