<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Am 30.05.2012 12:44, schrieb Christian Brümmer:
<blockquote cite="mid:4FC5FA06.8000209@gmx.de" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
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 moz-do-not-send="true" 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 moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a moz-do-not-send="true" 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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
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 figured out that if i add c->flags |=
CODEC_FLAG_GLOBAL_HEADER; for my video codec configuration
AVCodecContext.extradata.size is bigger than 0. <br>
Whats a reason for dont using global headers?<br>
<br>
Further i tried the av_sdp_create function again and now i get a
string containing "sprop-parameter-sets". My rtsp server accept the
sdp string but the vlc cant play my stream. But i will ask the
live555 mailing list for that!<br>
<br>
Are there other aspects i have to consider using global header with
x264 encoding (other configurations)?<br>
</body>
</html>