FFMPEG capture snapshot image from RTSP IPCamera

1

Hi I am able to stream video successfully from my IP Camera with VLC using the URL: rtsp://192.168.0.6:554/cam/realmonitor

When attempting to use FFMPEG it is failing with the following errors: I have attached successful VLC comms and also the conversation of the failing FFMPEG comms.

How can i make FFMPEG behave like VLC to successfully capture the stream?

Thank you in advance for any assistance

C:\ffmpeg-20150415-git-fbdaebb-win64-static\ffmpeg-20150415-git-fbdaebb-win64-static\bin>ffmpeg -i rtsp://admin:admin@192.168.0.6:554/cam/realmonitor -rtsp_transport tcp -f image2 -threads 4 -t 14400 -async 1 -r 1/5 -q 1.5 -vcodec mjpeg c:\Test.jpg
ffmpeg version N-71455-gfbdaebb Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass
--enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --e
nable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora
--enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-l
ibx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 22.101 / 54. 22.101
  libavcodec     56. 34.100 / 56. 34.100
  libavformat    56. 30.100 / 56. 30.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 14.100 /  5. 14.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Invalid interval end specification ''
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[mjpeg @ 0000000000312fa0] RTP: missed 14 packets
[rtsp @ 0000000000330c40] Received packet without a start chunk; dropping frame.
[rtsp @ 0000000000330c40] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://admin:admin@192.168.0.6:554/cam/realmonitor':
  Metadata:
    title           : RTSP Session of ZheJiang Dahua Technology CO.,LTD.
  Duration: -187967:-4:-22.-32, start: 676681462.328875, bitrate: N/A
    Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 90k tbr, 90k tbn, 90k tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
Codec AVOption threads () specified for output file #0 (c:\Test.jpg) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video str
eams) or that it is a private option of some encoder which was not actually used for any stream.
Output #0, image2, to 'c:\Test.jpg':
  Metadata:
    title           : RTSP Session of ZheJiang Dahua Technology CO.,LTD.
Output file #0 does not contain any stream
Received signal 2: terminating.

FFMPEG wireshark conversation:

OPTIONS rtsp://192.168.0.6:554/cam/realmonitor RTSP/1.0

CSeq: 1

User-Agent: Lavf56.30.100



RTSP/1.0 401 Unauthorized

WWW-Authenticate: Basic realm="Dahua"

Server: Dahua Rtsp Server

Content-Length: 0

CSeq: 1



OPTIONS rtsp://192.168.0.6:554/cam/realmonitor RTSP/1.0

CSeq: 2

User-Agent: Lavf56.30.100

Authorization: Basic YWRtaW46YWRtaW4=



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

Content-Length: 0

CSeq: 2

Public: OPTIONS,DESCRIBE,SETUP,PLAY,PAUSE,TEARDOWN,SET_PARAMETER



DESCRIBE rtsp://192.168.0.6:554/cam/realmonitor RTSP/1.0

Accept: application/sdp

CSeq: 3

User-Agent: Lavf56.30.100

Authorization: Basic YWRtaW46YWRtaW4=



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

CSeq: 3

Content-Base: rtsp://192.168.0.6:554/cam/realmonitor/

Content-Type: application/sdp

Content-Length: 339

Cache-Control: must-revalidate

x-Accept-Dynamic-Rate: 1



v=0

o=- 2251938208 2251938208 IN IP4 0.0.0.0

s=RTSP Session of ZheJiang Dahua Technology CO.,LTD.

c=IN IP4 0.0.0.0

t=0 0

a=control:*

a=range:now-

a=packetization-supported:DH

m=video 0 RTP/AVP 26

a=control:trackID=0

a=framerate:25.000000

a=rtpmap:26 JPEG/90000

m=audio 0 RTP/AVP 8

a=control:trackID=1

a=rtpmap:8 PCMA/8000



SETUP rtsp://192.168.0.6:554/cam/realmonitor/trackID=0 RTSP/1.0

Transport: RTP/AVP/UDP;unicast;client_port=19420-19421

x-Dynamic-Rate: 0

CSeq: 4

User-Agent: Lavf56.30.100

Authorization: Basic YWRtaW46YWRtaW4=



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

Content-Length: 0

CSeq: 4

Transport: RTP/AVP;unicast;client_port=19420-19421;server_port=20004-20005;ssrc=4BC14B3E

x-dynamic-rate: 1

Session: 1429257645838106;timeout=90



SETUP rtsp://192.168.0.6:554/cam/realmonitor/trackID=1 RTSP/1.0

Transport: RTP/AVP/UDP;unicast;client_port=19422-19423

x-Dynamic-Rate: 0

CSeq: 5

User-Agent: Lavf56.30.100

Session: 1429257645838106

Authorization: Basic YWRtaW46YWRtaW4=



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

Content-Length: 0

CSeq: 5

Transport: RTP/AVP;unicast;client_port=19422-19423;server_port=20006-20007;ssrc=4BC14B29

x-dynamic-rate: 1

Session: 1429257645838106;timeout=90



PLAY rtsp://192.168.0.6:554/cam/realmonitor/ RTSP/1.0

Range: npt=0.000-

CSeq: 6

User-Agent: Lavf56.30.100

Session: 1429257645838106

Authorization: Basic YWRtaW46YWRtaW4=



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

RTP-Info: url=trackID=0;seq=26201;rtptime=253800,url=trackID=1;seq=25939;rtptime=22560

Range: npt=0.000000-

Content-Length: 0

CSeq: 6

Session: 1429257645838106

In Wireshark i can see the successful conversation between VLC and the IP Camera.

RTSP/1.0 200 OK

Server: Dahua Rtsp Server

Content-Length: 0

CSeq: 5

Public: OPTIONS,DESCRIBE,SETUP,PLAY,PAUSE,TEARDOWN,SET_PARAMETER



DESCRIBE rtsp://192.168.0.6:554/cam/realmonitor RTSP/1.0

CSeq: 6

Authorization: Basic YWRtaW46YWRtaW4=

User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)

Accept: application/sdp



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

CSeq: 6

Content-Base: rtsp://192.168.0.6:554/cam/realmonitor/

Content-Type: application/sdp

Content-Length: 339

Cache-Control: must-revalidate

x-Accept-Dynamic-Rate: 1



v=0

o=- 2251938209 2251938209 IN IP4 0.0.0.0

s=RTSP Session of ZheJiang Dahua Technology CO.,LTD.

c=IN IP4 0.0.0.0

t=0 0

a=control:*

a=range:now-

a=packetization-supported:DH

m=video 0 RTP/AVP 26

a=control:trackID=0

a=framerate:25.000000

a=rtpmap:26 JPEG/90000

m=audio 0 RTP/AVP 8

a=control:trackID=1

a=rtpmap:8 PCMA/8000



SETUP rtsp://192.168.0.6:554/cam/realmonitor/trackID=0 RTSP/1.0

CSeq: 7

Authorization: Basic YWRtaW46YWRtaW4=

User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)

Transport: RTP/AVP/TCP;unicast;interleaved=0-1



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

Content-Length: 0

CSeq: 7

Transport: RTP/AVP/TCP;unicast;interleaved=0-1;ssrc=00AED19E

x-dynamic-rate: 1

Session: 1429217292541559;timeout=90



SETUP rtsp://192.168.0.6:554/cam/realmonitor/trackID=1 RTSP/1.0

CSeq: 8

Authorization: Basic YWRtaW46YWRtaW4=

User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)

Transport: RTP/AVP/TCP;unicast;interleaved=2-3

Session: 1429217292541559



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

Content-Length: 0

CSeq: 8

Transport: RTP/AVP/TCP;unicast;interleaved=2-3;ssrc=00AED189

x-dynamic-rate: 1

Session: 1429217292541559;timeout=90



PLAY rtsp://192.168.0.6:554/cam/realmonitor/ RTSP/1.0

CSeq: 9

Authorization: Basic YWRtaW46YWRtaW4=

User-Agent: LibVLC/2.1.5 (LIVE555 Streaming Media v2014.05.27)

Session: 1429217292541559

Range: npt=0.000-



RTSP/1.0 200 OK

Server: Dahua Rtsp Server

RTP-Info: url=trackID=0;seq=47727;rtptime=253800,url=trackID=1;seq=5395;rtptime=22560

Range: npt=0.000000-

Content-Length: 0

CSeq: 9

Session: 1429217292541559



$......o...h........A..Z............. <BEGINING OF JPEG DATA FRAMES>

NxtLevel

Posted 2015-04-17T06:14:36.653

Reputation: 51

No answers