Extract Stereoscopic 3D Tracks with FFmpeg

This article provides a straightforward guide on how to use FFmpeg to isolate and extract individual left-eye and right-eye video tracks from a stereoscopic 3D video. You will learn the specific command-line arguments needed to split both side-by-side (SBS) and top-and-bottom (TAB) 3D video formats into separate, standard 2D video files.

Stereoscopic 3D videos package two distinct views (one for each eye) into a single video frame. To extract these individual views, you must use FFmpeg’s video crop filter (-vf "crop=..."). The exact cropping coordinates depend on whether your source video is organized horizontally (Side-by-Side) or vertically (Top-and-Bottom).

Extracting from Side-by-Side (SBS) Video

In a Side-by-Side 3D video, the left-eye view occupies the left half of the frame, and the right-eye view occupies the right half.

To extract the left-eye track:

ffmpeg -i input_sbs.mp4 -vf "crop=in_w/2:in_h:0:0" left_output.mp4

To extract the right-eye track:

ffmpeg -i input_sbs.mp4 -vf "crop=in_w/2:in_h:in_w/2:0" right_output.mp4

How it works: * in_w/2: Sets the output width to half of the input video’s width. * in_h: Keeps the full height of the input video. * 0:0: Starts the crop for the left eye at the top-left corner (X=0, Y=0). * in_w/2:0: Starts the crop for the right eye at the horizontal midpoint (X=width/2, Y=0).


Extracting from Top-and-Bottom (TAB) Video

In a Top-and-Bottom 3D video, the left-eye view is located on the top half of the frame, and the right-eye view is on the bottom half.

To extract the left-eye (top) track:

ffmpeg -i input_tab.mp4 -vf "crop=in_w:in_h/2:0:0" left_output.mp4

To extract the right-eye (bottom) track:

ffmpeg -i input_tab.mp4 -vf "crop=in_w:in_h/2:0:in_h/2" right_output.mp4

How it works: * in_w: Keeps the full width of the input video. * in_h/2: Sets the output height to half of the input video’s height. * 0:0: Starts the crop for the top eye at the top-left corner. * 0:in_h/2: Starts the crop for the bottom eye at the vertical midpoint (X=0, Y=height/2).


Handling Half-SBS/Half-TAB (Aspect Ratio Correction)

“Half” stereoscopic formats squash the horizontal or vertical resolution to fit standard 16:9 frames. If your source is a “Half-SBS” video, the extracted tracks will look squished. You can fix the aspect ratio during extraction by adding a scale filter:

ffmpeg -i input_half_sbs.mp4 -vf "crop=in_w/2:in_h:0:0,scale=1920:1080,setsar=1" left_corrected.mp4

This crops the left frame, stretches the width back to 1920x1080, and resets the Sample Aspect Ratio (SAR) to 1 to ensure proper playback.


Extracting Both Tracks Simultaneously

To avoid decoding the source file twice, you can use FFmpeg’s filter_complex to split the video and output both the left and right tracks in a single command execution:

ffmpeg -i input_sbs.mp4 -filter_complex "[0:v]crop=in_w/2:in_h:0:0[left]; [0:v]crop=in_w/2:in_h:in_w/2:0[right]" -map "[left]" left.mp4 -map "[right]" right.mp4