Set a subtitle language using ffmpeg

前端 未结 2 1101
逝去的感伤
逝去的感伤 2021-02-08 05:05

I tried googling a way to set the language of a subtitle stream with ffmpeg and found the -slang option. So I tried the following command but immediately receive an error:

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-08 05:30

    The option

    -metadata:s:1 language=eng

    sets metadata language to eng on the stream id 1 (which is, in typical cases, the first audio stream). Whereas the option

    -metadata:s:s:0 language=eng

    sets the metadata language to eng on the first subtitle stream.

    From ffmpeg manpage:

    -metadata[:metadata_specifier] key=value (output,per-metadata)
    Set a metadata key/value pair.

    An optional metadata_specifier may be given to set metadata on streams or chapters. See "-map_metadata" documentation for details.

    s[:stream_spec]
    per-stream metadata. stream_spec is a stream specifier as described in the Stream specifiers chapter. In an input metadata specifier, the first matching stream is copied from. In an output metadata specifier, all matching streams are copied to.

    And finally from the chapter of stream specifiers, we see

    Possible forms of stream specifiers are:
    stream_index
    Matches the stream with this index. E.g. "-threads:1 4" would set the thread count for the second stream to 4.

    stream_type[:stream_index]
    stream_type is one of: 'v' for video, 'a' for audio, 's' for subtitle, 'd' for data and 't' for attachments. If stream_index is given, then matches stream number stream_index of this type. Otherwise matches all streams of this type.

提交回复
热议问题