[Libav-user] Avio_open error opening rtsp server connection

Andre Esteves andresteves at gmail.com
Sat Sep 1 18:10:43 CEST 2012


Hi everyone,

I built ffmpeg for android to use with JNI and i tried to make use of
methods that are in the muxing example (
http://ffmpeg.org/doxygen/trunk/muxing_8c-source.html#l00414).
I source code im using is:
        *char server[] = "rtsp://192.168.1.34/rtplive/streamTeste";*
       * av_register_all();*
* avcodec_register_all();*
* avformat_network_init();*
*
*
* /* auto detect the output format from the name. */*
* avformat_alloc_output_context2(&oc, 0, "mp4", server);*
* if(!oc)*
* LOGI(5,"Could not guess format...");*
* *
* //oc = avformat_alloc_context();*
*
*
* LOGI(5,"1...");*
*
*
* oformat = oc->oformat;*
* strcpy(oc->filename,server);*
*
*
* /* find the video encoder */*
* video_codec = avcodec_find_encoder(CODEC_ID_MPEG4); //cannot build h264
says not found :(*
*
*
* if(video_codec == 0)*
* LOGI(5,"Could not find video encoder...");*
*
*
* LOGI(5,"2...");*
*
*
* /* add a video output stream */*
* video_st = avformat_new_stream(oc, video_codec);*
*
*
* video_c = avcodec_alloc_context3(video_codec);*
*
*
* video_c = video_st->codec;*
* video_c->codec_id = video_codec->id;*
* video_c->codec_type = AVMEDIA_TYPE_VIDEO;*
*
*
* /* put sample parameters */*
* video_c->bit_rate = 400000;*
*
*
* /* resolution must be a multiple of two, but round up to 16 as often
required */*
* video_c->width = 352;*
* video_c->height = 288;*
*
*
* /* time base: this is the fundamental unit of time (in seconds) in terms*
*               of which frame timestamps are represented. for fixed-fps
content,*
*               timebase should be 1/framerate and timestamp increments
should be*
*               identically 1. */*
* video_c->time_base= (AVRational){1,25};*
* video_c->gop_size = 10; /* emit one intra frame every twelve frames at
most */*
* video_c->max_b_frames=1;*
* video_c->pix_fmt = PIX_FMT_YUV420P;*
*
*
* if(video_c->codec_id == CODEC_ID_H264)*
* av_opt_set(video_c->priv_data, "preset", "slow", 0);*
*
*
* LOGI(5,"3...");*

* if (avcodec_open2(video_c, video_codec, NULL) < 0) {*
* LOGI(5,"Could not open video codec");*
* }*
* LOGI(5,"4...");*
*
*
* /* allocate the encoded raw picture */*
* picture = avcodec_alloc_frame();*
* picture->pts = 0;*
*
*
* int size = avpicture_get_size(video_c->pix_fmt, video_c->width,
video_c->height);*
*
*
* tmp_picture = avcodec_alloc_frame();*
*
*
* av_dump_format(oc, 0, server, 1);*
*
*
* int ret = 0;*
* if ((ret = avio_check(server, AVIO_FLAG_WRITE)) < 0)*
* {*
* LOGI(5,"Could not open server'%d'...'%s'",ret,server);*
* }*
* else{*
*
*
* /* open the output file, if needed */*
* if (!(oformat->flags & AVFMT_NOFILE)) {*
* if (avio_open(&oc->pb, server, AVIO_FLAG_WRITE) < 0) {*
* LOGI(5,"Could not open server...'%s'",server);*
* }*
* }*
* }*
*
*
* /* write the stream header, if any */*
* avformat_write_header(oc, 0);*

It gives me an error on the avio_open function... The server is a Wowza
Media Server and the IP address is correct and the server is waiting for
new connections. I also have the Internet permission on Android Manifest.

Best Regards and thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120901/a52f6ca6/attachment.html>


More information about the Libav-user mailing list