[Libav-user] avio raw yuv
Anthony Clark
clarka193 at potsdam.edu
Fri Sep 12 01:47:38 CEST 2014
> On September 12, 2014 4:22:27 AM IST, Anthony Clark
> <clarka193 at potsdam.edu> wrote:
>>> 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
>>>>-c:v
>>>>rawvideo -pix_fmt yuv420p out.yuv`. I want to use libav* to retrieve
>>>>video
>>>>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
>>>>fails
>>>>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
>>>>http://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>> You need to specify size through avoptions
>>
>>
>>I think I know what you mean. So, I made these modification to
>>`avio_reading.c` ...
>>
>>
>>104:
>>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 think you should try looking deeper here, why does it fail, what makes
> decoder give u whole file.
> May be using gdb u can find out.
>
You're right. I'll compile some debug libs and check it out. Also, you
mentioned AVOptions and I used AVDictionary. I can successfully set
"video_size" via the first snippet I sent, but can't do the following:
105 ret = avformat_open_input(&fmt_ctx, NULL, NULL, NULL);
106 if (ret < 0) {
107 fprintf(stderr, "Could not open input\n");
108 goto end;
109 }
110 ret = av_opt_set_image_size(fmt_ctx, "video_size", 352, 288,
AV_OPT_SEARCH_CHILDREN);
111
112 //// Or this?
113 //// --------
114 //// Docs for AV_OPT_TYPE_IMAGE_SIZE say i need some contiguous
ints...
115 ////const int size[] = {352, 288};
116 ////ret = av_opt_set_int_list(fmt_ctx, "video_size", size, 0,
AV_OPT_SEARCH_CHILDREN
I thought the second (^ this) version would be preferred, but I see the
following error(s):
ptr:0x7fc37f891000 size:152064000
[IMGUTILS @ 0x7ffff52b9bb0] Picture size 0x0 is invalid
[IMGUTILS @ 0x7ffff52b9730] Picture size 0x0 is invalid
[IMGUTILS @ 0x7ffff52b9770] Picture size 0x0 is invalid
[rawvideo @ 0x1ef5720] Could not find codec parameters for stream 0
(Video: rawvideo (I420 / 0x30323449), yuv420p, -4 kb/s): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
I just don't know what the correct one to use is - Setting the
AVFormatContext options via AVDict, or injecting options via AVOptions.
Very unclear.
Thanks!
>
>
>>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
>>
>>
>>_______________________________________________
>>Libav-user mailing list
>>Libav-user at ffmpeg.org
>>http://ffmpeg.org/mailman/listinfo/libav-user
>
>
More information about the Libav-user
mailing list