WebTools

307 Useful Tools & Utilities to make life easier.

Hardcode Subtitles Tool

Burn custom-styled subtitles directly into your video files with full control over colors, size, and position.

Support for MP4, WebM, and OGG

Standard SubRip (.srt) format

Deep Dive into the Hardcode Subtitles Tool

The Hardcode Subtitles tool offers a streamlined way to permanently burn text overlays into a video track using SubRip (.srt) files. Rather than relying on cloud servers or external software dependencies for video processing, this utility executes all encoding operations directly within your web browser utilizing a WebAssembly (WASM) port of FFmpeg. This architecture ensures that the file data never leaves your device's memory pool.

Supported Inputs and Styling Features

To initiate the hardcoding process, the tool requires two distinct files loaded via the interface:

  • Video File: The tool accepts standard web video formats, explicitly guiding the user toward MP4, WebM, and OGG extensions via the file selector's accept attributes.
  • Subtitle File: Only standard SubRip (.srt) files are processed. This format must contain standard sequential numeric counters, precise timecodes, and the raw text payload.

Once the inputs are committed to memory, the user interface exposes two primary visual customization settings that manipulate the final video output properties:

  • Font Size: You can select predetermined font sizes ranging from Small (16px) up to Ultra (40px) via a dropdown menu. The default initialized size is Medium (20px).
  • Font Color: A standard color picker allows HEX code selection, with an accompanying text input bound to the same Alpine.js data model. By default, it initializes to white (#FFFFFF). When passed to the encoding engine, the script transforms the standard HTML hex string into the specific hexadecimal format required by FFmpeg’s internal subtitle filter mechanism. For instance, `#FFFFFF` is mutated into `0xFFFFFF`.

How the WebAssembly Encoding Engine Operates

When the "Burn Subtitles" action is dispatched, the underlying Alpine.js controller instantiates an in-memory FFmpeg virtual file system. The script buffers both your selected video and `.srt` files and writes them into this virtual directory as `video.mp4` and `subs.srt`, respectively.

The engine then constructs a precise command-line argument array that maps directly to native FFmpeg parameters. The exact command structure executed internally is:

-i video.mp4 -vf subtitles=subs.srt:force_style='FontSize=[SIZE],PrimaryColour=[COLOR]' output.mp4

The `-vf` (video filter) flag instructs FFmpeg to apply the `subtitles` complex filter, dynamically appending your chosen `force_style` parameters to override any inherent `.srt` formatting defaults. The encoder outputs an `output.mp4` file, which is then parsed back into a raw binary Blob, mapped to an object URL, and presented to the user as a downloadable asset formatted as burned_[original_filename].

Worked Example: Encoding a Custom Clip

Let’s trace the exact execution path when a user wants to burn custom yellow subtitles onto a short interview snippet.

Input Parameters:

  • Video: interview.webm
  • Subtitle: interview_transcript.srt
  • Font Size: Large (24px)
  • Font Color: `#FFCC00` (A vibrant yellow shade)

Execution Logic:

Upon clicking the process button, the file buffer is mapped into the WASM filesystem. The JavaScript controller parses the user's color choice by running a string replacement on the `#` prefix with `0x`, yielding the target `0xFFCC00`. The engine then invokes the WebAssembly FFmpeg module with the following explicit arguments:

-i video.mp4 -vf subtitles=subs.srt:force_style='FontSize=24,PrimaryColour=0xFFCC00' output.mp4

Expected Output:

The frontend progress indicator hooks into FFmpeg's ratio listener to display real-time encoding completion. Once it reaches 100%, the browser generates an object URL for a newly created file named burned_interview.webm (inheriting the original file name). This output file contains the text from interview_transcript.srt permanently rasterized onto the video frames in 24px yellow typography. Because this processing is visually destructive to the original pixels beneath the text boundaries, the subtitles become a permanent fixture of the video stream and cannot be toggled off in media players.

Frequently Asked Questions

Why does the processing step sometimes fail or crash on large video files?

Because the FFmpeg instance runs entirely inside your browser's WebAssembly sandbox environment, it is strictly bound by the hard memory limits of your local device and active browser tab. Large video files or extremely high-resolution source material (such as uncompressed 4K footage) may cause the processing script to run out of memory allocations and trigger the fallback alert, as the tool attempts to simultaneously load the entire source file, the subtitle file, and the rendering output file into local RAM.

Can I upload WebVTT (.vtt) files instead of SubRip (.srt)?

No. The current internal file parsing logic explicitly restricts the subtitle input to the SubRip (`.srt`) extension via file picker limits. Furthermore, the hardcoded FFmpeg video filter parameter specifically mounts the input strictly as `subtitles=subs.srt`. Uploading alternative subtitle formats will result in rendering failures during the encoding phase.

What happens to the video codec and output container?

Regardless of whether you upload a source WebM or OGG file, the tool normalizes the workflow by writing the source file into the virtual system as `video.mp4` and exporting the resulting render as `output.mp4`. The FFmpeg WASM instance utilizes its default encoding settings to generate the MP4 file, meaning the final downloaded asset will consistently be wrapped in an MP4 container format, irrespective of the original input extension.

How does the color converter handle HTML hex transparency or alpha channels?

The standard HTML5 input type="color" picker utilized by the tool does not generate alpha channel (transparency) hex codes. It strictly provides standard 6-character hex strings (e.g., #FF0000). The application solely replaces the `#` symbol with `0x` to satisfy FFmpeg's `PrimaryColour` styling format, resulting in fully opaque text colors. Native transparency manipulation is not exposed to the user interface.

Contact

Missing something?

Feel free to request missing tools or give some feedback using our contact form.

Contact Us