Luca,
Thanks for your help offer. What's really maddening about this problem is
that the command line ffmpeg works, i.e. I can receive MPEG 2 TS data and
save it to a file. But the API open file call hangs.

The UDP address I'm using is behind a firewall so I cannot easily make that
accessible. However, if you have VLC, you can start a UDP stream with
vlc -vvv <video filename to broadcast> --sout <UDP address to broadcast>
-ttl 12

The code is below.

Thanks,

C

#include <stdlib.h>
#include <stdio.h>

#include <libavformat/avio.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>

int main( int argc, char* argv[] )
{
    AVFormatContext *pFormatCtx;
    char* input_filename = "udp://225.1.1.14:5014";
    int i, videoStream;
    AVCodecContext *pCodecCtx;

    // Initialize the library by registering all file formats and codecs so
    // they can be used automatically.
    av_register_all();
    printf("Registered file formats and codecs\n");

    /*
     * Getting ready to read the input.
     */
    // Open the video file. The last three arguments to open() are file
format,
    // buffer size, and format options, we let libavformat to select these.
    printf("Input name: %s\n", argv[1]);
    if( av_open_input_file(&pFormatCtx, argv[1], NULL, 0, NULL) != 0 ) {
        fprintf(stderr, "could not open input: %s!\n", argv[1]);
        return -1;
    }

    printf("opened input\n");

    // Get stream information and dump it
    if( av_find_stream_info(pFormatCtx) < 0 ) {
        fprintf(stderr, "could not find stream information\n");
        return -1;
    }
    dump_format(pFormatCtx, 0, input_filename, 0 );

On Sat, Jun 20, 2009 at 6:36 AM, Luca Abeni <[email protected]> wrote:

> Hi,
>
> Cuneyt Taskiran wrote:
>
>> I am trying to read Multicast MPEG-2 TS data from the URI udp://
>> 225.1.1.14:5014. I can display the video from this URI using VLC.
>>
> [...]
>
>> However, when I try to open the same URI from my program,
>> av_open_input_file() hangs with no error messages. Here's what I have:
>>    av_register_all();
>>    printf("Input name: %s\n", input_filename);
>>    if( av_open_input_file(&pFormatCtx, input_filename, NULL, 0, NULL) != 0
>> ) {
>>        fprintf(stderr, "could not open input: %s!\n", input_filename);
>>        return -1;
>>    }
>>
>> I can't see what can be wrong with the code. Should I be using
>> av_open_input_stream() instead?
>>
>
> If you provide an easy way to reproduce the problem you are seeing (sample
> code that compiles, and a URL that does not work - or a way to generate a
> network stream that does not work), I'll try to have a look at this problem.
>
>
>                                Luca
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to