[FFmpeg-devel] [PATCH] mp4toannexb modification / improvement

Michael Niedermayer michaelni
Tue Jun 8 01:42:13 CEST 2010


On Mon, Jun 07, 2010 at 10:08:48AM +0200, Luca Abeni wrote:
> On 06/04/2010 03:58 PM, Luca Abeni wrote:
>> On 04/06/10 15:48, Michael Niedermayer wrote:
>>> On Fri, Jun 04, 2010 at 01:34:06PM +0200, Luca Abeni wrote:
>>> [...]
>>>> Which kind of solution do you prefer? Changing line 2171 in something
>>>> that allocates memory for the "output extradata", and copies the input
>>>> extradata in this new buffer?
>>>
>>> yes
>>
>> Ok, good. I'll work on that patch during the weekend, and I'll probably
>> post it on Monday.
>
> So, here are some patches:
> copy_extradata_3.diff modifies ffmpeg.c to copy the extradata from the
>                       input codec to the output codec (instead of just
>                       copying a pointer to the extradata), as suggested
>                       above
> improve_mp4toannexb_2.diff modifies the mp4toannexb BSF to convert the
>                            extradata. The previous patch is needed,
>                            otherwise there are problems with "-vcodec copy"
>                            (see previous email)
> use_bsf_for_sdp.diff uses the previous mp4toannexb BSF improvement to
>                      correctly print the SPS and PPS in the SDP, even when
>                      the bitstream is in "AVC" syntax
>
>
[...]

>  ffmpeg.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 2e0ec35d443d49e150d89ed25889353dabdf93dd  copy_extradata_3.diff
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 23512)
> +++ ffmpeg.c	(working copy)
> @@ -2168,7 +2168,10 @@
>              }
>  
>              codec->bit_rate = icodec->bit_rate;
> -            codec->extradata= icodec->extradata;
> +            codec->extradata= av_malloc(icodec->extradata_size);

missing padding


> +            if (!codec->extradata)
> +                goto fail;
> +            memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
>              codec->extradata_size= icodec->extradata_size;
>              if(av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/1000){
>                  codec->time_base = icodec->time_base;
> @@ -2682,6 +2685,8 @@
>          for(i=0;i<nb_ostreams;i++) {
>              ost = ost_table[i];
>              if (ost) {
> +                if (ost->st->stream_copy)
> +                    av_free(ost->st->codec->extradata);

av_freep()

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100608/83ec44c9/attachment.pgp>



More information about the ffmpeg-devel mailing list