[Libav-user] Encoding subtitles

Jan Brehmer Jan.Brehmer at dai-labor.de
Wed Nov 16 16:03:21 EET 2016


Hey there!


I am trying to encode a subtitle stream.

?

Currently I am able to serve a HTTP stream in mpegts, fragmented mp4 or webm format with a video stream encoded by H.264 or VP8/VP9 respectively.


For subtitle encoding, I get an encoder like this:


subtitle_codec = avcodec_find_encoder(format_context->oformat->subtitle_codec);

or

subtitle_codec = avcodec_find_encoder("mov_text");


This works.


I create a new stream:


subtitle_stream = avformat_new_stream(format_context, subtitle_codec);


This works, too.


I open the codec:


avcodec_open2(subtitle_stream->codec, subtitle_codec, NULL);


This returns error code -1094995529?, which means AVERROR_INVALIDDATA?.


I tried loading some default values and setting the codec id before opening the codec:


avcodec_get_context_defaults3(subtitle_stream->codec, subtitle_codec);

subtitle_stream->codec->codec_id = subtitle_codec->id;


Still getting AVERROR_INVALIDDATA.


What am I doing wrong?

Is there any example code on this? Documentation? Ideas?


Thank you.

Jan



More information about the Libav-user mailing list