[FFmpeg-user] -forced-subs-only not working, bug in pgssubdec.c?

Oliver Fromme oliver at fromme.com
Fri May 16 11:28:20 CEST 2014


Hi,

A few weeks ago I asked how -forced-subs-only is supposed to
work, and that I was unable to get it to work.  There were
no replies, so I continued experimenting, but without success.
Finally I started looking at the source code, too.  :-)

This is the section from libavcodec/pgssubdec.c lines 445 ff.
that seems to cause the problem:

        /* Copy the forced flag */
        sub->rects[rect]->flags = (ctx->presentation.objects[rect].composition & 0x40) != 0 ? AV_SUBTITLE_FLAG_FORCED : 0;

        if (!ctx->forced_subs_only || ctx->presentation.objects[rect].composition & 0x40)
        memcpy(sub->rects[rect]->pict.data[1], ctx->clut, sub->rects[rect]->nb_colors * sizeof(uint32_t));

I think there is a bug, but I'm not 100% sure, so I didn't
open a ticket yet.  It looks like the "if" command is missing
the conditional command.  The memcpy command is not indented,
so this is probably not meant to be the conditional command.
Also, the memcpy line seems unrelated to the forced flag
because it just copies the clut (color look-up table).

Consequently, the -forced-subs-only option is not working for
PGS subtitles.

Can anybody reproduce and confirm this?

By the way, I also looked if the AV_SUBTITLE_FLAG_FORCED flag
is used anywhere in the ffmpeg sources.  It can be set both by
the pgssub decoder and the dvdsub decoder, but it isn't used
anywhere.  Wouldn't it make sense to make an option (it could
be called -forced-subs-only) that is *not* a decoder-specific
option, but it would work with any decoder that sets the
AV_SUBTITLE_FLAG_FORCED flag?  So, if you specify that option,
ffmpeg would throw away (ignore) all subtitles that have the
AV_SUBTITLE_FLAG_FORCED flag set.  Unfortunately I'm not
familiar enough with the source code to implement that myself.

Best regards
   Oliver

-- 


More information about the ffmpeg-user mailing list