[Libav-user] avio raw yuv

Anthony Clark clarka193 at potsdam.edu
Fri Sep 12 00:52:27 CEST 2014

> On September 12, 2014 2:46:49 AM IST, Anthony Clark
> <clarka193 at potsdam.edu> wrote:
>>Hey all,
>>I have a YUV file I created with something like `ffmpeg -i video.mp4
>>rawvideo -pix_fmt yuv420p out.yuv`. I want to use libav* to retrieve
>>frames from this raw file. Any clues? So far I just create an
>>`av_file_map` and get the data that way - it's a little primitive. Does
>>YUV have a demuxer? Decoder? I couldn't find anything in 2.2.4's source
>>but maybe I looked at the wrong things.
>>Oh, I should note that using the `avio_reading.c` example in 2.2.x
>>on `avformat_open_input` - telling me YUV/raw is a little special. Any
>>help is greatly appreciated!
>>Libav-user mailing list
>>Libav-user at ffmpeg.org
> You need to specify size through avoptions

I think I know what you mean. So, I made these modification to
`avio_reading.c` ...

105:AVInputFormat * input = av_find_input_format("rawvideo");
    AVDictionary * opts;
    av_dict_set(&opts, "video_size", "352x288", 0);

    ret = avformat_open_input(&fmt_ctx, NULL, input, &opts);
    if (ret < 0) {
        fprintf(stderr, "Could not open input\n");
        goto end;

It no longer fails via avformat_open_input. BUT, the file mapping is weird
and I only get 2 really large (as large as my file) sized buffers. I tried
to use various `av_opt_set` routines to set the AVOptions for the rawvideo
decoder, but everything looks "private"... maybe I'm missing something.
Any advice is appreciated. Thanks again for the reply

> -Anshul

More information about the Libav-user mailing list