[PATCH] Re: [Ffmpeg-devel] Theora encoding

Michael Niedermayer michaelni
Tue Feb 13 21:45:12 CET 2007


Hi

On Tue, Feb 13, 2007 at 05:16:34PM +0100, j at v2v.cc wrote:
> Hi,
> 
> On Feb 12, 2007, at 14:50:23, Junix wrote:
> >ffmpeg -vd /dev/video0 -ad /dev/dsp -r 25 -s 720x576 -b 768000 -ab  
> >32 -ar 32000 -f ogg -vcodec theora -acodec vorbis -ac 2 -map 0.0 - 
> >map 1.0 -y koe.ogg
> currently ffmpeg's ogg muxer can not handle the video encoded by its  
> theora encoder. attached patch fixes that partially. the generated  
> ogg files are
> still not muxed in the right way but play with most players.
> (oggz-validate / Packet out of order)
> 
> the patch also reproduces TheoraContext from libtheoraenc.c in ogg.c,
> what would be the right place to put a struc that is needed in  
> libavcodec and libavformat?
> 
> j
> 

> Index: libavcodec/libtheoraenc.c
> ===================================================================
> --- libavcodec/libtheoraenc.c	(revision 7963)
> +++ libavcodec/libtheoraenc.c	(working copy)
> @@ -37,8 +37,10 @@
>  /* libtheora includes */
>  #include <theora/theora.h>
>  
> +// This is also defined in libavformat/ogg.c  keep in sync
>  typedef struct TheoraContext{
>      theora_state t_state;
> +    ogg_int64_t granulepos;
>  } TheoraContext;
>  
>  /*!
> @@ -235,6 +237,7 @@
>          return -1;
>      }
>      memcpy(outbuf, o_packet.packet, o_packet.bytes);
> +    h->granulepos = o_packet.granulepos;
>  
>      return o_packet.bytes;
>  }
> Index: libavformat/ogg.c
> ===================================================================
> --- libavformat/ogg.c	(revision 7963)
> +++ libavformat/ogg.c	(working copy)
> @@ -28,6 +28,15 @@
>  
>  #include "avformat.h"
>  
> +#if CONFIG_LIBTHEORA_ENCODER
> +#include <theora/theora.h>
> +
> +typedef struct TheoraContext{
> +    theora_state t_state;
> +    ogg_int64_t granulepos;
> +} TheoraContext;
> +#endif
[...]
> +      h = avctx->priv_data;

this is unaccpetable, the muxer cannot just acces private variables of the
encoder, note i didnt review the remainder

also the #include <theora/theora.h> is totally unaccpetable in a (de)muxer

i strongly suggest that you write a native ogg muxer (see ogg2.c) as
ogg.c will be removed as soon as a native muxer exists, even if it doesnt
support theora so any work done in the direction of libogg support is
likely wasted

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070213/b9a86735/attachment.pgp>



More information about the ffmpeg-devel mailing list