Hardware decoding error NVMAP_IOC_READ failed

gst-launch-1.0 filesrc location=x.raw ! queue ! h264parse ! omxh264dec ! nvvidconv ! video/x-raw,format=RGBA ! videoconvert ! video/x-raw,format=RGB ! glimagesink

x.raw contains 2 sequences raw encoded h264 frames of different width and height

The above pipeline produces NVMAP_IOC_READ failed when the file reaches the 2nd sequence of different width and height

How can I solve this problem?

I want to be able to decode h264 raw frames of variable (width/height) as fast as possible and get RGB format at appsink.

Dynamic resolution change is not supported in this usecase. Suggest you try tegra_multimedia_api and refer to 00_video_decode.