[Libav-user] [NEWSLETTER] help

Carlos Esponda esponda.carlos9 at gmail.com
Fri Jul 31 17:11:05 EEST 2020


I took out my IP address just for anonymity. (I’m new to networking and not
sure if it mattered) however I confirm my url works by testing it with
VLC.  The error I always get is “immediate exit requested”

On Fri, Jul 31, 2020 at 8:34 AM Mihai Chindea <mihai.chindea at uti.eu.com>
wrote:

> i think your problem is the url you are passing to "avformat_open_input",
> RTSP runs on top of TCP, i doubt it works without a valid hostname/ip
> address.
>
>
> Mihai,
>
>
> ------------------------------
> *From:* Libav-user <libav-user-bounces at ffmpeg.org> on behalf of Carlos
> Esponda <esponda.carlos9 at gmail.com>
> *Sent:* Friday, July 31, 2020 2:25 AM
> *To:* libav-user at ffmpeg.org
> *Subject:* [NEWSLETTER] [Libav-user] help
>
> I am currently trying to read an RTSP stream with FFMPEG and can't get
> past avformat_open_input.
>
> Any help would be appreciated!
>
> thank you.
>
>   #include <iostream>
>
> extern "C"
> {
> #include <libavformat/avformat.h>
> #include <libavcodec/avcodec.h>
> #include <libavcodec/codec.h>
> #include "libswscale/swscale.h"
> #include "libavutil/avutil.h"
> #include "libavutil/frame.h"
> #include "libavcodec/codec_id.h"
> #include "libavutil/pixfmt.h"
> #include "libavutil/imgutils.h"
> }
>
>
> int decode_interrupt(void*);
>
> int main()
> {
>     AVFrame* frame = NULL;
>     AVFormatContext* formatc = NULL;
>     const AVIOInterruptCB int_cb = { decode_interrupt, NULL };
>     AVCodec* codec = NULL;
>     AVCodecContext* codecc = NULL;
>     char* error = new char[255];
>
>     if (!(frame = av_frame_alloc())) {
>         std::cout << " failed to alloc frame";
>         return -1;
>     }
>     formatc = avformat_alloc_context();
>     formatc->interrupt_callback = int_cb;
>
>     codec = avcodec_find_decoder(AV_CODEC_ID_H264);
>     codecc = avcodec_alloc_context3(codec);
>     int result = avcodec_open2(codecc, codec, NULL);
>     if (result != 0) {
>         std::cout << "failed to open codec";
>     }
>
>     result = avformat_open_input(&formatc, "rtsp://:8554/testStream",
> NULL, NULL);
>     if (result != 0) {
>         av_strerror(result, error, 255);
>         std::cout << "couldnt open input " << error<< std::endl;
>         avformat_close_input(&formatc);
>         return -1;
>     }
>
>     result = avformat_find_stream_info(formatc, NULL);
>     if (result != 0) {
>         std::cout << "could not find stream information\n";
>         return -1;
>     }
>
>     return 0;
> }
>
> int decode_interrupt(void * ctx) {
>     std::cout << "interupted\n";
>     return -1;
> }
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200731/b9f5eeb6/attachment.html>


More information about the Libav-user mailing list