I have an libavcodec/format based application to write video data to an
output file. This is working nicely; however, I'd also like to be able
to put additional data packets (containing e.g., 3D position data) into
the output stream using CODEC_TYPE_DATA. I suppose normal players would
ignore these packets, while a specially adapted decoder could get the
data back out. I've done some experiments with AVI files, and the AVI
file does indeed get a 'dats' chunk in the header.. but my data doesn't
show up anywhere in the file.
I suppose the problem is that I don't have the correct codec. I tried
CODEC_ID_RAWVIDEO (probably a dumb idea), but I couldn't find anything
else that would fit. Can somebody please give me a hint on how to embed
non-AV data in the final stream?
0666 - Filemode of the Beast
PATCH: Re: Encoding additional data (non-AV) in stream?
> I suppose the problem is that I don't have the correct codec. I tried
> CODEC_ID_RAWVIDEO (probably a dumb idea), but I couldn't find anything
> else that would fit. Can somebody please give me a hint on how to embed
> non-AV data in the final stream?
Replying to myself again.. as it seems, CODEC_ID_RAWVIDEO wasn't such a
dumb idea after all. I've managed to embed my data frames in the AVI
file successfully, 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: