<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Am 30.05.2012 04:07, schrieb Kalileo:
    <blockquote
      cite="mid:DAC3C97B-0CB7-4101-B9FD-4350D4AD56C7@universalx.net"
      type="cite">
      <pre wrap="">
On May 29, 2012, at 20:26 , Christian Brümmer wrote:

</pre>
      <blockquote type="cite">
        <pre wrap="">"Cant be that hard - or? "

Okay now im pretty sure it is:

I read AVCodecContex.extradata contains the informations i need. For decoding i used that code -> <a class="moz-txt-link-freetext" href="http://cgit.lscube.org/cgit.cgi/feng/tree/src/media/parser/h264.c#n218">http://cgit.lscube.org/cgit.cgi/feng/tree/src/media/parser/h264.c#n218</a> - in a slightly modified way (replaced glib functions with e.g. libavs base64.h). Finally the decoding stuff is running - BUT...

my AVCodecContext.extradata_size == 0 <- what the heck?!? So no data for decoding and really no idea left how to get those informations.... WHAA!

I make desperate efforts but i cant get into that...

At least i need another hint. Im not asking for complete solution - its enough to know roughly the right way!
</pre>
      </blockquote>
      <pre wrap="">
>From what I think I understood extradata contains what you expect when your source is a video format with a global header. 

What's the source format you use for your tests?


_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>

</pre>
    </blockquote>
    I create dummy images (should be replaced later on) and encoding
    them to x264 frames. Further i stream those images via rtsp which is
    working on VLC but not on android and i thinks its a stream
    configuration problem.<br>
    <br>
    When should extradata be filled? In my text a dont encode a frame
    before i try to get the sps pps infos out of extradata. I may have
    to call a special function or encode a frame or header before?<br>
    <br>
    So my source format is:<br>
    <br>
    <small><small>    codec = avcodec_find_encoder(c->codec_id);<br>
            if(!codec)<br>
            {<br>
                std::cout << "Codec not found." <<
        std::endl;<br>
                std::cin.get();std::cin.get();exit(1);<br>
            }<br>
        <br>
            <b>if(avcodec_get_context_defaults3 (c, codec) < 0) //
          cause i dont know a working x264 configuration without
          deprecated flags </b><br>
            {<br>
                std::cout << "Cannot get default codec context!
        \n" << std::endl;<br>
                std::cin.get();<br>
                exit(1);<br>
            }</small></small><br>
    <br>
    and<br>
    <br>
    <small><small>    codec = stream->codec;<br>
            codec->codec_id = codecID;<br>
            codec->codec_type = AVMEDIA_TYPE_VIDEO;<br>
            codec->bit_rate = mParameters.mBitRate;<br>
            codec->width = mParameters.mWidth;<br>
            codec->height = mParameters.mHeight;<br>
            codec->time_base.den = mParameters.mFrameRate;<br>
            codec->time_base.num = 1;<br>
            codec->gop_size = mParameters.mFrameRate; <br>
            codec->pix_fmt = PIXEL_FORMAT;<br>
            codec->b_frame_strategy = 0;<br>
            codec->level = 12;<br>
            if(codec->codec_id == CODEC_ID_MPEG2VIDEO)<br>
                codec->max_b_frames = 2; // for testing, B frames<br>
        <br>
            if(codec->codec_id == CODEC_ID_MPEG1VIDEO)<br>
                codec->mb_decision = 2;<br>
        <br>
            if(context->oformat->flags & AVFMT_GLOBALHEADER)<br>
                codec->flags |= CODEC_FLAG_GLOBAL_HEADER;</small></small><br>
    <br>
    where mParamters are:<br>
    <br>
    <small><small>  imLiveStreamParameters param;<br>
          param.mBitRate = 4000;<br>
          param.mCodec = "x264";<br>
          param.mFrameRate = 24;<br>
          param.mHeight = 240;<br>
          param.mWidth = 320;</small></small><br>
    <br>
    Thank you for your reply!<br>
    <br>
  </body>
</html>