[Tutorial] Como remover Closed Captions!

Dúvidas relacionadas com legendas. PEDIDOS NÃO

Moderador: jamlvs

Responder
Convidado5

[Tutorial] Como remover Closed Captions!

Mensagem por Convidado5 » 07 jul 2022, 20:18

Este tópico tem como objectivo esclarecer, de forma bastante abreviada, os diversos tipos de legendas e esclarecer a remoção de legendas do tipo closed captions!


Hardcoded captions ou Open Captions: legendas não removíveis, integradas do fluxo de vídeo;

Closed Captions: legendas removíveis mas não detectadas por aplicações como mkvtoolnix, MediaInfo, etc..;

PGS (Presentation Grapic Stream) (SUP): consistem em bitmaps com o tempo/frame de exibição;

SRT (SubRip Text): as mais usuais neste site, nada mais que um ficheiro de texto facilmente manipulável!


Como exemplo, se usarem o VLC player constatam que, na secção de escolha de legendas ou ferramentas informação de codec,
aparece/pode aparecer algo como no seguinte exemplo:

Imagem



Noções

A primeira coisa a entender é que para EIA-608 e padrões similares de legendas deste tipo, as mesmas são incorporadas directamente no fluxo de bits de vídeo como dados de utilizador.
Os fluxos de bits H.264 são armazenados como uma sequência de unidades NAL (network abstraction layer).
Os dados do utilizador são armazenados numa unidade NAL do tipo "supplemental enhancement information" (SEI).
Cada unidade tem um tipo, os tipos correspondem a um número que, segundo as especificações H.264, são do tipo 6

O ffmpeg possui um filtro de fluxo de bits chamado filter_units, que permite passar ou rejeitar unidades NAL por tipo.
Objectivo, a remoção deste tipo de legendas sem recurso a reencode, à semelhança do que se faz com o mkvtoolnix, recorrendo ao bitstream filter de nome filter_units do ffmpeg.

Via linha de comandos:

Código: Selecionar todos

ffmpeg -i input_file_name.mkv -bsf:v "filter_units=remove_types=6" -c copy output_file_name.mkv
Antes verifiquem se o vosso binário tem filter_units disponível:

Via linha de comandos:

Código: Selecionar todos

ffmpeg -bsfs
Imagem


Em H264

Antes

Código: Selecionar todos

 Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 23.98 fps, 23.98 tbr, 1k tbn (default)...
Após

Código: Selecionar todos

 Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)...

Em H265

para remover as CC: remove_types=39

Atenção, em H265: vai também outra informação mas o fundamental fica, carece melhor verificação!

O binário mais recente é mais lento mas para a esmagadora maioria é indiferente!


Editado: passagem a tutorial, remoção de informação sensível!

cumprimentos
Última edição por Convidado5 em 22 jul 2022, 13:58, editado 15 vezes no total.
gessodeco
Newbie
Mensagens: 19
Registado: 29 jun 2019, 17:58

Re: Tipos de Legendas

Mensagem por gessodeco » 08 jul 2022, 18:43

Então, as legendas que vêm "incorporadas" em ficheiros mkv/mp4 e que são detetadas (e removíveis/"extraíveis") pelo MKVToolNix são legendas do tipo "PGS" (Presentation Grapic Stream)?
Convidado5

Re: Tipos de Legendas

Mensagem por Convidado5 » 09 jul 2022, 02:25

01! boa noite gessodeco!

Em MKV o mais provável é teres SRT e/ou PGS em SUP, no container mp4 podes "apanhar" srt, ttxt, tx3g, "idx/sub", depende da fonte (scene; p2p; etc...)!

Posso responder de outra forma:

High Definition x264 and Ultra High Definition x265 Standards (Scene)

Código: Selecionar todos

10) [ Subtitles ]
    10.1) All PGS subtitles (.sup) present on the source must be included as is.
        10.1.1) It is at the discretion of the group to include forced subtitles for dubbed audio tracks not included in the
                release.
    10.2) Features with foreign dialogue or overlays must include a separate SubRip subtitle (.srt) track for forced English
          subtitles set as forced and default.
        10.2.1) Except in situations where the source video stream contains hardcoded subtitles for non-English dialogue and
                overlays.
        10.2.2) Except for features with excessive positional subtitles (e.g. Anime) which cannot be presented well in SubRip
                format. PGS subtitles must be used instead and set as forced and default.
    10.3) Forced SubRip subtitles must be free of technical flaws. Including, but not limited to: sync issues, spelling,
          incorrect OCR.
        10.3.1) SubRip subtitles must be carefully OCR'd.
        10.3.2) Minor errors in grammar or punctuation which do not change the meaning of the sentence are tolerated. However,
                it is recommended all errors be corrected.
    10.4) Subtitles from an officially licenced (e.g. Netflix, MoviesAnywhere, HBO TV, Starz TV) WEB/HDTV source or
          alternative retail disc of the same content are allowed.
        10.4.1) Subtitles included from another source must be noted in the NFO. The source and which subtitle tracks used
                must be mentioned.
        10.4.2) Fan-made or custom subtitles are not allowed.
    10.5) Hardcoded subtitles which are only present in the source video stream are allowed, with the exception of non-English
          hardcoded subtitles in English features.
        10.5.1) When hardcoded subtitles extend over the entire feature, it must be tagged as SUBBED.
                e.g. English hardcoded subtitles throughout entire feature = Tag SUBBED
                e.g. English hardcoded subtitles for foreign dialogue only = Do not tag SUBBED
        10.5.2) Subtitles which are only present within the letterboxed matte (i.e. the black borders) of a video frame must
                be cropped and OCR'd to SubRip format.
        10.5.3) In situations where subtitles overlay active video and letterbox matte, cropping must be to the widest frame
                where the subtitles are present and applied equally to the relevant sides of the video frame.
    10.6) Subtitles, unless otherwise stated, are not subject to propers or nukes for any technical flaws that may be present
          in the track.
    10.7) Dupes based on subtitles are not allowed, use INTERNAL.

11) [ Subtitle Format ]
    11.1) Allowed formats are PGS (.sup) and SubRip (.srt).
        11.1.1) Compression must only be used when muxing PGS subtitles, zlib is the only allowed compression algorithm.
        11.1.2) PGS subtitles must not be resized.
        11.1.3) UTF-8 encoding must be used for SubRip subtitle tracks.
        11.1.4) SubRip subtitles are not allowed in 3D releases.
    11.2) Subtitles must:
        11.2.1) Have the correct ISO 639 language code supported by MKVToolNix set
            11.2.1.1) In situations where the language is not supported by MKVToolNix, 'und' must be used.
        11.2.2) Not be set as default or forced, unless otherwise stated in section 10.
        11.2.3) Have the correct sync offset set during muxing.
    11.3) It is strongly recommended to have descriptive names set on the title field.
          e.g. Director's Commentary, English (Forced), English (SDH).
    11.4) 3D releases must use 3D subtitles. Using 2D subtitles for a 3D release or vice versa is not allowed.
    11.5) Burning-in subtitles to the video stream is not allowed.
    11.6) External subtitles located in 'Subs' directories are not allowed.


High Definition x264/H264 and Ultra High Definition x265/H265 WEB and WEBRip Standards (Scene)

Código: Selecionar todos

11) [ Common: Subtitles ]
    11.1) All subtitles present on the source must be converted to SubRip format and included in the release.
        11.1.1) It is at the discretion of the group to include forced subtitles for dubbed audio tracks not included in the release.
        11.1.2) Except in cases when 11.2.2 applies for non-forced tracks, PGS or ASS format must be used instead.
        11.1.3) Except when capturing non-forced subtitles are optional, but it is strongly recommend to find a way to extract them from the source.
    11.2) Features with foreign dialogue or overlays must include a separate SubRip subtitle (.srt) track for forced English subtitles set as forced and default.
        11.2.1) Except in situations where the source video stream contains hardcoded subtitles for non-English dialogue and overlays.
        11.2.2) Except for features with excessive positional subtitles (e.g. Anime) which cannot be presented well in SubRip format. PGS or ASS subtitles must be used instead and set as forced and default.
    11.3) Forced SubRip subtitles must be free of technical flaws. Including, but not limited to: sync issues, spelling, incorrect OCR.
        11.3.1) SubRip subtitles must be carefully OCR'd.
        11.3.2) Minor errors in grammar or punctuation which do not change the meaning of the sentence are tolerated. However, it is recommended all errors be corrected.
    11.4) Subtitles from an officially licenced (e.g. HBO TV, Starz TV) HDTV source or retail discs of the same feature are allowed.
        11.4.1) Subtitles included from another source must be noted in the NFO. The source and which subtitle tracks used must be mentioned.
        11.4.2) Fan-made or custom subtitles are not allowed.
            11.4.2.1) This does not included stripped SDH subtitles, which may be optionally made by groups from a valid SDH subtitle. 
    11.5) Hardcoded subtitles which are only present in the source video stream are allowed, with the exception of non-English hardcoded subtitles in English features.
        11.5.1) When hardcoded subtitles extend over the entire feature, it must be tagged as SUBBED.
                e.g. English hardcoded subtitles throughout entire feature = Tag SUBBED
                e.g. English hardcoded subtitles for foreign dialogue only = Do not tag SUBBED
        11.5.2) Subtitles which are only present within the letterboxed matte (i.e. the black borders) of a video frame must be cropped and OCR'd to SubRip format.
        11.5.3) In situations where subtitles overlay active video and letterbox matte, cropping must be to the widest frame where the subtitles are present and applied equally to the relevant sides of the video frame.
        11.5.4) 11.5.2 and 11.5.3 do not apply to WEB releases.
    11.6) Subtitles, unless otherwise stated, are not subject to propers or nukes for any technical flaws that may be present in the track.
    11.7) Dupes based on subtitles are not allowed, use INTERNAL.

12) [ Common: Subtitle Format ]
    12.1) Allowed formats are PGS (.sup), SubStation Alpha (.ass) and SubRip (.srt).
        12.1.1) Compression must only be used when muxing PGS subtitles, zlib is the only allowed compression algorithm.
        12.1.2) PGS subtitles must not be resized and must be muxed as is.
        12.1.3) UTF-8 encoding must be used for SubStation Alpha and SubRip subtitle tracks.
        12.1.4) When converting to SubStation Alpha format, subtitles must be cleanly converted without any unnecessary modifications to display format. e.g. position, font, color. Subtitle Edit is the recommended tool.
        12.1.5) Closed captions (e.g. CEA-708) embedded in video bitstreams must be left as is and not stripped.
            12.1.5.1) Retaining closed captions when transcoding is optional but strongly recommend.
            12.1.5.2) Extracting closed captions to create SubRip or when appropriate SubStation Alpha formatted subtitles is optional but strongly recommend.
    12.2) Subtitles must:
        12.2.1) Have the correct ISO 639 language code supported by MKVToolNix set
            12.2.1.1) In situations where the language is not supported by MKVToolNix, 'und' must be used.
        12.2.2) Not be set as default or forced, unless otherwise stated in section 11.
        12.2.3) Have the correct sync offset set during muxing.
        12.2.4) Be converted correctly without creating new flaws. Groups are not responsible for any flaws already present in non-forced subtitle tracks.
                e.g. Subtitle is out of sync on the source in a non-forced track, when converted it is still out of sync. This is not a technical flaw.
                e.g. Subtitle is in sync on the source and converted to SubRip format incorrectly by the group resulting in sync issues. This is a technical flaw.
    12.3) It is strongly recommended to have descriptive names set on the title field.
          e.g. Director's Commentary, English (Forced), English (SDH).
    12.4) Burning-in subtitles to the video stream is not allowed.
    12.5) External subtitles located in 'Subs' directories are not allowed.

Editado: remoção de link para uma aplicação!

Cumprimentos
Última edição por Convidado5 em 13 jul 2022, 14:54, editado 1 vez no total.
Responder