meoiswa / vrchat-transcode-utilities

Collection of utilities to make transcoding video suitable for streaming into VRChat easier
3 stars 4 forks source link

Deal with non-textual (bitmap) subtitles #4

Open philpax opened 8 months ago

philpax commented 8 months ago

The usual command we run looks something like

ffmpeg \
    -i 'input.mkv' \
    -map 0:v \
    -map 0:a \
    -c:v libx264 \
    -pix_fmt yuv420p 
    -crf 23 \
    -preset veryslow \
    -tune animation \
    -vf "subtitles='input.mkv':si=0" \
    -c:a ac3 \
    "output.mp4"

but the subtitles filter only works for text subs. The file I was working with has bitmap subs, which need to be handled differently. This is the command I ran:

ffmpeg \
    -i 'input.mkv' 
    -filter_complex "[0:v][0:s:0]overlay[v]" \
    -map "[v]" \
    -map 0:3 \
    -c:v libx264 \
    -pix_fmt yuv420p \
    -crf 23 \
    -preset veryslow \
    -tune animation \
    -c:a ac3 \
    "output.mp4"

i.e. using a complex filter to burn the subtitles in. This should be dealt with somehow. Just making a note of it here if we run into it again.