Unexpected buffer offset sending raw video through fdsink/fdsrc

Looking at this case:

Seems the JPEG transcoding with:

gst-launch-1.0 filesrc location=test_h264.mp4 ! qtdemux ! h264parse ! avdec_h264 ! jpegenc ! fdsink \
| gst-launch-1.0 fdsrc ! 'image/jpeg,sof-marker=(int)0, width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)180/1, interlace-mode=(string)progressive, colorimetry=(string)bt601, chroma-site=(string)jpeg' ! jpegdec ! videorate ! video/x-raw,framerate=30/1 ! x264enc ! h264parse ! 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)2, profile=(string)high,width=(int)320, height=(int)240, framerate=(fraction)30/1' ! qtmux ! filesink location=testOut_JPG.mp4

results in correct video.

Though, using raw video in I420 format instead results in wrong video with an unexpected offset (at least on X axis):

gst-launch-1.0 filesrc location=test_h264.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw,format=I420,width=320,height=240,framerate=30/1 ! fdsink \
| gst-launch-1.0 fdsrc ! videoparse format=i420 width=320 height=240 framerate=180 ! video/x-raw,format=I420,width=320,height=240,framerate=180/1 ! videorate ! video/x-raw,format=I420,framerate=30/1 ! x264enc ! h264parse ! 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)2, profile=(string)high, width=(int)320, height=(int)240, framerate=(fraction)30/1' ! qtmux ! filesink location=testOut_I420.mp4

I’m using GStreamer 1.20.3 (arm64 NVIDIA AGX Orin).
Left: JPG transcoding, right: using I420 (note the green line on top, 256 bytes offset for Y ?)
image

Am I missing something or it is a bug in some element ?

I think the problem here is that you’re sending the data through a file descriptor, which removes any signalling information (caps etc.), and then on the receiver side the rawvideoparse just makes assumptions about the row strides and/or plane offsets/sizes of the image. The video decoder might however have output a different rowstride, so if there’s a mismatch you get shifts.

Also, gst-launch-1.0 will output things to the terminal, so that will be interpreted as pixel data if you don’t pass -q.

Thanks Tim, indeed I had missed the quiet flag.