[FFmpeg-devel] PATCH: Re: [libav-user] Encoding additional data (non-AV) in stream?

Florian Echtler floe
Tue Jun 10 09:46:40 CEST 2008

Hello everybody,

I've posted this on libav-user already, but somebody told me that it
might be more suited here..

What I'm trying to do is to embed an additional data stream in an AVI
file. I've managed to embed my data frames in the AVI file successfully
using CODEC_ID_DATA, however, now I have problems with decoding them
again. I noted that while avienc.c is able to correctly generate a
'dats' header, avidec.c is not able to read them again and fails.

I think it's a bit odd that one part of ffmpeg can write files that the
other part can't read anymore, so here's a tiny patch which at least
allows the stream to be read:

--- avidec.old	2008-06-09 09:06:01.000000000 +0200
+++ avidec.c	2008-06-09 09:06:34.000000000 +0200
@@ -411,6 +411,9 @@
                 codec_type = CODEC_TYPE_DATA; //CODEC_TYPE_SUB ?  FIXME
+            case MKTAG('d', 'a', 't', 's'):
+                codec_type = CODEC_TYPE_DATA;
+                break;
                 av_log(s, AV_LOG_ERROR, "unknown stream type %X\n",
                 goto fail;

In case the whitespace gets messed up, I have also attached the patch
as a file. With this patch, I can take the widely-used avcodec_sample
tool and get my data frames back. Please tell me what you think - is
this the right way to go?

On a different topic: I still have some problems understanding how to
handle the pts values.. do I have to generate them? How? Can somebody
point me to a more detailed description? Reason: I'd like to get the
data frames back with the same relative timestamps..

Thanks again, Yours, Florian
0666 - Filemode of the Beast
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avidec.patch
Type: text/x-patch
Size: 484 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080610/081cdea8/attachment.bin>

More information about the ffmpeg-devel mailing list