[FFmpeg-user] API question, mpeg: assign later coming streams to preallocated AVStreams

Gerion Entrup gerion.entrup.ffuse at flump.de
Tue Jul 23 16:14:05 EEST 2019


Hi,

I have an mpeg stream where the probing does not find one (vobsub subtitle) stream because it appears to late.
However, I know that such a stream exists.

Currently, given my input AVFormatContext, I try to create a new subtitle stream with:
```
AVFormatContext* ifmt_ctx = ...;
AVStream* stream = avformat_new_stream(ifmt_ctx, NULL);

stream->codecpar->codec_id = AV_CODEC_ID_DVD_SUBTITLE;
stream->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
```

However, when I then read packets from the stream with av_read_frame() and the subtitle stream appears, it is not assigned to my newly created stream, but to another new one.

Is there a way to preallocate the subtitle stream (before any call to av_read_frame() but in a way, that av_read_frame assigns the packet to exactly this manually created stream?

Thanks
Gerion
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part.
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20190723/526a7e3a/attachment.sig>


More information about the ffmpeg-user mailing list