Convert Side-by-Side 3D to Anaglyph Using FFmpeg

This guide explains how to convert side-by-side (SBS) 3D video files into red-cyan anaglyph 3D using FFmpeg. By utilizing the built-in stereo3d video filter, you can transform stereoscopic content into standard anaglyph video viewable with classic red-cyan glasses, avoiding the need for specialized 3D displays or proprietary software.

The Basic FFmpeg Command

To convert a standard full side-by-side video to red-cyan anaglyph, run the following command in your terminal:

ffmpeg -i input_sbs.mp4 -vf "stereo3d=sbsl:arrc" -c:v libx264 -crf 18 -c:a copy output_anaglyph.mp4

Understanding the Filter Parameters

The stereo3d filter requires two primary parameters separated by a colon: the input format and the output format (stereo3d=in_format:out_format).

1. Input Formats (in_format)

Choose the code that matches your source file:

  • sbsl: Side-by-side full width, left eye first (most common for Full-SBS).
  • sbs2l: Side-by-side half width, left eye first (most common for Half-SBS).
  • sbsr: Side-by-side full width, right eye first.
  • sbs2r: Side-by-side half width, right eye first.

2. Output Formats (out_format)

FFmpeg provides multiple algorithms for red-cyan output:

  • arrc: Anaglyph red/cyan Dubois. This produces the highest visual quality and minimizes ghosting (crosstalk) by using optimized matrix calculations.
  • arcc: Anaglyph red/cyan full color.
  • arch: Anaglyph red/cyan half color.
  • argg: Anaglyph red/cyan monochrome (grayscale).

Handling Half Side-by-Side (Half-SBS) Video

If your source video is Half-SBS (where the horizontal resolution of each eye is compressed by 50%), use sbs2l as the input parameter:

ffmpeg -i input_halfsbs.mp4 -vf "stereo3d=sbs2l:arrc" -c:v libx264 -crf 18 -c:a copy output_anaglyph.mp4

Additional Encoding Options

  • -c:v libx264: Encodes the output video using the H.264 codec for broad compatibility.
  • -crf 18: Controls visual quality. Lower values produce higher quality (17–23 is the standard visually lossless range).
  • -preset fast: Adjusts encoding speed versus compression efficiency (e.g., ultrafast, fast, medium, slow).
  • -c:a copy: Copies the original audio stream directly without re-encoding to save processing time and maintain sound fidelity.