[Libav-user] Getting a Frame question

M N assemblerx86 at yandex.com
Mon Sep 5 05:01:24 EEST 2016


That was my question, how can I read a frame from a specific stream? And what does av_read_frame really reads?

05.09.2016, 04:01, "Christopher Snowhill" <kode54 at gmail.com>:
> On 9/4/16 5:27 PM, Charles wrote:
>>  On 09/04/2016 10:52 AM, M N wrote:
>>>  Gonzalo then how should I continue to read packets from input format
>>>  context and write them to output format context?
>>>
>>>  04.09.2016, 05:14, "Charles" <linux2 at orion15.org>:
>>>>  On 09/03/2016 08:34 PM, Gonzalo Garramuño wrote:
>>>>>   El 03/09/2016 a las 17:55, M J escribió:
>>>>>>   Hi
>>
>>  MJ,
>>  I probably wasn't clear, each call is dependent on the return value of
>>  the previous call.
>>  i.e. if you did not get return 0 or EAGIN from send_packet you should
>>  probably not call receive_frame
>>
>>>>>>   while(av_read_frame(input_ctx, pkts) == 0)
>>>>>>   {
>>>>>>            //decoding
>>>>>>            int ret1 = avcodec_send_packet(input_codecCtx, pkts);
>>>>>>            int ret2 = avcodec_receive_frame(input_codecCtx, rawFrame);
>>
>>  Why don't you just print the return values. SEE av_strerror
>>  https://ffmpeg.org/doxygen/3.1/group__lavu__error.html#ga5792b4a2d18d7d9cb0efbcfc335dce24
>>
>>>>>>            //encoding
>>>>>>            avcodec_send_frame(output_codecCtx, rawFrame);
>>>>>>            avcodec_receive_packet(output_codecCtx, pktr);
>>
>>  These have return values also.
>>
>>>>>>            int ret = av_interleaved_write_frame(output_ctx, pktr);
>>>>>>   }
>>>>>>   *************************************************
>>>>>   Hi, MJ.
>>
>>  Assuming everything is setup correctly, and 1 frame -> 1 packet && 1
>>  packet -> 1 frame
>>
>>  while ( av_read_frame == 0 )
>>     if avcodec_send_packet == 0
>>        if avcodec_receive_frame == 0
>>           if avcodec_send_frame == 0
>>              if avcodec_receive_packet == 0
>>                 av_interleaved_write_frame
>>
>>  But, each of those IF's have multiple return values
>>  What are you going to do if the return is AVERROR(EAGAIN) or AVERROR_EOF
>>  What about the frame delay on the encoder?
>>
>>  Thanks
>>  cco
>
> Don't forget, maybe he's parsing an interleaved stream, and isn't paying
> attention to which stream each packet belongs to.
>>  _______________________________________________
>>  Libav-user mailing list
>>  Libav-user at ffmpeg.org
>>  http://ffmpeg.org/mailman/listinfo/libav-user
>
> ,
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user


More information about the Libav-user mailing list