Hi,
I try to add a data stream in a .mkv or a .asf container.
So far i managed to encode two H264 video stream in a mkv file, but i can't
add a third data stream.

Here is the way iam doing :

AVStream *st;
st = av_new_stream(oc, 2);
if (!st) {
        fprintf(stderr, "Could not alloc stream\n");
        exit(1);
    }

st->codec->codec_type =CODEC_TYPE_DATA;
st->codec->codec_id = CODEC_ID_TEXT;

AVCodec *codec;
AVCodecContext *c;

c = st->codec;
codec = avcodec_find_encoder(c->codec_id);

    if (!codec) {
       fprintf(stderr, "codec not found\n");
       // exit(1);
   }

   if (avcodec_open(c, codec) < 0) {
      fprintf(stderr, "could not open codec\n");
      //exit(1);
   }

and then I create my packet with some data in it and av_write_frame() them.

The thing is that avcodec_find_encoder returns NULL in all the following
cases:
st->codec->codec_id = CODEC_ID_TEXT;
st->codec->codec_id = CODEC_ID_PROBE;
st->codec->codec_id = CODEC_ID_TTF;
st->codec->codec_id = CODEC_ID_MPEG2TS;

So not header are created for the data stream and i can't read either data
or video when decoding:
[asf @ 0x9817bf0] Codec for stream 2 does not use global headers but
container format requires global headers
same message when using matroska.

Why are the codec ID not reconized ?
Am I using the right way to create a data stream?


Thanks
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to