QtAV icon indicating copy to clipboard operation
QtAV copied to clipboard

QtAV QML playback performance appears to be "stuttering" [$150]

Open kiwimagic opened this issue 8 years ago • 8 comments

Hello.

We are not sure that the QtAV (QML) Video we are using has been implemented correctly. Any help to point us in the right direction and/or help us resolve this would be greatly appreciated.

We have up to 4 QML Video Preview areas that are pointing at live streams generated on the local machine (no networking delay we are aware of). The video feeds are stuttering and/or going black(appearing to stop altogether), at random intervals after starting the previews. VLC previewing of the same streams does not result in any stuttering or stopping.

"Stuttering" is defined as when watching a video via the QML Video player the picture "freezes" and jumps 3-4 seconds then plays briefly followed by another 3-4 second freeze then another 3-4 second freeze. For example the timecode on screen stops at 10:37:30 then when video starts moving again the timecode immediately displays as 10:41:30.

  • Environment
  • ubuntu 14.04 LTS
  • Application is qt written in C++ with GUI using qml.
QML used:
	Video {
    	id: video
    	property alias status:  video.status
    	anchors.fill: parent
    	fillMode: VideoOutput.PreserveAspectFit
    	source: encodedStreamUrl
    	muted: !muteId.checked
		}// end video
Separate button used to start & stop previewer.
            Button {
                id: playId
                style: Style.playerButtonStyle
                text: "../images/video_play3x.png"
                width: parent.width //* .1
               height: width -12
                checkable: true
                tooltip: "Preview: Toggle preview on and off"
                onCheckedChanged: {
                    if (checked)
                       video.play();
                    else
                       video.stop();
                }
            }

Tests performed with results:

  1. Scenario: All 4 inputs set with an active video stream. Results: All 4 players stuttered and display our custom buffering loading indicator (visible when playId.checked && video.status !== MediaPlayer.Buffered) sporadically throughout process. Stream #1 ends up going black after stuttering approx 30mins. (log attached)

  2. Scenario: Input #1 set with active video stream.
    Result: Stuttering experienced - left this running for several minutes - stuttering continued. Stopped preview. Video reviewed via VLC - no stuttering displayed. (Log attached stuttering continued to end of log.)

  3. All 4 inputs set with an active video stream. All 4 players stutter sporadically throughout process. Stream 3 & 4 almost immediately display the stuttering, 1 & 2 followed closely behind. I ran this test for about 3 minutes Log attached. Review of saved video files shows no stuttering. (log attached)

Test2_singleInputStutteringAtEndOfLog.txt Test3_3minsAll4InputsWritingAndStuttering.txt Test1_4inputsdebuginput1blackscreenand buffering at end.txt


There is a $150 open bounty on this issue. Add to the bounty at Bountysource.

kiwimagic avatar Apr 11 '17 23:04 kiwimagic

Hi, I read your reply in issue 826 and I'd like to share with you some info. This issue is not a 100% occurrence one on my PC or Mac, especially when I am using a released version compiled by myself to play a .ts stream or local file. But it does occur frequently on some other PC or Mac, I wrote a minimal QML player to exclude the possible error from my codes and can reproduce it from time to time. Have you tried run it in debug and see the similar log like mine attched in 826? If so, then I believe these two issues are identical. I also tried debugging it on my own, from what I can tell, it is likely to be an avsync issue, for some reason the video lagged too much so that a lot of frames are dropped there after because it applies an audio master method. I don't think the video data is really coming late because I am playing a local .ts file and other player such as VLC, kLite, window media player can play it smoothly, even the test sample can play it well for some times. I also tried modify it to video-master, with no luck. Then I gave it up. I might spend extra time investigating it when I am free. Thanks.

laborysun avatar Apr 19 '17 03:04 laborysun

As an update to anyone looking at this. We believe the issue we are seeing relates to the buffer. We are currently testing a solution that effectively turns the buffer off - in debug this is performing beautifully for our needs after 2 days of various tests. We are continuing to test and if continue to be happy with the result I will post the changes we made here to get @wang-bin opinion on the approach .... and to verify we are not breaking anything we have not thought of!

kiwimagic avatar Apr 20 '17 14:04 kiwimagic

@laborysun yes we do see some similarities in logs e.g. continual "waiting for key frame". and "frame slow count: " etc however as we don't know what "normal/expected" is I can't guarantee this to be indicator of being exactly the same....

kiwimagic avatar Apr 20 '17 14:04 kiwimagic

Spoke too soon :( , after expanding testing to 4 video inputs and also a different environment that uses i7 processor we are seeing what can only be described as tearing along with intermittent pixelation, freezing and stuttering, even with as little as 2 inputs running. We have played with all buffer options we can see throughout the code but can't come up with a combination that works consistently reliably / stable. Updated QtAV to latest build and removed all customisations to start from scratch again. If anyone has any suggestions please share... its like the preview just can't keep up with the realtime video streams. One video preview went black (audio still going), stopping and starting the previewer appears to bring the video back for a period then the cycle starts again.

kiwimagic avatar Apr 28 '17 03:04 kiwimagic

@kiwimagic, hi. Contact me via mail: [email protected].

Killerbeans avatar May 10 '17 16:05 Killerbeans

@wang-bin re seeing stuttering in video is there anywhere specifically you can point us to look at or anything to try out? There appear to be several issues logged experiencing video stuttering. See @obeezzy #872 and @laborysun #826 (and maybe @noxee and @khanhlv1407 #571) None have been tagged as a bug... is this maybe because you feel it is something we are doing/have set up wrong? I appreciate you are undoubtedly very busy but any guidance would be greatly appreciated - is there something we could try or code mods we can employ etc. Any direction or hints on where to look next...? In our scenario we have continued trying everything we can think of to resolve the stuttering via hardware & software and are experiencing same on Ubuntu 16.04 and 14.04 with and without juicing with egl / vaapi and have now updated test box to latest FFmpeg and Qt 5.8 to exclude those as factors. QtAV is also latest version.

kiwimagic avatar May 11 '17 16:05 kiwimagic

Did you find a solution to this? I'm not seeing huge stutters in my app, but playback is certainly not smooth. I tested the qml player example and it has the same video performance issue. But the non-qml example app plays video quite fluidly. I'm likely going to rewrite the app to not use qml.

Windows, Qt 5.9.1, QtAV-Qt5.9-VS2015x86-release-78f1814

mike-odom avatar Jul 25 '17 20:07 mike-odom