video playback with gstreamer is choppy / laggy on raspberry pi 4

David Leibovic david.leibovic at gmail.com
Sun Jun 6 05:35:05 UTC 2021


Hello, I am trying to use gstreamer to play a 1080p H264 video. When I play
the video, the playback is slightly choppy / laggy.

Here is how I installed gstreamer and the required plugins:

sudo apt-get install gstreamer1.0-tools gstreamer1.0-plugins-base-apps
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad

I have a test video which you may download here:
https://www.dropbox.com/s/ayeb8816wii6d
... t.mp4?dl=0
<https://www.dropbox.com/s/ayeb8816wii6dwu/audio_video_sync_test.mp4?dl=0>

Here we can see the test video is indeed 1080p h264 format:

% ffprobe audio_video_sync_test.mp4
...
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661),
yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 295 kb/s, 30 fps, 30
tbr, 15360 tbn, 60 tbc (default)
...

And finally, I play the video with gstreamer:

% gst-launch-1.0 -e -vvv filesrc location=audio_video_sync_test.mp4 !
qtdemux ! h264parse ! v4l2h264dec ! kmssink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstKMSSink:kmssink0: display-width = 640
/GstPipeline:pipeline0/GstKMSSink:kmssink0: display-height = 480
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps =
video/x-h264, stream-format=(string)avc, alignment=(string)au,
level=(string)4, profile=(string)high,
codec_data=(buffer)01640028ffe1001e67640028acd100780227e5c05a808080a0000003002000000781e306224001000468ebef2c,
width=(int)1920, height=(int)1080, framerate=(fraction)30/1,
pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps =
video/x-h264, stream-format=(string)byte-stream, alignment=(string)au,
level=(string)4, profile=(string)high, width=(int)1920,
height=(int)1080, framerate=(fraction)30/1,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive,
chroma-format=(string)4:2:0, bit-depth-luma=(uint)8,
bit-depth-chroma=(uint)8, parsed=(boolean)true
/GstPipeline:pipeline0/v4l2h264dec:v4l2h264dec0.GstPad:sink: caps =
video/x-h264, stream-format=(string)byte-stream, alignment=(string)au,
level=(string)4, profile=(string)high, width=(int)1920,
height=(int)1080, framerate=(fraction)30/1,
pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive,
chroma-format=(string)4:2:0, bit-depth-luma=(uint)8,
bit-depth-chroma=(uint)8, parsed=(boolean)true
/GstPipeline:pipeline0/v4l2h264dec:v4l2h264dec0.GstPad:src: caps =
video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080,
interlace-mode=(string)progressive, multiview-mode=(string)mono,
multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono,
pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2,
colorimetry=(string)bt709, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstKMSSink:kmssink0.GstPad:sink: caps =
video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080,
interlace-mode=(string)progressive, multiview-mode=(string)mono,
multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono,
pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2,
colorimetry=(string)bt709, framerate=(fraction)30/1
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

The playback is mostly ok, but as you can see it is occasionally a bit
laggy. The same video plays without any lag with vlc or omxplayer. Playback
with gstreamer uses only about 4% CPU, so I figure it must be using
hardware decoding. Any idea what the issue is?

Here is info about my OS in case it is helpful (I'm just using the default
OS)

% uname -a
Linux piwall2 5.4.83-v7l+ #1379 SMP Mon Dec 14 13:11:54 GMT 2020
armv7l GNU/Linux

Thanks for looking!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20210606/47641b56/attachment.htm>


More information about the gstreamer-devel mailing list