Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VDPAU / VAAPI: Use HEVC_MAIN GPU decoding (ffmpeg 2.8+) #7751

Merged
merged 4 commits into from Sep 10, 2015

Conversation

fritsch
Copy link
Member

@fritsch fritsch commented Aug 8, 2015

This implements the missing bits to use HEVC_MAIN decoding on nvidia GTX 960+ cards. This was tested by @philipl - We have to wait for ffmpeg 2.8 to land, so that we can use it. Furthermore an nvidia driver >= 355.06 is needed to use it properly.

@fritsch
Copy link
Member Author

fritsch commented Aug 8, 2015

Let's keep it open for testers and merge it after we have bumped to ffmpeg 2.8 which will have HEVC vdpau decoding in a non experimental way.

@FernetMenta
Copy link
Contributor

You should note that the test results were not all positive. @phil65 mentioned issues he does not observe with other players.

@fritsch
Copy link
Member Author

fritsch commented Aug 8, 2015

@FernetMenta his issues were with standard H264 files, not (only) hevc related.

@fritsch
Copy link
Member Author

fritsch commented Aug 8, 2015

Oh and @phil65 just went to bed. We need to ping @philipl :-)

@FernetMenta
Copy link
Contributor

ahh, I did not read carefully enough.

@philipl
Copy link
Contributor

philipl commented Aug 8, 2015

I think there are some differences in behaviour when seeking in hevc vs h.264. The decoder may act differently in the two situations. I doubt it's something specifically wrong in kodi unless kodi is not even trying to seek to iframes.

@fritsch fritsch changed the title VDPAU: Use HEVC_MAIN GPU decoding (ffmpeg 2.8+) VDPAU / VAAPI: Use HEVC_MAIN GPU decoding (ffmpeg 2.8+) Aug 26, 2015
@fritsch
Copy link
Member Author

fritsch commented Aug 26, 2015

I also added the VAAPI implementation that we need, when we start to use a capable ffmpeg version. Both have been tested and work as expected.

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

I will prepare ffmpeg 2.8 tree with all our changes. As @FernetMenta and me are running ffmpeg 2.8-pre since some weeks quite succesfully this can go in early to get a lot of testers.

This PR here will then start to work and HEVC (VAAPI / VDPAU) acceleration will get integrated.

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

jenkins build this please

@wsnipex: Could you add your famous libva1 0.38 version to our ppa? And if possible also the libvdpau version that includes HEVC support for vdpau?

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

@Memphiz do you have an idea about what is wrong on OSX? It seems the linker now misses some symbols

@FernetMenta
Copy link
Contributor

you need to disable vtb on osx

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

Oki - will do.

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

@FernetMenta disabling it is not a problem, btw. do you know if VTB is the future on OSX? Do we need to go that route?

Its implementation rather looks complete:

--disable-hwaccel=h264_videotoolbox,mpeg4_videotoolbox,mpeg1_videotoolbox,mpeg2_videotoolbox

will fix it

@philipl
Copy link
Contributor

philipl commented Sep 9, 2015

VTB is the future. VDA has been removed from El Capitan

@FernetMenta
Copy link
Contributor

check the commit in my master: (do not comment on the typo in commit msg :)) FernetMenta@e86f617

it is called "temp" because vda will disappear in favour of vtb

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

jenkins build this please

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

Thanks for the answer. So it's a temporary fix and can be removed later on.

@FernetMenta
Copy link
Contributor

hmm, you won't have a good time if you disable it for iOS :)

EDIT: I may be wrong but I thought on iOS we would use vtb already

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

Lol, yeah just seen it - sorry jenkins.

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

I triggered manual builds for OSX 32 and 64

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

@fritsch
Copy link
Member Author

fritsch commented Sep 9, 2015

jenkins build this please (ffmpeg is nothing small / little, therefore I want to be fully sure)

@FernetMenta
Copy link
Contributor

looks good to me

fritsch added a commit that referenced this pull request Sep 10, 2015
VDPAU / VAAPI: Use HEVC_MAIN GPU decoding (ffmpeg 2.8+)
@fritsch fritsch merged commit d0a36b4 into xbmc:master Sep 10, 2015
@fritsch
Copy link
Member Author

fritsch commented Sep 10, 2015

@philipl we are currently running into issues with hevc and certain hevc files, especially with: http://www.libde265.org/downloads-videos/ Tears of Steel and Sintel

Users report that this "short stutters", "drops" also happen on windows when using DXVA2. Can you try the 4096 sample on your nvidia gpu? Does that reveal the same issue?

@philipl
Copy link
Contributor

philipl commented Sep 10, 2015

So, we saw a stuttering problem on dxva2 which we tried to fix in 5d324da and I duplicated that fix into f038bbd for vdpau. I never personally saw it, however. When does this stuttering occur within the sample? I'll try and see if I can detect it.

@fritsch
Copy link
Member Author

fritsch commented Sep 10, 2015

It should start right after the first view seconds. No chance to not see it, thanks for looking into that.

@philipl
Copy link
Contributor

philipl commented Sep 10, 2015

So you said it's visible with dxva2. You didn't say if the other place was vaapi or vdpau or both. Can you confirm which?

@fritsch
Copy link
Member Author

fritsch commented Sep 10, 2015

In VAAPI on linux it's visible. I guess the user also tested with his Intel hw on Windows.

Edit: I don't have any nvidia hw and therefore wanted to know if it's ffmpeg dependend or only intel / vaapi issue.

@philipl
Copy link
Contributor

philipl commented Sep 10, 2015

I don't have access to Intel hevc hardware, but @BtbN took a look and he sees it, but reckons its specific to non-standard resolutions, possible resolutions above the normal 4K (this one is a full 4096 clip).

It's quite likely this is a hardware limitation, given the same behaviour on linux and windows.

@fritsch
Copy link
Member Author

fritsch commented Sep 10, 2015

The forum user rbej reported that everything is fine with the LAVcodecs by Hendrik Leppkes. Though I cannot verify that information as I don't have Windows.

The 4096 I have also seen and thought that could be the issue, but this forum post got my interest:
http://forum.kodi.tv/showthread.php?tid=231955&pid=2101866#pid2101866 and http://forum.kodi.tv/showthread.php?tid=231955&pid=2102133#pid2102133

Yeah I talked with @BtbN before, so basically you say: All fine on your nvidia?

@fritsch
Copy link
Member Author

fritsch commented Sep 10, 2015

@Nevcairiel do you have an idea in that regard? (I hope I pinged the right guy, sorry in advance)

@Nevcairiel
Copy link
Contributor

I backported all HEVC DXVA2 fixes from LAV to FFmpeg, so any recent git master or 2.8 version should behave the same as LAV, at least on the avcodec side. Of course there could still be something in the DXVA code in xbmc, buy I don't really remember any extra special cases for HEVC there.

@fritsch
Copy link
Member Author

fritsch commented Sep 10, 2015

@Nevcairiel thanks very much for your answer!

@fritsch
Copy link
Member Author

fritsch commented Sep 11, 2015

Something new, here:

I tried the Sintel 4k sample on windows (mpc-hc): All fine
On linux I tried totem with libde265 and on vlc 2.2 pre (sw accelerated): All fine.

Then I retried on kodi and also on mpv: drops are back.

If you play the sintel sample from http://www.libde265.org/hevc-bitstreams/sintel-4096x1744-cfg02.mkv you see directly after 5 seconds when the camera is flying over the mountain that a frame is dropped - i have no idea why this happens. Be it sw decoded or hw decoded. I think there is something wrong in ffmpeg. At least my analysis suggests this.

For SW decoding I used a core i5 3400 Mhz and 4 cores ...

@philipl
Copy link
Contributor

philipl commented Sep 12, 2015

I see a hitch at the 10 second mark with software decoding.

@fritsch
Copy link
Member Author

fritsch commented Sep 12, 2015

@philipl exactly :-) - So, is the file broken? does totem with libde265 drop more intelligently? Why is mpc-hc working?

Should we open a bugreport at ffmpeg's trac?

@Nevcairiel
Copy link
Contributor

Maybe its related to this issue? It can result in frames being skipped/appear missing.
https://trac.ffmpeg.org/ticket/4185

The patch in the ticket is not 100% correct, which is why it was not applied, but it does solve most of the problems.

@fritsch
Copy link
Member Author

fritsch commented Sep 12, 2015

@Nevcairiel does it work for you and this sample?

Edit: I will also start testing right now.

@philipl
Copy link
Contributor

philipl commented Sep 12, 2015

I verified. That patch does fix the problem.

@fritsch
Copy link
Member Author

fritsch commented Sep 12, 2015

@philipl Very nice. Thanks for reporting back! and obviously thanks to @Nevcairiel for pointing at this fix.

I will add my vaapi-hevc results later on.

@Nevcairiel
Copy link
Contributor

I posted a new patch in that ffmpeg ticket which no longer breaks other things (that I know of), and still seems to have the intended result, so if you do any testing, use that one!

@fritsch
Copy link
Member Author

fritsch commented Sep 12, 2015

This fixes the issues! I will add the patch to our ffmpeg-2.8 fork and rebase it away after it landed in your mainline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants