Yes you are right.

I am connecting to a server sending Mpeg4 video frames and mp2 audio.

I am trying to define if my video is ok before the creation of the avi
output file.

So the video data should contain what I think is my encoded mpeg4 video
frame and I believe I access this from my packet pointer AVPacket * pkt as
pkt->data with its size pkt->size.

The frames are obtained thrugh the api call av_read_frame(inputContext,
&pkt)

And the packet I am trying to dump is obtained from

      memset(opkt, 0, sizeof(AVPacket));

      av_init_packet(opkt);

      /* no reencoding needed : output the packet directly */
      if (ost->st->codec->codec_type == CODEC_TYPE_AUDIO)
          audio_size += pkt->size;
      else if (ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
          video_size += pkt->size;
      else
      {
        send_log(USER, ERROR, "unknown codec type %d ",
ost->st->codec->codec_type );
    //write_log_t2("unknown codec type",__LINE__,__FILE__);
        return -1;
      }

      opkt->stream_index = ost->index;

      if (pkt->pts != (unsigned int)AV_NOPTS_VALUE)
      {
          opkt->pts = av_rescale_q(av_rescale_q(pkt->pts, ist_time_base,
AV_TIME_BASE_Q) + ts_offset, AV_TIME_BASE_Q, ost->st->time_base);
          dts       = av_rescale_q(pkt->dts, ist_time_base, AV_TIME_BASE_Q);
      }
      else
      {
          opkt->pts= AV_NOPTS_VALUE;
          dts = 0;
      }

      opkt->dts   = av_rescale_q(dts + ts_offset, AV_TIME_BASE_Q,
ost->st->time_base);
      opkt->flags = pkt->flags;
      opkt->data  = pkt->data;
      opkt->size  = pkt->size;

      // Write frame
      ret = av_interleaved_write_frame(outputContext, opkt);

 so basically the content of opkt->data is what I assume is the mpeg4
encoded video frame.

Hope this clarifies my question.

And thanks for your answer.

On Thu, May 7, 2009 at 6:40 PM, Mark Heath <[email protected]> wrote:

>
> On 08/05/2009, at 7:51 AM, Alejandro Oyarbide wrote:
>
>>
>> I based on the structure above and the packets I passed to
>> av_interleaved_write_frame were copied considering size and data assuming
>> this was pure VIDEO info.
>>
>> But aparently this is not the case.
>>
>> My question is how to get the VIDEO raw data from a particular AVPacket.
>>
>
> I think your question is unclear.
>
> What do you mean by raw VIDEO data? Do you mean?
>
> Uncompressed frame image.
> Compressed Packet data.
> Meta data, such as display time stamp, dimensions, frame rate, interlaced
> etc.
>
> Let us know so we can help further.
> Mark
> _______________________________________________
> 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