diff --git a/tests/fate/hlsenc.mak b/tests/fate/hlsenc.mak
index 2a125cda3c..e24605b7d6 100644
--- a/tests/fate/hlsenc.mak
+++ b/tests/fate/hlsenc.mak
@@ -74,3 +74,15 @@ FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER MPEGTS_DEMUXER AEVALSRC_FIL
 fate-hls-list-size: tests/data/hls_list_size.m3u8
 fate-hls-list-size: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/hls_list_size.m3u8 -vf setpts=N*23
 
+tests/data/hls_segment_type_fmp4.m3u8: TAG = GEN
+tests/data/hls_segment_type_fmp4.m3u8: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
+	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
+	-f lavfi -re -i "aevalsrc=cos(2*PI*t)*sin(2*PI*(440+4*t)*t):d=5" -map 0 -codec:a mp2fixed \
+	-hls_segment_type mpegts -hls_fmp4_init_filename now.mp4 -use_localtime 1 -hls_list_size 0 \
+	-hls_time 1 -hls_segment_filename "$(TARGET_PATH)/tests/data/%Y-%m-%d_%H-%M-%S.m4s" \
+	$(TARGET_PATH)/tests/data/hls_fmp4.m3u8 2>aaaaaa.txt
+
+FATE_AFILTER-$(call ALLYES, HLS_DEMUXER MPEGTS_MUXER MPEGTS_DEMUXER AEVALSRC_FILTER LAVFI_INDEV MP2FIXED_ENCODER) += fate-hls-fmp4
+fate-hls-fmp4: tests/data/hls_segment_type_fmp4.m3u8
+fate-hls-fmp4: CMD = framecrc -flags +bitexact -i $(TARGET_PATH)/tests/data/hls_fmp4.m3u8 -vf setpts=N*23
+
diff --git a/tests/ref/fate/hls-fmp4 b/tests/ref/fate/hls-fmp4
new file mode 100644
index 0000000000..98b037fc8f
--- /dev/null
+++ b/tests/ref/fate/hls-fmp4
@@ -0,0 +1,198 @@
+#tb 0: 1/44100
+#media_type 0: audio
+#codec_id 0: pcm_s16le
+#sample_rate 0: 44100
+#channel_layout 0: 4
+#channel_layout_name 0: mono
+0,          0,          0,     1152,     2304, 0x907cb7fa
+0,       1152,       1152,     1152,     2304, 0xb8dc7525
+0,       2304,       2304,     1152,     2304, 0x3e7d6905
+0,       3456,       3456,     1152,     2304, 0xef47877b
+0,       4608,       4608,     1152,     2304, 0xfe916b7e
+0,       5760,       5760,     1152,     2304, 0xe3d08cde
+0,       6912,       6912,     1152,     2304, 0xff7f86cf
+0,       8064,       8064,     1152,     2304, 0x843e6f95
+0,       9216,       9216,     1152,     2304, 0x81577c26
+0,      10368,      10368,     1152,     2304, 0x04a085d5
+0,      11520,      11520,     1152,     2304, 0x1c5a76f5
+0,      12672,      12672,     1152,     2304, 0x4ee78623
+0,      13824,      13824,     1152,     2304, 0x8ec861dc
+0,      14976,      14976,     1152,     2304, 0x0ca179d8
+0,      16128,      16128,     1152,     2304, 0xc6da750f
+0,      17280,      17280,     1152,     2304, 0xf6bf79b5
+0,      18432,      18432,     1152,     2304, 0x97b88a43
+0,      19584,      19584,     1152,     2304, 0xf13c7b9c
+0,      20736,      20736,     1152,     2304, 0xdfba83af
+0,      21888,      21888,     1152,     2304, 0xc9467d4b
+0,      23040,      23040,     1152,     2304, 0xbbb58e2b
+0,      24192,      24192,     1152,     2304, 0x3a1078ea
+0,      25344,      25344,     1152,     2304, 0xe9587a5c
+0,      26496,      26496,     1152,     2304, 0xef5a8039
+0,      27648,      27648,     1152,     2304, 0x9d5f782f
+0,      28800,      28800,     1152,     2304, 0x1a548291
+0,      29952,      29952,     1152,     2304, 0x07517701
+0,      31104,      31104,     1152,     2304, 0x78127d6e
+0,      32256,      32256,     1152,     2304, 0x62e2788a
+0,      33408,      33408,     1152,     2304, 0x29397ad9
+0,      34560,      34560,     1152,     2304, 0x45da82d6
+0,      35712,      35712,     1152,     2304, 0x8ed66e51
+0,      36864,      36864,     1152,     2304, 0x660775cd
+0,      38016,      38016,     1152,     2304, 0x802c767a
+0,      39168,      39168,     1152,     2304, 0xcc055840
+0,      40320,      40320,     1152,     2304, 0x701b7eaf
+0,      41472,      41472,     1152,     2304, 0x8290749f
+0,      42624,      42624,     1152,     2304, 0x2c7b7d30
+0,      43776,      43776,     1152,     2304, 0xe4f17743
+0,      44928,      44928,     1152,     2304, 0x0e747d6e
+0,      46080,      46080,     1152,     2304, 0xbe7775a0
+0,      47232,      47232,     1152,     2304, 0xcf797673
+0,      48384,      48384,     1152,     2304, 0x29cb7800
+0,      49536,      49536,     1152,     2304, 0xfc947890
+0,      50688,      50688,     1152,     2304, 0x62757fc6
+0,      51840,      51840,     1152,     2304, 0x098876d0
+0,      52992,      52992,     1152,     2304, 0xa9567ee2
+0,      54144,      54144,     1152,     2304, 0xe3bb9173
+0,      55296,      55296,     1152,     2304, 0xcc2d6dee
+0,      56448,      56448,     1152,     2304, 0xe94591ab
+0,      57600,      57600,     1152,     2304, 0x5c7588de
+0,      58752,      58752,     1152,     2304, 0xfd83643c
+0,      59904,      59904,     1152,     2304, 0x528177f1
+0,      61056,      61056,     1152,     2304, 0x65d08474
+0,      62208,      62208,     1152,     2304, 0x738d765b
+0,      63360,      63360,     1152,     2304, 0xdd3d810e
+0,      64512,      64512,     1152,     2304, 0xef4f90d3
+0,      65664,      65664,     1152,     2304, 0x61e28d43
+0,      66816,      66816,     1152,     2304, 0x9a11796b
+0,      67968,      67968,     1152,     2304, 0x96c97dcd
+0,      69120,      69120,     1152,     2304, 0xa8fe8621
+0,      70272,      70272,     1152,     2304, 0x499b7d38
+0,      71424,      71424,     1152,     2304, 0xfcb078a9
+0,      72576,      72576,     1152,     2304, 0x40d78651
+0,      73728,      73728,     1152,     2304, 0xa4af7234
+0,      74880,      74880,     1152,     2304, 0x6831870a
+0,      76032,      76032,     1152,     2304, 0x030e7b9d
+0,      77184,      77184,     1152,     2304, 0x445a75b6
+0,      78336,      78336,     1152,     2304, 0x09857389
+0,      79488,      79488,     1152,     2304, 0x0d018866
+0,      80640,      80640,     1152,     2304, 0x2afe810a
+0,      81792,      81792,     1152,     2304, 0x0bcf7c43
+0,      82944,      82944,     1152,     2304, 0x13737c12
+0,      84096,      84096,     1152,     2304, 0x716c7bba
+0,      85248,      85248,     1152,     2304, 0xb801823b
+0,      86400,      86400,     1152,     2304, 0x0fd573ee
+0,      87552,      87552,     1152,     2304, 0xe1ab879c
+0,      88704,      88704,     1152,     2304, 0x49e6764f
+0,      89856,      89856,     1152,     2304, 0xd5f26ddc
+0,      91008,      91008,     1152,     2304, 0x076775ff
+0,      92160,      92160,     1152,     2304, 0xfbb86fce
+0,      93312,      93312,     1152,     2304, 0x20c56858
+0,      94464,      94464,     1152,     2304, 0x043e6891
+0,      95616,      95616,     1152,     2304, 0x59648729
+0,      96768,      96768,     1152,     2304, 0xd4907a63
+0,      97920,      97920,     1152,     2304, 0xd0208a4c
+0,      99072,      99072,     1152,     2304, 0xce968383
+0,     100224,     100224,     1152,     2304, 0x3cfc7cd1
+0,     101376,     101376,     1152,     2304, 0x628a7bf5
+0,     102528,     102528,     1152,     2304, 0x9cfe8a4f
+0,     103680,     103680,     1152,     2304, 0xdf6f7c6d
+0,     104832,     104832,     1152,     2304, 0x6cf6882a
+0,     105984,     105984,     1152,     2304, 0x099773a3
+0,     107136,     107136,     1152,     2304, 0x4a1c7649
+0,     108288,     108288,     1152,     2304, 0x31ea71cb
+0,     109440,     109440,     1152,     2304, 0xed127ed9
+0,     110592,     110592,     1152,     2304, 0x5b156954
+0,     111744,     111744,     1152,     2304, 0xdd638532
+0,     112896,     112896,     1152,     2304, 0xf1a271f2
+0,     114048,     114048,     1152,     2304, 0x779184d7
+0,     115200,     115200,     1152,     2304, 0x49a88aa8
+0,     116352,     116352,     1152,     2304, 0xa11b7c90
+0,     117504,     117504,     1152,     2304, 0xbf488274
+0,     118656,     118656,     1152,     2304, 0x002f79a8
+0,     119808,     119808,     1152,     2304, 0x0ed97e2f
+0,     120960,     120960,     1152,     2304, 0x7845878f
+0,     122112,     122112,     1152,     2304, 0x46d777dc
+0,     123264,     123264,     1152,     2304, 0x8d0179e3
+0,     124416,     124416,     1152,     2304, 0x38917f9f
+0,     125568,     125568,     1152,     2304, 0x449876e7
+0,     126720,     126720,     1152,     2304, 0x001a8769
+0,     127872,     127872,     1152,     2304, 0x06c1826b
+0,     129024,     129024,     1152,     2304, 0x41b68047
+0,     130176,     130176,     1152,     2304, 0xeb9782c6
+0,     131328,     131328,     1152,     2304, 0x7cd9719c
+0,     132480,     132480,     1152,     2304, 0x3a4a767c
+0,     133632,     133632,     1152,     2304, 0x7f887e81
+0,     134784,     134784,     1152,     2304, 0xf75d714b
+0,     135936,     135936,     1152,     2304, 0x33b57e9f
+0,     137088,     137088,     1152,     2304, 0xc732749e
+0,     138240,     138240,     1152,     2304, 0x386f7e1a
+0,     139392,     139392,     1152,     2304, 0x6b9c767d
+0,     140544,     140544,     1152,     2304, 0x701c83e5
+0,     141696,     141696,     1152,     2304, 0xb92571e1
+0,     142848,     142848,     1152,     2304, 0x833a84bc
+0,     144000,     144000,     1152,     2304, 0x1b6984e0
+0,     145152,     145152,     1152,     2304, 0x1b2474ba
+0,     146304,     146304,     1152,     2304, 0xc22775a6
+0,     147456,     147456,     1152,     2304, 0x3e8f7972
+0,     148608,     148608,     1152,     2304, 0x17a28a65
+0,     149760,     149760,     1152,     2304, 0x9b6178a4
+0,     150912,     150912,     1152,     2304, 0x5d707873
+0,     152064,     152064,     1152,     2304, 0x68e2645a
+0,     153216,     153216,     1152,     2304, 0x1e377d28
+0,     154368,     154368,     1152,     2304, 0x54b384be
+0,     155520,     155520,     1152,     2304, 0x0617808c
+0,     156672,     156672,     1152,     2304, 0xbc2b8a6c
+0,     157824,     157824,     1152,     2304, 0x7ced7180
+0,     158976,     158976,     1152,     2304, 0xf22180ab
+0,     160128,     160128,     1152,     2304, 0xf13682c9
+0,     161280,     161280,     1152,     2304, 0x7eff87fd
+0,     162432,     162432,     1152,     2304, 0x5a0b5cec
+0,     163584,     163584,     1152,     2304, 0x57c18906
+0,     164736,     164736,     1152,     2304, 0xb55a6a16
+0,     165888,     165888,     1152,     2304, 0xf2608371
+0,     167040,     167040,     1152,     2304, 0x36df7576
+0,     168192,     168192,     1152,     2304, 0xdb106fb4
+0,     169344,     169344,     1152,     2304, 0x7e4f85d0
+0,     170496,     170496,     1152,     2304, 0xe3ee78ab
+0,     171648,     171648,     1152,     2304, 0xd36b7dc7
+0,     172800,     172800,     1152,     2304, 0xadab7c5c
+0,     173952,     173952,     1152,     2304, 0x70786f26
+0,     175104,     175104,     1152,     2304, 0xcd5d717e
+0,     176256,     176256,     1152,     2304, 0xc1a96f9a
+0,     177408,     177408,     1152,     2304, 0xad777887
+0,     178560,     178560,     1152,     2304, 0x98277c16
+0,     179712,     179712,     1152,     2304, 0x868882c5
+0,     180864,     180864,     1152,     2304, 0xc48092b9
+0,     182016,     182016,     1152,     2304, 0x230069da
+0,     183168,     183168,     1152,     2304, 0x14147ad6
+0,     184320,     184320,     1152,     2304, 0xc9007172
+0,     185472,     185472,     1152,     2304, 0x85d67bcc
+0,     186624,     186624,     1152,     2304, 0x22418bab
+0,     187776,     187776,     1152,     2304, 0xe53c8b71
+0,     188928,     188928,     1152,     2304, 0x5a1a9053
+0,     190080,     190080,     1152,     2304, 0x9cd179af
+0,     191232,     191232,     1152,     2304, 0xbb3c7d72
+0,     192384,     192384,     1152,     2304, 0x477a8677
+0,     193536,     193536,     1152,     2304, 0xe3337834
+0,     194688,     194688,     1152,     2304, 0x1cb56d77
+0,     195840,     195840,     1152,     2304, 0xe89d6dac
+0,     196992,     196992,     1152,     2304, 0xd468827e
+0,     198144,     198144,     1152,     2304, 0xebc46b87
+0,     199296,     199296,     1152,     2304, 0x5fbb78d2
+0,     200448,     200448,     1152,     2304, 0xa1b483d6
+0,     201600,     201600,     1152,     2304, 0x6fec7cab
+0,     202752,     202752,     1152,     2304, 0xd86d6f6c
+0,     203904,     203904,     1152,     2304, 0x8c2c7d51
+0,     205056,     205056,     1152,     2304, 0xe8377cd7
+0,     206208,     206208,     1152,     2304, 0xb57071b4
+0,     207360,     207360,     1152,     2304, 0xc35c71fd
+0,     208512,     208512,     1152,     2304, 0x789079e9
+0,     209664,     209664,     1152,     2304, 0x413b710e
+0,     210816,     210816,     1152,     2304, 0x82678332
+0,     211968,     211968,     1152,     2304, 0xe1576e75
+0,     213120,     213120,     1152,     2304, 0x7c0b7ad6
+0,     214272,     214272,     1152,     2304, 0xc6b6786d
+0,     215424,     215424,     1152,     2304, 0x736f7b89
+0,     216576,     216576,     1152,     2304, 0x0ded72f1
+0,     217728,     217728,     1152,     2304, 0xcb877a3c
+0,     218880,     218880,     1152,     2304, 0x7c497d40
+0,     220032,     220032,     1152,     2304, 0xb4a77052
