Re: media: videobuf2: Fails to scale H264 1080p video on 1920x1080 screen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le vendredi 20 août 2021 à 08:55 +0000, trung1.dothanh@xxxxxxxxxxxxx a écrit :
> Hello,
> 
> I am trying to play video with Gstreamer  on a fullHD monitor. The board I’m using is Apalis iMX6.
> Playing video works great with v4l2h264dec:
> 
> 	gst-launch-1.0 filesrc location=1080.mkv ! matroskademux ! h264parse \
>                           ! v4l2h264dec capture-io-mode=dmabuf \
>                           ! kmssink
> 
> However, it fails to scale video to 720p with v4l2convert:
> 
> 	gst-launch-1.0 filesrc location=1080.mkv ! matroskademux ! h264parse \
>                           ! v4l2h264dec capture-io-mode=dmabuf \
>                           ! v4l2convert output-io-mode=dmabuf-import \
>                           ! video/x-raw,width=1280,height=720 \
>                           ! kmssink
> 
> Added some debugs and I found that it failed at 'drivers/media/common/videobuf2/videobuf2-v4l2.c:__verify_length()'.
> 
> 	length = (b->memory == VB2_MEMORY_USERPTR)

Wrong snippet ? You are using VB2_MEMORY_DMABUF according to your GStreamer
pipeline.

> 		? b->length : vb->planes[0].length;
> 	if (b->bytesused > length)
> 		return -EINVAL;
> 
> The “b->byteused” is 4177920 (= 2 x 1920 x 1088), while plane length is just 4147200 (= 2 x 1920 x 1080).
> The actual frame size of H264 video is 1920x1088, so I added  a bypass for this case and video can be scaled,
> but that may not a correct way to fix this problem.
> 
> Is this a bug or I need to do extra steps before scale video?

I'm not fully certain of what has gone wrong, since this call was added
(1.18.0), this code path is supposed to work:

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/master/sys/v4l2/gstv4l2transform.c#L905

GStreamer will update the driver FMT to padded width/height before calling
streamon and S_SELECTION is used to tell the scaler which part is to be used in
the scaling process.

> 
> Packages version in my environment are:
> * Kernel: 5.10.19
> * Gstreamer: 1.18.4
> 
> Thank you,
> Trung
> 





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux