pixop / video-compare

Split screen video comparison tool using FFmpeg and SDL2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Major stuttering during AV1 Playback

Razor54672 opened this issue · comments

I was comparing two videos, one encoded with HEVC and another with AV1.
However, it plays like a slideshow.
Why is this the case?

My laptop has a dedicated GPU and the files run just fine in other players so that isn't the problem here.

image

Hmm, good question. I'm wondering if "other players" include FFmpeg's ffplay?

commented

From what I can see, this tool doesn't use hardware decoding. So if your CPU isn't fast enough to play back the two video files simultaneously with the included software decoders, slow playback is expected behavior.

Also, ffplay doesn't support hardware decoding, though ffmpeg does (when built with the required libraries).

Also, ffplay doesn't support hardware decoding, though ffmpeg does (when built with the required libraries).

So I've been doing a little investigation. It turns out ffplay does have support for hardware decoders (via e.g. -vcodec h264_cuvid); the caveat is that ffplay requires decoded image frames to be copied between GPU and main memory instead of keeping frames on the GPU like ffmpeg. Supposedly it is still faster than CPU decoding which makes it interesting to us, as well. I think decoder selection would be something we can add with relative ease in the future when times allows. Let's keep this issue open until then.

I have added functionality in the latest version for finding available decoders (--find-decoders) and setting a specific decoder of both the left and/or right video (via --left-decoder and --right-decoder). This can be used to select a hardware accelerated decoder on supported Nvidia GPUs such as h264_cuvid, hevc_cuvid and av1_cuvid if CUDA support has been compiled into FFmpeg's libraries. I haven't tested if this works in the Windows builds provided here, but in theory it should work - hardware decoding works on the Linux PC in our lab which has a Nvidia GeForce GTX 2080 Ti GPU on both H.264 and HEVC videos.

More info on Nvidia hardware decoding support can be found here: https://developer.nvidia.com/video-encode-and-decode-gpu-support-matrix-new#collapseTwo

EDIT: BTW, I just realized that the shared FFmpeg libraries in the Windows build comes with support for Vulkan and other APIs in addition to CUDA, but I don't have the drivers or hardware to test it. Let me know what works for you guys.

Note that these hardware decoders are usually restricted in terms of supported pixel formats - typically only lowest common denominator formats such as yuv420p will work.