Project Soon

Bump in the road

I stumbled upon the first video with image-based subtitles, so now I have an actual video to try it out with. It worked pretty smoothly, but there was one error that made the subtitles unreadable: If your subtitles have a bigger size than the actual video output, it will not scale to the video and place the subtitles outside the video instead. I suspect the reason for this was so you could display the subtitles outside the video, leaving more room for the video itself. The problem is that I hadn’t added any black bars around the video to fit that size, neither is the subtitles scaled to fit the video, the default option for how VLC seem to handle it.

I then dove into the wrong hole to solve it, went out from it and dove into an another wrong hole of adding features for the library I’m using. I then realized, after some deeper investigation, that the solution was more simplified than that:

1
2
scale = ffmpeg.filter_multi_output([output_video, input_subtitle], "scale2ref")
output_video = ffmpeg.overlay(scale[0], scale[1])