GStreamer on iMX6 UDP stream video size problem

Hello,

I want to stream video with UDP using VLC on computer and play the video on my iMX6. I wrote a Qt app for this. The video is playing, but only a small part of the video is visible on the screen from the top left instead of the whole video on the panel.

I’ve created a picture to be more illustrative.

The part I use in Qt:

    MediaPlayer {
        id: mediaplayer
        source: "udp://x.x.x.x:1234"
        autoPlay: true
    }
    VideoOutput {
        anchors.fill: parent
        source: mediaplayer
    }

Then I tried it with the GStreamer pipeline.

# gst-launch-1.0 playbin uri=udp://x.x.x.x:1234

The video plays again, but the result has not changed. I think it detects the video as 176x144. The output is as follows:

====== AIUR: 4.5.2 build on Dec 28 2020 09:09:09. ======
	Core: BLN_MAD-MMLAYER_MPG2PARSER_04.06.02  build on Jun 13 2019 08:07:41
 file: /usr/lib/imx-mm/parser/lib_mpg2_parser_arm11_elinux.so.3.1
------------------------
    Track 00 [audio_0] Enabled
	Duration: 0:00:00.000000000
	Language: und
    Mime:
	audio/mpeg, mpegversion=(int)1, channels=(int)2, rate=(int)44100, bitrate=(int)0 
------------------------
------------------------
    Track 01 [video_0] Enabled
	Duration: 0:00:00.000000000
	Language: und
    Mime:
	video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)byte-stream, width=(int)176, height=(int)144, framerate=(fraction)30/1 
------------------------
display(/dev/fb0) resolution is (1280x800).
====== OVERLAYSINK: 4.5.2 build on Dec 28 2020 09:09:17. ======
display(/dev/fb0) resolution is (1280x800).
[INFO]	bitstreamMode 1, chromaInterleave 0, mapType 0, tiled2LinearEnable 0

Btw, I am using B2Qt image. How can I play the video correctly?

Best regards

Dear @muratc98 ,

About the correct usage of gst-launch, here is an article in our Developer page that you can refer to: QtGStreamer: examples/player/main.cpp

And furthermore, here is a sample application for a gstreamer sample app on Qt, for you to cross-verify with:

As you mentioned you use the Boot2Qt, i would like to mention that If it is the commercial version of Qt, Qt provides support on such questions, in case teh problem lies with the Qt side.

Hope this helps!

Best Regards,
Janani

Dear @saijanani.tx ,

Thanks for your reply.

The first link you send is an example from the QtGStreamer library. However, as I mentioned in the first post, I tried it with QtMultimedia in my own Qt application and saw GStreamer output in the debug. QtMultimedia is already working with GStreamer. In fact, a special GStreamer pipeline command can be specified in the source section on the documentation page.

https://doc.qt.io/qt-5/qml-qtmultimedia-mediaplayer.html#source-prop

It can also be used for Cpp instead of Qml.

https://doc.qt.io/qt-5/qmediaplayer.html#setMedia

I pass a command like the following as a pipeline in Qt app. However, the result is still the same.

"gst-pipeline: playbin uri=udp://x.x.x.x:1234"

Actually I think the problem is directly related to GStreamer. There is no problem on the Qt side. Video is not detected in correct size and the output shows that the video resolution is different.

When I try this application on an Ubuntu PC, GStreamer correctly recognizes the video frame size and the video is displayed properly. It also gives the correct output when I run the GStreamer command directly.

The second link is the same as the link on this topic. So I could not understand. I think you sent the wrong link.

I would also like to mention that I can copy the video directly to the board and open it correctly with Qt app and GStreamer via the file path.

Best regards

Hello @muratc98 ,

Thank you for your comment. In that case, you are sure that the issue lies with the Gstreamer, I would like to ask you if you have tried the “videoscale” feature of the GStreamer.

Something like this maybe,

 gst-launch-1.0 -v playbin uri=udp://x.x.x.x:1234 ! videoscale ! autovideosink video/x-raw,width=xxx,height=xxx !    

More on videoscale here:

https://gstreamer.freedesktop.org/documentation/videoscale/index.html?gi-language=c

or maybe,

Best Regards,
Janani

Hello @saijanani.tx ,

I’m sorry for the late reply.

Playbin element does not connect with videoscale. Actually it does not connect with almost any element. It automatically recognizes the video.

So I tried to create a custom pipeline myself by referencing the link below.

http://trac.gateworks.com/wiki/Yocto/gstreamer/streaming

The video is displayed in 720p when I run the following command.

gst-launch-1.0 udpsrc port=1234 ! h264parse ! imxvpudec ! imxipuvideosink sync=false

However, this time, an image similar to the one below appears and the video opens with distortion.

Hello @muratc98 ,

Have you also used RTP or RTSP along with this?
http://trac.gateworks.com/wiki/Yocto/gstreamer/streaming#rtp

Furthermore, it is not very clear to me why the sync=false.

When you use the Gstreamer-imx sinks, I would expect something like this,

gst-launch-1.0 udpsrc port=1234 ! h264parse ! imxvpudec ! imxipuvideotransform ! imxipuvideosink

You can also find more on that topic here: Yocto/gstreamer/video – Gateworks

Best Regards,
Janani.

I finally found a solution. I can access the video without any problem using the command below:

gst-launch-1.0 udpsrc port=1234 ! parsebin ! avdec_h264 ! imxipuvideosink sync=false

When I do not write sync=false, the stream may be corrupted. However, when I write, it plays the video very fluently. I don’t know why either.

Anyway, the problem is solved.

Thank you for your help.

Hello @muratc98 ,

You’re welcome and I am glad you could make it work

Best Regards,
Janani