[FFmpeg-user] Opening an RTSP stream of Axis M1011-w camera gives 'Invalid data found when processing input' error (but not always)

Edwin Meijne edwinmeijne at gmail.com
Tue Dec 2 15:16:48 CET 2014


Hi all

After some really frustrating hours I decided to see if someone can help me fix this annoying problem..

For a project I am working on I want to record a RTSP stream in h.264 mp4 from an Axis (M1011-w) camera. I have tried this with openRTSP and ffmpeg, and got varying results. Because I need to record and simultaneously cut out small pieces of video from the total recording, I want to record in segments of around 2-3 seconds, so that I can simply use concat to quickly create shorter videos from the longer video recording.

First I managed to do this by simply capturing the stream to raw H264 with openRTSP, and open the output file in ffmpeg while openRTSP was still writing in this file. But, this is not very reliable and not all camera's work for this. Also, it requires me to open files of around 1-2 GB each time I want to cut a small section of 15 seconds, not very efficient nor fast.

Now, I have a ffmpeg command that I used and which worked, but not always. It sometimes throws 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 ffmpeg from the ffmpeg website (Mac OS X Yosemite) and tried an earlier version as well.. I have updated the camera firmware to the latest version and the router is running locally without a firewall. It has worked before, but is very unreliable..
Maybe there is something simple I am not seeing?

The framerate of the camera is around 30, 640 x 480. The GOP is set to 20, so every 20 frames is an i-frame. The segments play perfectly fine without glitches and when concat-ting the output of a successful run plays fine...

Playing video from the camera with VLC works fine as well, and openRTSP can also record from it without any hickups.

Command:

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


Console output

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







More information about the ffmpeg-user mailing list