On Mon, Jul 18, 2022 at 05:08:31PM +0100, facefunk wrote: > We are not currently able to force mov_text subtitles by setting > -disposition:s:0 +forced or equivalent. By setting the forced flags in > movtextenc as specifid in > https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html > subtitles can be forced as expected in VLC and similar players. > > Copy AVStream disposition to AVCodecContext and use to set > DISPLAY_FLAG_ALL_SAMPLES_FORCED in movtextenc.c. > > Signed-off-by: facefunk <[email protected]> > --- > fftools/ffmpeg_opt.c | 5 +++++ > libavcodec/avcodec.h | 16 ++++++++++++++++ > libavcodec/movtextenc.c | 41 ++++++++++++++++++++++++++++++++++++++++- > 3 files changed, 61 insertions(+), 1 deletion(-) > > diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c > index e08455478f..d8ea1d4bc1 100644 > --- a/fftools/ffmpeg_opt.c > +++ b/fftools/ffmpeg_opt.c > @@ -2244,6 +2244,11 @@ static int set_dispositions(OutputFile *of, > AVFormatContext *ctx) > > if (ret < 0) > return ret; > + > + // For output streams, copy stream disposition to the > AVCodecContext > + // object. > + if(ost->enc_ctx) > + ost->enc_ctx->stream_disposition = ost->st->disposition; > } > } else { > // For each media type with more than one stream, find a suitable > stream to
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index cb5c25bf63..eb11de0293 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -37,6 +37,8 @@
> #include "libavutil/pixfmt.h"
> #include "libavutil/rational.h"
>
> +#include "libavformat/avformat.h"
libavcodec should not depend on libavformat
> +
> #include "codec.h"
> #include "codec_desc.h"
> #include "codec_par.h"
> @@ -2054,6 +2056,20 @@ typedef struct AVCodecContext {
> * The decoder can then override during decoding as needed.
> */
> AVChannelLayout ch_layout;
> +
> + /**
> + * Stream disposition - a combination of AV_DISPOSITION_* flags from
> + * libavformat.
> + *
> + * Copied from the relevant AVStream object for codecs that need access
> to
> + * the stream disposition parameter, such as movtextenc.c which needs to
> + * read the AV_DISPOSITION_FORCED flag so it knows when to set forced
> + * subtitles.
> + *
> + * - encoding: Set by set_dispositions in ffmpeg_opt.c.
ffmpeg is one application that uses libavcodec.
libavcodec API should not really talk about ffmpeg doing this or that, thats
kind of odd
also, your patches dont contain a full name, thats ok if thats what you want
but if you want your full name in git then you may want to correct that
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
"I am not trying to be anyone's saviour, I'm trying to think about the
future and not be sad" - Elon Musk
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
