Jim Jones
Jim Jones

Reputation: 2837

Preview FFMPEG subtitles before encoding

I'm using FFMPEG to burn in subtitles using a command like this:

ffmpeg -i video.mp4 -vf "subtitles=subs.srt:force_style='Fontsize=24,PrimaryColour=&H0000ff&'" -c:a copy output.mp4

I'd like to create a sort of preview of what the the encoded file with subtitles will look like in the browser before the user clicks "Encode video". I've been creating a DIV with each bit of text from the .srt file and overlaying it on top of a VIDEO tag. I've then been fiddling with the font-size, positioning, color, etc. but just can't get it right. It would be nice if there were some sort of FFPLAY for the browser.

Is there some sort of approach/technique for creating an in-browser preview prior to encoding with FFMPEG?

Upvotes: 0

Views: 836

Answers (1)

llogan
llogan

Reputation: 134093

Use WebVTT in your HTML5 video player. CSS is used for styling.

You can use ffmpeg to convert the SRT to VTT:

ffmpeg -i input.srt output.vtt

Upvotes: 1

Related Questions