diff --git a/tests/fate/matroska.mak b/tests/fate/matroska.mak
index 1d68be81c8..16285a2dc8 100644
--- a/tests/fate/matroska.mak
+++ b/tests/fate/matroska.mak
@@ -215,6 +215,29 @@ fate-matroska-dvbsub-remux: CMD = transcode mpegts $(TARGET_SAMPLES)/sub/dvbsubt
 FATE_MATROSKA_FFPROBE-$(call ALLYES, MATROSKA_DEMUXER) += fate-matroska-spherical-mono
 fate-matroska-spherical-mono: CMD = run ffprobe$(PROGSSUF)$(EXESUF) -show_entries stream_side_data_list -select_streams v -v 0 $(TARGET_SAMPLES)/mkv/spherical.mkv
 
+# This test tests the handling of AVStereo3D information, in particular
+# the ability to set it via metadata in the muxer (the file itself is
+# actually an ordinary file with a single view). It also tests
+# correctly writing the display dimensions in the presence of stereo metadata.
+# The test also covers reformatting Theora extradata as well as testing
+# default_mode infer in the presence of tracks already marked as default.
+# It furthermore tests tag languages as well as stream languages,
+# in particular in their various forms (e.g. de vs deu vs ger for German)
+# and also the language-country code form.
+FATE_MATROSKA_FFMPEG_FFPROBE-$(call REMUX, MATROSKA, OGG_DEMUXER THEORA_DECODER) += fate-matroska-stereo_mode
+fate-matroska-stereo_mode: CMD = transcode ogg $(TARGET_SAMPLES)/vp3/offset_test.ogv matroska \
+    "-c copy -write_crc32 0 -default_mode infer \
+     -map 0 -disposition:s:0 +original+dub -metadata:s:0 language=ger \
+     -map 0 -metadata:s:1 stereo_mode=left_right -metadata:s:1 language=ger-at -metadata:s:1 description-ger=Deutsch -metadata:s:1 description-fre=Français \
+     -map 0 -metadata:s:2 stereo_mode=bottom_top -metadata:s:2 language=eng -metadata:s:2 description-de=Deutsch -metadata:s:2 description-fra=Français \
+     -map 0 -metadata:s:3 stereo_mode=row_interleaved_rl -sar:3 3:1 -disposition:3 +default -metadata:s:3 language=deu-at \
+     -map 0 -metadata:s:4 stereo_mode=col_interleaved_rl -sar:4 16:9 -metadata:s:4 language=fre -metadata:s:4 description-deu-at=Österreichisch \
+     -map 0 -metadata:s:5 stereo_mode=anaglyph_cyan_red -sar:5 16:9 -disposition:5 +default -metadata:s:5 language=fra \
+     -map 0 -metadata:s:6 stereo_mode=12 -sar:6 2:1 -metadata:s:6 language=de -metadata:s:6 description-deu=Deutsch" \
+    "-map 0 -c copy" \
+    "-show_entries stream_disposition=default,original,dub:stream_tags:stream_side_data_list"
+
+
 # The following test tests the various flavours of WebVTT in WebM.
 # It also tests that dispositions not supported by WebM are not written
 # (and therefore lost). It moreover tests that the muxer writes CuePoints
diff --git a/tests/ref/fate/matroska-stereo_mode b/tests/ref/fate/matroska-stereo_mode
new file mode 100644
index 0000000000..745c294576
--- /dev/null
+++ b/tests/ref/fate/matroska-stereo_mode
@@ -0,0 +1,195 @@
+cbfda33da837da47bdb9f7d2568ab626 *tests/data/fate/matroska-stereo_mode.matroska
+1470766 tests/data/fate/matroska-stereo_mode.matroska
+#extradata 0:     3510, 0x560c3919
+#extradata 1:     3510, 0x560c3919
+#extradata 2:     3510, 0x560c3919
+#extradata 3:     3510, 0x560c3919
+#extradata 4:     3510, 0x560c3919
+#extradata 5:     3510, 0x560c3919
+#extradata 6:     3510, 0x560c3919
+#tb 0: 1/1000
+#media_type 0: video
+#codec_id 0: theora
+#dimensions 0: 512x512
+#sar 0: 0/1
+#tb 1: 1/1000
+#media_type 1: video
+#codec_id 1: theora
+#dimensions 1: 512x512
+#sar 1: 1/1
+#tb 2: 1/1000
+#media_type 2: video
+#codec_id 2: theora
+#dimensions 2: 512x512
+#sar 2: 1/1
+#tb 3: 1/1000
+#media_type 3: video
+#codec_id 3: theora
+#dimensions 3: 512x512
+#sar 3: 3/1
+#tb 4: 1/1000
+#media_type 4: video
+#codec_id 4: theora
+#dimensions 4: 512x512
+#sar 4: 455/256
+#tb 5: 1/1000
+#media_type 5: video
+#codec_id 5: theora
+#dimensions 5: 512x512
+#sar 5: 16/9
+#tb 6: 1/1000
+#media_type 6: video
+#codec_id 6: theora
+#dimensions 6: 512x512
+#sar 6: 2/1
+0,          0,          0,     1000,   206173, 0x95af7455
+1,          0,          0,     1000,   206173, 0x95af7455, S=1,       12
+2,          0,          0,     1000,   206173, 0x95af7455, S=1,       12
+3,          0,          0,     1000,   206173, 0x95af7455, S=1,       12
+4,          0,          0,     1000,   206173, 0x95af7455, S=1,       12
+5,          0,          0,     1000,   206173, 0x95af7455
+6,          0,          0,     1000,   206173, 0x95af7455
+0,       1000,       1000,     1000,       36, 0x34891010, F=0x0
+1,       1000,       1000,     1000,       36, 0x34891010, F=0x0
+2,       1000,       1000,     1000,       36, 0x34891010, F=0x0
+3,       1000,       1000,     1000,       36, 0x34891010, F=0x0
+4,       1000,       1000,     1000,       36, 0x34891010, F=0x0
+5,       1000,       1000,     1000,       36, 0x34891010, F=0x0
+6,       1000,       1000,     1000,       36, 0x34891010, F=0x0
+0,       2000,       2000,     1000,        9, 0x17e5047e, F=0x0
+1,       2000,       2000,     1000,        9, 0x17e5047e, F=0x0
+2,       2000,       2000,     1000,        9, 0x17e5047e, F=0x0
+3,       2000,       2000,     1000,        9, 0x17e5047e, F=0x0
+4,       2000,       2000,     1000,        9, 0x17e5047e, F=0x0
+5,       2000,       2000,     1000,        9, 0x17e5047e, F=0x0
+6,       2000,       2000,     1000,        9, 0x17e5047e, F=0x0
+0,       3000,       3000,     1000,        9, 0x17e5047e, F=0x0
+1,       3000,       3000,     1000,        9, 0x17e5047e, F=0x0
+2,       3000,       3000,     1000,        9, 0x17e5047e, F=0x0
+3,       3000,       3000,     1000,        9, 0x17e5047e, F=0x0
+4,       3000,       3000,     1000,        9, 0x17e5047e, F=0x0
+5,       3000,       3000,     1000,        9, 0x17e5047e, F=0x0
+6,       3000,       3000,     1000,        9, 0x17e5047e, F=0x0
+0,       4000,       4000,     1000,        9, 0x17e5047e, F=0x0
+1,       4000,       4000,     1000,        9, 0x17e5047e, F=0x0
+2,       4000,       4000,     1000,        9, 0x17e5047e, F=0x0
+3,       4000,       4000,     1000,        9, 0x17e5047e, F=0x0
+4,       4000,       4000,     1000,        9, 0x17e5047e, F=0x0
+5,       4000,       4000,     1000,        9, 0x17e5047e, F=0x0
+6,       4000,       4000,     1000,        9, 0x17e5047e, F=0x0
+0,       5000,       5000,     1000,        9, 0x17e5047e, F=0x0
+1,       5000,       5000,     1000,        9, 0x17e5047e, F=0x0
+2,       5000,       5000,     1000,        9, 0x17e5047e, F=0x0
+3,       5000,       5000,     1000,        9, 0x17e5047e, F=0x0
+4,       5000,       5000,     1000,        9, 0x17e5047e, F=0x0
+5,       5000,       5000,     1000,        9, 0x17e5047e, F=0x0
+6,       5000,       5000,     1000,        9, 0x17e5047e, F=0x0
+0,       6000,       6000,     1000,        9, 0x17e5047e, F=0x0
+1,       6000,       6000,     1000,        9, 0x17e5047e, F=0x0
+2,       6000,       6000,     1000,        9, 0x17e5047e, F=0x0
+3,       6000,       6000,     1000,        9, 0x17e5047e, F=0x0
+4,       6000,       6000,     1000,        9, 0x17e5047e, F=0x0
+5,       6000,       6000,     1000,        9, 0x17e5047e, F=0x0
+6,       6000,       6000,     1000,        9, 0x17e5047e, F=0x0
+0,       7000,       7000,     1000,        9, 0x17e5047e, F=0x0
+1,       7000,       7000,     1000,        9, 0x17e5047e, F=0x0
+2,       7000,       7000,     1000,        9, 0x17e5047e, F=0x0
+3,       7000,       7000,     1000,        9, 0x17e5047e, F=0x0
+4,       7000,       7000,     1000,        9, 0x17e5047e, F=0x0
+5,       7000,       7000,     1000,        9, 0x17e5047e, F=0x0
+6,       7000,       7000,     1000,        9, 0x17e5047e, F=0x0
+0,       8000,       8000,     1000,        9, 0x17e5047e, F=0x0
+1,       8000,       8000,     1000,        9, 0x17e5047e, F=0x0
+2,       8000,       8000,     1000,        9, 0x17e5047e, F=0x0
+3,       8000,       8000,     1000,        9, 0x17e5047e, F=0x0
+4,       8000,       8000,     1000,        9, 0x17e5047e, F=0x0
+5,       8000,       8000,     1000,        9, 0x17e5047e, F=0x0
+6,       8000,       8000,     1000,        9, 0x17e5047e, F=0x0
+0,       9000,       9000,     1000,        9, 0x17e5047e, F=0x0
+1,       9000,       9000,     1000,        9, 0x17e5047e, F=0x0
+2,       9000,       9000,     1000,        9, 0x17e5047e, F=0x0
+3,       9000,       9000,     1000,        9, 0x17e5047e, F=0x0
+4,       9000,       9000,     1000,        9, 0x17e5047e, F=0x0
+5,       9000,       9000,     1000,        9, 0x17e5047e, F=0x0
+6,       9000,       9000,     1000,        9, 0x17e5047e, F=0x0
+[STREAM]
+DISPOSITION:default=0
+DISPOSITION:dub=0
+DISPOSITION:original=0
+TAG:language=ger
+TAG:DURATION=00:00:10.000000000
+[/STREAM]
+[STREAM]
+DISPOSITION:default=0
+DISPOSITION:dub=0
+DISPOSITION:original=0
+TAG:language=ger-at
+TAG:stereo_mode=left_right
+TAG:DESCRIPTION-ger=Deutsch
+TAG:DESCRIPTION-fre=Français
+TAG:DURATION=00:00:10.000000000
+[SIDE_DATA]
+side_data_type=Stereo 3D
+type=side by side
+inverted=0
+[/SIDE_DATA]
+[/STREAM]
+[STREAM]
+DISPOSITION:default=0
+DISPOSITION:dub=0
+DISPOSITION:original=0
+TAG:language=eng
+TAG:stereo_mode=bottom_top
+TAG:DESCRIPTION-ger=Deutsch
+TAG:DESCRIPTION-fre=Français
+TAG:DURATION=00:00:10.000000000
+[SIDE_DATA]
+side_data_type=Stereo 3D
+type=top and bottom
+inverted=1
+[/SIDE_DATA]
+[/STREAM]
+[STREAM]
+DISPOSITION:default=1
+DISPOSITION:dub=0
+DISPOSITION:original=0
+TAG:language=deu-at
+TAG:stereo_mode=row_interleaved_rl
+TAG:DURATION=00:00:10.000000000
+[SIDE_DATA]
+side_data_type=Stereo 3D
+type=interleaved lines
+inverted=1
+[/SIDE_DATA]
+[/STREAM]
+[STREAM]
+DISPOSITION:default=0
+DISPOSITION:dub=0
+DISPOSITION:original=0
+TAG:language=fre
+TAG:stereo_mode=col_interleaved_rl
+TAG:DESCRIPTION-DEU-AT=Österreichisch
+TAG:DURATION=00:00:10.000000000
+[SIDE_DATA]
+side_data_type=Stereo 3D
+type=interleaved columns
+inverted=1
+[/SIDE_DATA]
+[/STREAM]
+[STREAM]
+DISPOSITION:default=1
+DISPOSITION:dub=0
+DISPOSITION:original=0
+TAG:language=fra
+TAG:stereo_mode=anaglyph_cyan_red
+TAG:DURATION=00:00:10.000000000
+[/STREAM]
+[STREAM]
+DISPOSITION:default=0
+DISPOSITION:dub=0
+DISPOSITION:original=0
+TAG:language=de
+TAG:stereo_mode=anaglyph_green_magenta
+TAG:DESCRIPTION-ger=Deutsch
+TAG:DURATION=00:00:10.000000000
+[/STREAM]
