Commit d5c574a9d7 for ffmpeg
commit d5c574a9d7a630cf1a6f6f861a52ba83a230b3f8
Author: Romain Beauxis <romain.beauxis@gmail.com>
Date: Thu Dec 3 10:41:59 2026 -0600
tests/fate/ogg-copy-trim: add Vorbis stream copy trim tests
Cover Vorbis cuts through Matroska and MP4, a cut within the last
packet, primers at Matroska and clamped timestamps, and links of a
primer alone, also through a segment muxer flush.
The refs record the current behaviour, which plays the pre-roll of a
cut and the end trim of its last packet.
diff --git a/tests/fate/ogg-copy-trim.mak b/tests/fate/ogg-copy-trim.mak
index 872306acc9..1bd488f93e 100644
--- a/tests/fate/ogg-copy-trim.mak
+++ b/tests/fate/ogg-copy-trim.mak
@@ -23,6 +23,21 @@ OGG_COPY_TRIM_CUT = \
$(call OGG_COPY_TRIM_AV,$(1),$(3)) && \
$(call OGG_COPY_TRIM,$(TARGET_PATH)/$(3).mkv,-ss $(2),$(3),$(4))
+# Whether the decoded copy $(1) is the start of the decoded source, for copies
+# shorter than their source.
+OGG_COPY_TRIM_PREFIX = \
+ dd if=$(1).pcm of=$(1).prefix.pcm bs=1 count=$$(($$(wc -c < $(1).copy.pcm))) 2>/dev/null && \
+ $(call OGG_CHAIN_COPY_COMPARE,$(1).prefix.pcm,$(1).copy.pcm,start of the decoded source)
+
+# Whether $(1) read with input options $(2) decodes to the end of the decoded
+# copy $(3).ogg, for copies playing samples before their start. Compared as
+# floats: the rounding to 16 bits depends on the position in the output.
+OGG_COPY_TRIM_SUFFIX = \
+ ffmpeg -auto_conversion_filters -i $(TARGET_PATH)/$(3).ogg -f f32le -y $(TARGET_PATH)/$(3).copy.f32 && \
+ ffmpeg -auto_conversion_filters $(2) -i $(1) -map 0:a -f f32le -y $(TARGET_PATH)/$(3).f32 && \
+ tail -c $$(($$(wc -c < $(3).f32))) $(3).copy.f32 > $(3).suffix.f32 && \
+ $(call OGG_CHAIN_COPY_COMPARE,$(3).f32,$(3).suffix.f32,end of the decoded copy)
+
# Number of packets of $(1) not starting at the end of the previous one.
OGG_COPY_TRIM_GAPS = \
ogg_packets=$$(probe -show_entries packet=pts,duration -of csv=p=0 $(1)) && \
@@ -82,6 +97,116 @@ FATE_OGG_COPY_TRIM-$(call ALLYES, VORBIS_DECODER $(OGG_COPY_TRIM_DEPS)) += fate-
fate-ogg-copy-trim-vorbis-chained: CMD = $(call OGG_COPY_TRIM,$(TARGET_SAMPLES)/ogg-vorbis/chained-meta.ogg,,$(OGG_COPY_TRIM_VORBIS_CHAINED))
fate-ogg-copy-trim-vorbis-chained: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_CHAINED),$(OGG_COPY_TRIM_FILES))
+OGG_COPY_TRIM_VORBIS_CUT = tests/data/fate/ogg-copy-trim-vorbis-cut
+FATE_OGG_COPY_TRIM-$(call ALLYES, VORBIS_DECODER $(OGG_COPY_TRIM_AV_DEPS)) += fate-ogg-copy-trim-vorbis-cut
+fate-ogg-copy-trim-vorbis-cut: CMD = $(call OGG_COPY_TRIM_CUT,ogg-vorbis/tos.ogg,1.3,$(OGG_COPY_TRIM_VORBIS_CUT)) && \
+ $(call OGG_CHAIN_COPY_COMPARE,$(OGG_COPY_TRIM_VORBIS_CUT).pcm,$(OGG_COPY_TRIM_VORBIS_CUT).copy.pcm,decoded copy)
+fate-ogg-copy-trim-vorbis-cut: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_CUT),.mkv $(OGG_COPY_TRIM_FILES))
+
+# The same cut copying only the primer and the first packet, whose page then
+# ends the link.
+OGG_COPY_TRIM_VORBIS_SHORT = tests/data/fate/ogg-copy-trim-vorbis-cut-short
+FATE_OGG_COPY_TRIM-$(call ALLYES, VORBIS_DECODER $(OGG_COPY_TRIM_AV_DEPS)) += fate-ogg-copy-trim-vorbis-cut-short
+fate-ogg-copy-trim-vorbis-cut-short: CMD = $(call OGG_COPY_TRIM_CUT,ogg-vorbis/tos.ogg,1.3,$(OGG_COPY_TRIM_VORBIS_SHORT),-t 0.015) && \
+ $(call OGG_COPY_TRIM_PREFIX,$(OGG_COPY_TRIM_VORBIS_SHORT))
+fate-ogg-copy-trim-vorbis-cut-short: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_SHORT),.mkv .prefix.pcm $(OGG_COPY_TRIM_FILES))
+
+# The primer and first packet of the cut recopied 3 ms later, with 200
+# samples of end padding: part of the start skip is before the first sample.
+OGG_COPY_TRIM_VORBIS_SHIFTED = tests/data/fate/ogg-copy-trim-vorbis-shifted
+FATE_OGG_COPY_TRIM-$(call ALLYES, SETTS_BSF VORBIS_DECODER $(OGG_COPY_TRIM_AV_DEPS)) += fate-ogg-copy-trim-vorbis-shifted
+fate-ogg-copy-trim-vorbis-shifted: CMD = \
+ $(call OGG_COPY_TRIM_AV,ogg-vorbis/tos.ogg,$(OGG_COPY_TRIM_VORBIS_SHIFTED)) && \
+ ffmpeg -ss 1.3 -i $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_SHIFTED).mkv -map 0:a -c copy \
+ -fflags +bitexact -f ogg -y $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_SHIFTED).cut.ogg && \
+ ffmpeg -copyts -i $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_SHIFTED).cut.ogg -map 0:a -c copy -frames:a 2 \
+ -output_ts_offset 0.003 -bsf:a "setts=duration=if(eq(N\,1)\,DURATION-200\,DURATION)" \
+ -fflags +bitexact -f ogg -y $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_SHIFTED).ogg && \
+ probe -show_frames -show_entries frame=pts,nb_samples:frame_tags= \
+ -of compact $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_SHIFTED).ogg
+fate-ogg-copy-trim-vorbis-shifted: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_SHIFTED),.mkv .cut.ogg .ogg)
+
+# Vorbis cut within its last packet, which carries an end trim.
+OGG_COPY_TRIM_VORBIS_LAST = tests/data/fate/ogg-copy-trim-vorbis-cut-last
+FATE_OGG_COPY_TRIM-$(call ALLYES, VORBIS_DECODER PCM_F32LE_ENCODER PCM_F32LE_MUXER $(OGG_COPY_TRIM_AV_DEPS)) += fate-ogg-copy-trim-vorbis-cut-last
+fate-ogg-copy-trim-vorbis-cut-last: CMD = \
+ ffmpeg -i $(TARGET_SAMPLES)/mov/spherical.mov -i $(TARGET_SAMPLES)/vorbis/6.ogg \
+ -map 0:v -map 1:a -c copy -fflags +bitexact -f matroska -y $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_LAST).mkv && \
+ $(call OGG_COPY_TRIM,$(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_LAST).mkv,-ss 5.836,$(OGG_COPY_TRIM_VORBIS_LAST)) && \
+ $(call OGG_COPY_TRIM_SUFFIX,$(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_LAST).mkv,-ss 5.836,$(OGG_COPY_TRIM_VORBIS_LAST))
+fate-ogg-copy-trim-vorbis-cut-last: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_LAST),.mkv .f32 .copy.f32 .suffix.f32 $(OGG_COPY_TRIM_FILES))
+
+# The first Vorbis link through Matroska: the primer has PTS zero, and
+# the first presented packet starts later.
+OGG_COPY_TRIM_VORBIS_OFFSET = tests/data/fate/ogg-copy-trim-vorbis-offset
+FATE_OGG_COPY_TRIM-$(call ALLYES, MATROSKA_MUXER MATROSKA_DEMUXER VORBIS_PARSER VORBIS_DECODER $(OGG_COPY_TRIM_DEPS)) += fate-ogg-copy-trim-vorbis-offset
+fate-ogg-copy-trim-vorbis-offset: CMD = \
+ ffmpeg -i $(TARGET_SAMPLES)/ogg-vorbis/chained-meta.ogg -c copy -frames:a 3 -fflags +bitexact -f matroska -y $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_OFFSET).mkv && \
+ $(call OGG_COPY_TRIM,$(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_OFFSET).mkv,,$(OGG_COPY_TRIM_VORBIS_OFFSET)) && \
+ $(call OGG_CHAIN_COPY_COMPARE,$(OGG_COPY_TRIM_VORBIS_OFFSET).pcm,$(OGG_COPY_TRIM_VORBIS_OFFSET).copy.pcm,decoded copy) && \
+ probe -read_intervals "%+\#3,0%+\#3" -show_frames -show_entries frame=pts,nb_samples:frame_tags= \
+ -of compact $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_OFFSET).ogg
+fate-ogg-copy-trim-vorbis-offset: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_OFFSET),.mkv $(OGG_COPY_TRIM_FILES))
+
+# A positive Vorbis start and an end trim in a link with two packets.
+OGG_COPY_TRIM_VORBIS_OFFSET_END = tests/data/fate/ogg-copy-trim-vorbis-offset-end
+FATE_OGG_COPY_TRIM-$(call ALLYES, SETTS_BSF VORBIS_DECODER OGG_MUXER OGG_DEMUXER FILE_PROTOCOL) += fate-ogg-copy-trim-vorbis-offset-end
+fate-ogg-copy-trim-vorbis-offset-end: CMD = \
+ ffmpeg -copyts -itsoffset 1 -i $(TARGET_SAMPLES)/ogg-vorbis/tos.ogg -map 0:a -c copy -frames:a 2 \
+ -bsf:a "setts=duration=if(eq(N\,1)\,132\,DURATION)" -fflags +bitexact \
+ -f ogg -y $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_OFFSET_END).ogg && \
+ probe -show_frames -show_entries frame=pts,nb_samples:frame_tags= \
+ -of compact $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_OFFSET_END).ogg
+fate-ogg-copy-trim-vorbis-offset-end: CLEANFILES = $(OGG_COPY_TRIM_VORBIS_OFFSET_END).ogg
+
+# A duration hint on the first presented packet of a longer positive-start
+# link must leave the primer available when seeking to the beginning.
+OGG_COPY_TRIM_VORBIS_OFFSET_INTERIOR = tests/data/fate/ogg-copy-trim-vorbis-offset-interior
+FATE_OGG_COPY_TRIM-$(call ALLYES, SETTS_BSF VORBIS_DECODER OGG_MUXER OGG_DEMUXER FILE_PROTOCOL) += fate-ogg-copy-trim-vorbis-offset-interior
+fate-ogg-copy-trim-vorbis-offset-interior: CMD = \
+ ffmpeg -copyts -itsoffset 1 -i $(TARGET_SAMPLES)/ogg-vorbis/tos.ogg -map 0:a -c copy -frames:a 10 \
+ -bsf:a "setts=duration=if(eq(N\,1)\,132\,DURATION)" -fflags +bitexact \
+ -f ogg -y $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_OFFSET_INTERIOR).ogg && \
+ probe -read_intervals "%+\#3,0%+\#3" -show_frames -show_entries frame=nb_samples:frame_tags= \
+ -of compact $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_OFFSET_INTERIOR).ogg
+fate-ogg-copy-trim-vorbis-offset-interior: CLEANFILES = $(OGG_COPY_TRIM_VORBIS_OFFSET_INTERIOR).ogg
+
+# The primer and the first presented packet both at PTS zero.
+OGG_COPY_TRIM_VORBIS_CLAMPED = tests/data/fate/ogg-copy-trim-vorbis-clamped
+FATE_OGG_COPY_TRIM-$(call ALLYES, SETTS_BSF VORBIS_DECODER OGG_MUXER OGG_DEMUXER FILE_PROTOCOL) += fate-ogg-copy-trim-vorbis-clamped
+fate-ogg-copy-trim-vorbis-clamped: CMD = \
+ ffmpeg -i $(TARGET_SAMPLES)/ogg-vorbis/tos.ogg -map 0:a -c copy -frames:a 10 \
+ -bsf:a "setts=ts=max(PTS\,0)" \
+ -avoid_negative_ts disabled -f ogg -y $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_CLAMPED).ogg && \
+ probe -read_intervals "%+\#3" -show_frames -show_entries frame=pts,nb_samples:frame_tags= \
+ -of compact $(TARGET_PATH)/$(OGG_COPY_TRIM_VORBIS_CLAMPED).ogg
+fate-ogg-copy-trim-vorbis-clamped: CLEANFILES = $(OGG_COPY_TRIM_VORBIS_CLAMPED).ogg
+
+# Vorbis link of its first packet alone, which presents nothing.
+OGG_COPY_TRIM_VORBIS_PRIMER = tests/data/fate/ogg-copy-trim-vorbis-primer
+FATE_OGG_COPY_TRIM-$(call ALLYES, VORBIS_DECODER $(OGG_COPY_TRIM_DEPS)) += fate-ogg-copy-trim-vorbis-primer
+fate-ogg-copy-trim-vorbis-primer: CMD = $(call OGG_COPY_TRIM,$(TARGET_SAMPLES)/ogg-vorbis/tos.ogg,,$(OGG_COPY_TRIM_VORBIS_PRIMER),-frames:a 1)
+fate-ogg-copy-trim-vorbis-primer: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_PRIMER),$(OGG_COPY_TRIM_FILES))
+
+# The same link through a segment muxer without trailer: its explicit flush
+# writes the primer.
+OGG_COPY_TRIM_PRIMER_FLUSH = tests/data/fate/ogg-copy-trim-vorbis-primer-flush
+FATE_OGG_COPY_TRIM-$(call ALLYES, SEGMENT_MUXER OGG_MUXER OGG_DEMUXER FILE_PROTOCOL) += fate-ogg-copy-trim-vorbis-primer-flush
+fate-ogg-copy-trim-vorbis-primer-flush: libavformat/tests/ogg_pages$(EXESUF)
+fate-ogg-copy-trim-vorbis-primer-flush: CMD = \
+ ffmpeg -i $(TARGET_SAMPLES)/ogg-vorbis/tos.ogg -map 0:a -c copy -fflags +bitexact -frames:a 1 -avoid_negative_ts disabled \
+ -f segment -segment_format ogg -segment_format_options serial_offset=1 \
+ -write_header_trailer 0 -y $(TARGET_PATH)/$(OGG_COPY_TRIM_PRIMER_FLUSH)-%d.ogg && \
+ run libavformat/tests/ogg_pages$(EXESUF) $(TARGET_PATH)/$(OGG_COPY_TRIM_PRIMER_FLUSH)-0.ogg
+fate-ogg-copy-trim-vorbis-primer-flush: CLEANFILES = $(OGG_COPY_TRIM_PRIMER_FLUSH)-0.ogg
+
+# Vorbis whose MP4 edit list starts after the first second of samples.
+OGG_COPY_TRIM_VORBIS_EDIT = tests/data/fate/ogg-copy-trim-vorbis-edit-list
+FATE_OGG_COPY_TRIM-$(call ALLYES, MOV_DEMUXER VORBIS_DECODER $(OGG_COPY_TRIM_DEPS)) += fate-ogg-copy-trim-vorbis-edit-list
+fate-ogg-copy-trim-vorbis-edit-list: CMD = $(call OGG_COPY_TRIM,$(TARGET_SAMPLES)/mov/mov_neg_first_pts_discard_vorbis.mp4,,$(OGG_COPY_TRIM_VORBIS_EDIT)) && \
+ $(call OGG_CHAIN_COPY_COMPARE,$(OGG_COPY_TRIM_VORBIS_EDIT).pcm,$(OGG_COPY_TRIM_VORBIS_EDIT).copy.pcm,decoded copy)
+fate-ogg-copy-trim-vorbis-edit-list: CLEANFILES = $(addprefix $(OGG_COPY_TRIM_VORBIS_EDIT),$(OGG_COPY_TRIM_FILES))
+
# Opus from Matroska whose last packet carries an end trim.
OGG_COPY_TRIM_OPUS_END = tests/data/fate/ogg-copy-trim-opus-end
FATE_OGG_COPY_TRIM-$(call ALLYES, MATROSKA_DEMUXER OPUS_DECODER $(OGG_COPY_TRIM_DEPS)) += fate-ogg-copy-trim-opus-end
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-clamped b/tests/ref/fate/ogg-copy-trim-vorbis-clamped
new file mode 100644
index 0000000000..c90153c303
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-clamped
@@ -0,0 +1,2 @@
+frame|pts=0|nb_samples=576
+frame|pts=576|nb_samples=1024
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-cut b/tests/ref/fate/ogg-copy-trim-vorbis-cut
new file mode 100644
index 0000000000..a701f5298c
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-cut
@@ -0,0 +1,16 @@
+#extradata 0: 3887, 0x4fb856b4
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: vorbis
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0, -576, -576, 576, 267, 0x5b048bc9, S=1, Strings Metadata, 121, 0xc2832208
+0, 0, 0, 1024, 275, 0x777286f5
+0, 1024, 1024, 1024, 201, 0x0d106229
+0, 2048, 2048, 1024, 204, 0xc1766392
+0, 3072, 3072, 1024, 212, 0xde0b6eca
+0, 4096, 4096, 1024, 224, 0xdba36edc
+streams.stream.0.initial_padding=0
+streams.stream.0.start_time="0.000000"
+decoded copy: 351744 bytes, decoded source: 125240 bytes
+decoded copy: different
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-cut-last b/tests/ref/fate/ogg-copy-trim-vorbis-cut-last
new file mode 100644
index 0000000000..596af00cd3
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-cut-last
@@ -0,0 +1,16 @@
+#extradata 0: 7290, 0xfc246ed3
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: vorbis
+#sample_rate 0: 44100
+#channel_layout_name 0: 5.1
+0, -576, -576, 576, 294, 0xd5816a89, S=1, Strings Metadata, 28, 0x60960600
+0, 0, 0, 1024, 314, 0x05f271fd
+0, 1024, 1024, 1024, 368, 0xbc588efa
+0, 2048, 2048, 1024, 400, 0x3dc39616
+0, 3072, 3072, 1024, 395, 0xc72d9723
+0, 4096, 4096, 1024, 399, 0xa8668fda
+streams.stream.0.initial_padding=0
+streams.stream.0.start_time="0.000000"
+decoded copy: 3091968 bytes, decoded source: 2052 bytes
+end of the decoded copy: different
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-cut-short b/tests/ref/fate/ogg-copy-trim-vorbis-cut-short
new file mode 100644
index 0000000000..f9e6116cc7
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-cut-short
@@ -0,0 +1,16 @@
+#extradata 0: 3887, 0x4fb856b4
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: vorbis
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0, -576, -576, 576, 267, 0x5b048bc9, S=1, Strings Metadata, 121, 0xc2832208
+0, 0, 0, 1024, 275, 0x777286f5
+0, 1024, 1024, 1024, 201, 0x0d106229
+0, 2048, 2048, 1024, 204, 0xc1766392
+0, 3072, 3072, 1024, 212, 0xde0b6eca
+0, 4096, 4096, 1024, 224, 0xdba36edc
+streams.stream.0.initial_padding=0
+streams.stream.0.start_time="0.000000"
+decoded copy: 229376 bytes, decoded source: 125240 bytes
+start of the decoded source: different
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-edit-list b/tests/ref/fate/ogg-copy-trim-vorbis-edit-list
new file mode 100644
index 0000000000..75ad60d7ee
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-edit-list
@@ -0,0 +1,16 @@
+#extradata 0: 3887, 0x4fb856b4
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: vorbis
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0, -45056, -45056, 1024, 270, 0x9f588389, S=1, Strings Metadata, 62, 0xc650157d
+0, -44032, -44032, 1024, 259, 0xcfeb7fad
+0, -43008, -43008, 1024, 260, 0xf34d83b8
+0, -41984, -41984, 1024, 274, 0xbe048550
+0, -40960, -40960, 1024, 273, 0x36e68bf3
+0, -39936, -39936, 1024, 289, 0x0d399472
+streams.stream.0.initial_padding=0
+streams.stream.0.start_time="0.000000"
+decoded copy: 1130496 bytes, decoded source: 954368 bytes
+decoded copy: different
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-offset b/tests/ref/fate/ogg-copy-trim-vorbis-offset
new file mode 100644
index 0000000000..8c2a6f8ce8
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-offset
@@ -0,0 +1,17 @@
+#extradata 0: 3244, 0x21fbfdf4
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: vorbis
+#sample_rate 0: 44100
+#channel_layout_name 0: mono
+0, -128, -128, 128, 28, 0xa5cb0b38, S=1, Strings Metadata, 79, 0xca1515d3
+0, 0, 0, 576, 59, 0xf30f1b21
+0, 576, 576, 1024, 85, 0x34322b3b
+streams.stream.0.initial_padding=0
+streams.stream.0.start_time="0.000000"
+decoded copy: 3200 bytes, decoded source: 2646 bytes
+decoded copy: different
+frame|pts=0|nb_samples=576
+frame|pts=576|nb_samples=1024
+frame|pts=0|nb_samples=576
+frame|pts=576|nb_samples=1024
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-offset-end b/tests/ref/fate/ogg-copy-trim-vorbis-offset-end
new file mode 100644
index 0000000000..2cfc466940
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-offset-end
@@ -0,0 +1 @@
+frame|pts=0|nb_samples=576
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-offset-interior b/tests/ref/fate/ogg-copy-trim-vorbis-offset-interior
new file mode 100644
index 0000000000..d61f0599fd
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-offset-interior
@@ -0,0 +1,4 @@
+frame|nb_samples=576
+frame|nb_samples=1024
+frame|nb_samples=576
+frame|nb_samples=1024
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-primer b/tests/ref/fate/ogg-copy-trim-vorbis-primer
new file mode 100644
index 0000000000..f4e8e3b642
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-primer
@@ -0,0 +1,10 @@
+#extradata 0: 3887, 0x4fb856b4
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: vorbis
+#sample_rate 0: 44100
+#channel_layout_name 0: stereo
+0, 0, 0, 128, 19, 0x478f04ad, S=1, Strings Metadata, 93, 0x016d1f55
+streams.stream.0.initial_padding=0
+streams.stream.0.start_time="0.000000"
+decoded copy: 0 bytes, decoded source: 535040 bytes
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-primer-flush b/tests/ref/fate/ogg-copy-trim-vorbis-primer-flush
new file mode 100644
index 0000000000..9d56b41a39
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-primer-flush
@@ -0,0 +1 @@
+pos=0 serial=1 sequence=2 granule=0 flags=--- segments=1 size=19
diff --git a/tests/ref/fate/ogg-copy-trim-vorbis-shifted b/tests/ref/fate/ogg-copy-trim-vorbis-shifted
new file mode 100644
index 0000000000..39a030682c
--- /dev/null
+++ b/tests/ref/fate/ogg-copy-trim-vorbis-shifted
@@ -0,0 +1 @@
+frame|pts=0|nb_samples=956