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

Gerion Entrup gerion.entrup.ffuse at flump.de
Tue Jul 23 23:08:52 EEST 2019

Am Dienstag, 23. Juli 2019, 15:14:05 CEST schrieb Gerion Entrup:
> 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

Ok, this seems not to be possible. mpeg matches the streams with its id that I don't know beforehand. I have workarounded this now.
-------------- 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/0465ef3d/attachment.sig>

More information about the ffmpeg-user mailing list