Convert Side-by-Side Video to Anaglyph with FFmpeg
This guide explains how to use the FFmpeg stereo3d
filter to convert side-by-side (SBS) stereoscopic 3D videos into
anaglyph 3D for viewing with colored glasses. It covers the core command
syntax, how to handle both full-width and half-width side-by-side
inputs, and how to choose between different anaglyph color matrix
algorithms like the optimized Dubois method or standard red-cyan.
Basic Syntax
FFmpeg provides the stereo3d video filter to convert
between different stereoscopic video formats. The syntax requires
defining the input stereoscopic format (in) and the target
output format (out):
ffmpeg -i input.mp4 -vf "stereo3d=in:out" -c:a copy output.mp4Identifying the Input Format
Side-by-side videos typically come in two variations. You must specify the correct input code based on your source file:
sbsl(Side-by-side full, left eye first): The video has a double-width resolution where both the left and right views are full resolution placed side-by-side.sbs2l(Side-by-side half, left eye first): The video has a standard resolution (such as 1920x1080), but each eye's view is horizontally compressed to half its width.sbsr/sbs2r: Use these if the right eye is positioned on the left side (right eye first).
Choosing the Anaglyph Output Format
FFmpeg supports several anaglyph configurations. The most common use standard red-cyan glasses:
dubois(orred_cyan_dubois): Dubois anaglyph with red/cyan filters. This uses a least-squares projection method to significantly reduce ghosting and optimize colors.arrc(orred_cyan_color): Red/cyan color anaglyph.arch(orred_cyan_half_color): Red/cyan half-color anaglyph, which can reduce color rivalry.arcm(orred_cyan_monochrome): Red/cyan monochrome (grayscale) anaglyph.agmc(orgreen_magenta_color): Green/magenta color anaglyph (for green-magenta glasses).
Practical Examples
1. Converting Half Side-by-Side (Half-SBS) to Dubois Red-Cyan
Half-SBS is the most common format for downloaded 3D media. The following command converts a half-SBS input to an optimized Dubois red-cyan anaglyph while retaining original audio:
ffmpeg -i input_half_sbs.mp4 -vf "stereo3d=sbs2l:dubois" -c:v libx264 -crf 18 -c:a copy output_anaglyph.mp42. Converting Full Side-by-Side (Full-SBS) to Standard Red-Cyan
For full-resolution side-by-side videos, use sbsl:
ffmpeg -i input_full_sbs.mp4 -vf "stereo3d=sbsl:arrc" -c:v libx264 -crf 18 -c:a copy output_anaglyph.mp43. Converting to Green-Magenta Anaglyph
If you have green/magenta (Trioscopic) glasses instead of red/cyan:
ffmpeg -i input_half_sbs.mp4 -vf "stereo3d=sbs2l:agmc" -c:v libx264 -crf 18 -c:a copy output_green_magenta.mp4