[FFmpeg-devel] avformat_find_stream_info() fails while reading rtsp stream
Audric Ackermann
audric.bilb at gmail.com
Mon Oct 8 11:56:52 CEST 2012
On Fri, Oct 05, 2012 at 11:45:09AM +0200, Audric Ackermann wrote:
> Hi,
>
> I am currently developping an application for Android to read Mjpeg streams
> from a server which uses live555 to stream webcam.
>
> Firstly I try this :
>
> if (avformat_open_input(&fmt_ctx, url, NULL, NULL) < 0) {
> LOGE("Could not open source file");
> return 1;
> }
> else
> LOGI("File/url opened - OK");
> */
> /* retrieve stream information */
> if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
> LOGE("Find streams informations - Fail");
> return 1;
> }
> else
> LOGI("Find streams informations - OK");
>
>
> It works with url like
> rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov(rtsp + h264), I
> can print image on the Android Application, but it fails
> in the opening with the server I use.
> I think it is because the server stream to multicast, so I had (found on
> Internet)
>
> AVDictionary* options = NULL;
> av_dict_set(&options, "rtsp_transport", "udp_multicast", 0);
> ret = avformat_open_input(&fmt_ctx, url, 0, &options);
>
> if (ret!=0 || !fmt_ctx){
> LOGE("Source open - Fail");
> return 1;
> }
> else {
> LOGI("Source open - OK");
> }
> if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {
> LOGE("Find streams informations - Fail");
>
> I can open the stream, but now it fails while finding streams information,
> and I don't understand why.
> Have I missed something ?
does it work with ffmpeg itself ?
where exactly does it fail in avformat_find_stream_info() ?
using ffmpeg alone, with this : ffmpeg -i rtsp://ownaddress:port/ I get :
[rtsp @ 0x32a0240] Nonmatching transport in server reply
rtsp://ownaddress:port/: Invalid data found when processing input
rtsp exchange :
OPTIONS rtsp://ip:port/ RTSP/1.0
CSeq: 1
RTSP/1.0 200 OK
CSeq: 1
Date: Mon, Oct 08 2012 09:07:24 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE,
GET_PARAMETER, SET_PARAMETER
DESCRIBE rtsp://ip:port/ RTSP/1.0
Accept: application/sdp
CSeq: 2
RTSP/1.0 200 OK
CSeq: 2
Date: Mon, Oct 08 2012 09:07:24 GMT
Content-Base: rtsp://ip:port//
Content-Type: application/sdp
Content-Length: 328
v=0
o=- 1349687238058614 1 IN IP4 ip
s=Live Session streamed
i=testation
t=0 0
a=tool:LIVE555 Streaming Media v2010.04.09
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:Live Session streamed
a=x-qt-text-inf:testation
m=video 7071 RTP/AVP 26
c=IN IP4 broadcast_address/255
b=AS:50
a=control:track1
SETUP rtsp://ip:port//track1 RTSP/1.0
Transport: RTP/AVP/UDP;unicast;client_port=6862-6863
CSeq: 3
RTSP/1.0 200 OK
CSeq: 3
Date: Mon, Oct 08 2012 09:07:24 GMT
Transport: RTP/AVP;multicast;destination=broadcastAddress;source=ip;port=7071-0;ttl=255
Session: 456B88FC
It seems that ffmpeg ignore the multicast mode of the server. Is it
something to add to accept it ?
I don't know where avformat_find_streams_infos fails because I don't
redirect log from ffmpeg to android log. I'm going to do this...
More information about the ffmpeg-devel
mailing list