日本のテレビで表示されるARIB(アライブ)字幕を動画のエンコードと一緒に字幕もつけることができる。今までは映像と音声のエンコードと字幕を同時に扱うことはできなかった。
標準規格概要(STD-B24)|一般社団法人 電波産業会
ARIB外字 – Wikipedia
ffmpeg 4.2 から対応し、VLC 3.0 から動画再生に字幕を表示できるようになった。
ffmpeg 4.2 リリース
VLC 3.0 がリリースし ARIB 字幕や AV1 デコードに対応
ARIB字幕を扱うツール。
maki-rxrz/Caption2Ass_PCR: [DL] http://1drv.ms/1PO9Ptq
tsCaption | ass srt tsファイルから字幕追加 tsファイルから字幕取り出し tsファイルの字幕表示 tsファイルの字幕削除ができます: my0nio
インストール
git clone https://github.com/nkoriyama/aribb24 cd aribb24 autoreconf -fiv ./configure --enable-static --disable-shared make make install
m-ab-s/media-autobuild_suite は未対応なので手動でインストールする。msys64 フォルダにある、mingw64.exe を起動してインストールする。
cd build git clone https://github.com/nkoriyama/aribb24 cd aribb24 autoreconf -fiv ./configure --prefix=/local64 --enable-static --disable-shared make make install
ffmpeg にリンクする。
PKG_CONFIG_PATH="/local64/lib/pkgconfig" ./configure --enable-libaribb24 --enable-version3 --pkg-config-flags=--static --extra-ldflags=-static
基本コマンド
TSファイルからremuxして再びTSに字幕をコピーすることはできない。-fix_sub_duration をつけないと字幕の表示時間がおかしくなるので必ずつける。
ffmpeg -analyzeduration 10MB -probesize 10MB -fix_sub_duration -i input.ts -map 0:v -map 0:a -map 0:s -c:v libx264 -c:a copy -c:s mov_text output.mp4
ASS字幕に出力する。
ffmpeg -analyzeduration 10MB -probesize 10MB -fix_sub_duration -i input.ts -c:s ass output.ass
字幕の表示時間を一律にずらすなら -itsoffset をつける。2秒遅らせる例。
ffmpeg -analyzeduration 10MB -probesize 10MB -fix_sub_duration -itsoffset 2 -i input.ts -c:s ass output.ass
公式ドキュメント
FFmpeg Codecs Documentation : libaribb24
ffmpeg Documentation : Subtitle options
オプション
オプション指定してどのように変化があるのかよくわかっていない。
- -aribb24-base-path[string]
Sets the base path for the libaribb24 library. This is utilized for reading of configuration files (for custom unicode conversions), and for dumping of non-text symbols as images under that location.
既定値:無指定 - -aribb24-skip-ruby-text[boolean]
Tells the decoder wrapper to skip text blocks that contain half-height ruby text.
既定値:1