Matroskamux and changes to SPS/PPS

Hello codec hackers!

We had a customer ingesting video to us have a bad experience … it turned out our pipeline with a matroskamux kept erroring out because some values in SPS/PPS kept changing in the input stream.

To be exact the Seq parameter set ID and Pic parameter set ID switched values during streaming which caused GStreamer error:

```
Failed to run switchboard Error(src: /GstPipeline:Switchboard/GstSplitMuxSink:splitmuxsink0/GstMatroskaMux:muxer_168, message: Could not multiplex stream.), debug: ../subprojects/gst-plugins-good/gst/matroska/matroska-mux.c(1132): gst_matroska_mux_video_pad_setcaps (): /GstPipeline:Switchboard/GstSplitMuxSink:splitmuxsink0/GstMatroskaMux:muxer_168: Caps changes are not supported by Matroska Current: `video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0164002affe100276764002a2acb403c0113f2e022000003000200000300c9c04000112a8800022551c58500f1832a01000568296f3cb0, level=(string)4.2, profile=(string)high, pixel-aspect-ratio=(fraction)1/1, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true` New: `video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)0164002affe200276764002a2acb403c0113f2e022000003000200000300c9c04000112a8800022551c58500f1832a00266764002a32cb403c0113f2e022000003000200000300c9c8c000d5de0006aefc58500f1832a002000568296f3cb000056831af3cb0, level=(string)4.2, profile=(string)high, pixel-aspect-ratio=(fraction)1/1, width=(int)1920, height=(int)1080, framerate=(fraction)50/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
```

Is this something we can get around? Is the matroskamux to strict here? Or within its rights?

All the best
Jonas

Whilst it is possible technically, this isn’t really conformant with the Matroska spec as far as I know, that’s why we don’t allow it by default.

However, if you force the input format to the muxer to video/x-h264, stream-format=avc3 then I believe it will accept sps/pps/caps changes within reason.

Files created like that may or may not play properly elsewhere then.

(This is from memory, I didn’t check if it works)

Thanks, it worked in local testing with switching cabal on x264enc at least! Not sure how to provoke the exact thing this funky stream does.