Decoding mkv for encoding with mpph264enc

Hi Everyone

I am using this pipeline to save the video in raw for later encoding:

gst-launch-1.0 -e v4l2src do-timestamp=true device=/dev/video0 ! image/jpeg,width=1280,height=800,framerate=60/1 ! queue ! matroskamux ! queue ! filesink location=/test/video.mkv

But when I then want to do the encoding, I have some problem with the element links, any idea how to make it work?

    cmd("gst-launch-1.0 filesrc location=/test/video.mkv ! matroskademux ! queue ! mppjpegdec ! queue ! mpph264enc rc-mode=cbr bps=5000000 level=40 profile=100 ! queue ! h264parse ! splitmuxsink muxer=matroskamux location=/test/videonew-%05d.mkv start-index=1 max-files=600 max-size-time=1000000000")
    Setting pipeline to PAUSED ...
    Pipeline is PREROLLING ...
    ERROR: from element /GstPipeline:pipeline0/GstMatroskaDemux:matroskademux0: Internal data stream error.
    Additional debug info:
    ../gst/matroska/matroska-demux.c(6075): gst_matroska_demux_loop (): /GstPipeline:pipeline0/GstMatroskaDemux:matroskademux0:
    streaming stopped, reason not-negotiated (-4)
    ERROR: pipeline doesn't want to preroll.
    Setting pipeline to NULL ...
    Freeing pipeline ...

cmd("gst-launch-1.0 filesrc location=/test/video.mkv ! matroskademux ! queue ! mppvideodec ! queue ! mpph264enc rc-mode=cbr bps=5000000 level=40 profile=100 ! queue ! h264parse ! splitmuxsink muxer=matroskamux location=/test/videotest-%05d.mkv start-index=1 max-files=600 max-size-time=1000000000")
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
WARNING: from element /GstPipeline:pipeline0/GstMatroskaDemux:matroskademux0: Delayed linking failed.
Additional debug info:
gst/parse/grammar.y(540): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstMatroskaDemux:matroskademux0:
failed delayed linking some pad of GstMatroskaDemux named matroskademux0 to some pad of GstQueue named queue0
ERROR: from element /GstPipeline:pipeline0/GstMatroskaDemux:matroskademux0: Internal data stream error.
Additional debug info:
../gst/matroska/matroska-demux.c(6075): gst_matroska_demux_loop (): /GstPipeline:pipeline0/GstMatroskaDemux:matroskademux0:
streaming stopped, reason not-linked (-1)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...