gstreamergst-launch

How to use the gst-launch to play unaligned raw video data files?


I have a 426x240 nv12 data file, I use the following command to play it, the resulting playback picture is distorted.

gst-launch-1.0 filesrc location=426x240-nv12-25fps-5s.yuv ! videoparse format=nv12 width=426 height=240 framerate=1/1 ! videoconvert ! autovideosink

I suspect that this problem is related to byte alignment. The width of the above file is 426, which is not 4-byte aligned; for some other 4-byte-aligned files, such as 428x240, 640x480, etc., using such commands can be played correctly:

gst-launch-1.0 filesrc location=428x240-nv12-25fps-5s.yuv ! videoparse format=nv12 width=428 height=240 framerate=1/1 ! videoconvert ! autovideosink

I'm wondering if I've made a mistake somewhere; or is this simply not capable of playing a file like this.

Can someone help me out, thank you very much


Solution

  • rawvideoparse element have plane-offsets, plane-strides and frame-size property to work around this.

    gst-launch-1.0 filesrc location=426x240-nv12-25fps-5s.yuv ! rawvideoparse format=nv12 width=426 height=240 framerate=1/1 'plane-strides=<426,426>' 'plane-offsets=<0,102240>' ! videoconvert ! autovideosink