Ffmpeg core slowdowns

Im using this core to watch 60fps game videos since its the only way to add shaders to them and make them look authentic. However, every 10 seconds or so i get heavy stuttering that lasts a couple of seconds, ruining the experience. It looks like it loses sync with the screen (im using a standard 60hz TV).

Is there a way to fix this?

Does it happen with other cores/games, too? or just this one?

Only this one. Gaming cores are all smooth.

And the videos don’t lose sync in other players like Kodi or Pot player.

Could be any way to fix this? Maybe an option or something else? I tried those 60fps longplay videos again but this time on a 240hz monitor. But the slowdowns/stutters still occur.

RetroArch/FFmpeg is the only way to watch videos while using CRT shaders. At least i don’t know of any other player that can do this. Thus, watching uncompressed 60fps gameplay videos of retro games fits like a glove for this purpose. You watch a game from start to finish but the shaders makes it look like it runs in real time on a emulator core. But the slowdowns/stutters pretty much ruins the experience.

I had a similar issue with my android phone, trying to watch these videos in MX player. But there was a MX plugin that you could install and this fixed the issue. Is it something about 60fps videos that some players (like FFmpeg and MX Player without the plugin) can’t handle well?

If you can write your own shaders you can use mpv it supports glsl shaders but they must be writen in ther own syntax, you cannot just copypaste the retroarch shaders, they must be ported.

I noticed that ffmpeg has received some updates. It now has plenty of hardware renderers to choose from and some other options.

The issue still remains though. I tested every option and renderer. There are srill stutters/sync issues every few seconds when playing 60fps videos.

This is a 60fps long play video of Toy Story: https://www.mediafire.com/file/37bc6kzu6uun6kx/Toy_Story.mkv/file

Can someone confirm it plays smoothly on the new ffmpeg core? Without noticeable stutters every 10 or 15 seconds? I tried every hardware decoder and it still has those stutters like before the updates. It’s been like that forever actually for this core.

I get stutters at steady intervals with all 60fps videos. They only stutter in RA/ffmpeg. They play smoothly in Kodi, PotPlayer, VLC and any other media player.

Is this something that can be fixed somehow with settings? Or is it a core issue?

@GemaH I downloaded your file and I have no problem reaching 60fps playing with it.

What kind of system do you use to play the video?

Can you try to download the current 1.8.2 release (https://buildbot.libretro.com/stable/1.8.2/windows/x86_64/RetroArch.7z) and try to play the file in a fresh installation?

A logfile would also be helpful if the problems continues.

The problem isn’t reaching 60fps.

The problem is that it plays fine but at certain parts of the video and in steady intervals i get stuttering for a couple of seconds before it locks at 60fps again. And repeat.

It’s like the video loses sync with the screen, it’s not a slowdown issue.

I had the same exact problem, at the exact same parts of the video with MX player on android but there was a plugin for it that fixed the issue. And its not just this video, many long play videos that are 60fps have this syncing issue.

I have an i5 4670 - GTX 1060 so the system isn’t the problem. And this issue persists since the first time i tried the core 3 or 4 years ago. I thought this new hardware codec update would fix it but no dice.

Edit: The stutters happen about every 20 seconds. If you watch the video long enough you should be able to see them.

You could also try this shorter video. It has a different problem, in ffmpeg it moves at 2fps or something. Plays fine in other players

@GemaH I think I know what you mean, it’s not really a lose of sync, it might be a frame pacing issue I don’t really get the same impression of the video than you have explained, for example I don’t see the stutter every 20 seconds or so. But I have “a feeling” that it’s not as fluid as it should be in 60 Hz. I will take that video file and will examen it in detail when I have the time.

Do you happen to test this video on android? (log files would be great!)

The second file you posted is a know issue and is an entirely other problem. The player currently buffers video frames (32 to be exact) and not packages. Since MP4 files often send audio data after many, many video frames, we get a buffer overrun and need to drop frames.

This is a technical dept I have to solve and is on my roadmap (we will buffer the packet, so that we don’t need to save so many video frames).

1 Like

I have tested the video in MX player (android) and several media players on Windows, they all play the video smoothly, no problems, it’s only ffmpeg that has these stutters for me. I tried it on other PCs with Windows 7 or 10, same issue all the time, in all systems, with 3 different PC monitors and one TV. I have a lot of PCs and since it occurs to all of them then i know it’s not my system but the core itself.

This is the same deal with many other videos. Toy Story is just one of them.

I had the same EXACT issue in MX player (android) for some time before but there was a plugin for it that fixed it and it’s perfect ever since.

And one last thing. If i convert the Toy Story video to .AVI, the problem goes away and it plays smoothly all the time, without stutters/desync/frame pacing issues.

What log do you need? It doesn’t produce any errors or anything like that.

1 Like

Any logs would be fine. I need an output to see how you configured your system and what the ffmpeg core does report when you play that toystory file.

Also: Did you try to play the file with ffplay?

Ok, here’s the log:

[INFO] RetroArch 1.8.2 (Git b6a45645d8)
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
[INFO] Capabilities:  MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE4.2 AES AVX
[INFO] Built: Dec 25 2019
[INFO] Version: 1.8.2
[INFO] Git: b6a45645d8
[INFO] =================================================
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] Redirecting save file to "J:\_Downloads\RA\saves\.srm".
[INFO] Redirecting savestate to "J:\_Downloads\RA\states\.state".
[INFO] Version of libretro API: 1
[INFO] Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 30000.00 Hz.
[INFO] [Video]: Video @ fullscreen
[INFO] [Video]: Starting threaded video driver ...
[INFO] [GL]: Found GL context: wgl
[INFO] [GL]: Detecting screen resolution 1920x1080.
[INFO] Setting fullscreen to 1920x1080 @ 959Hz on device \\.\DISPLAY1.
[INFO] [WGL] extensions: WGL_ARB_buffer_region WGL_ARB_create_context WGL_ARB_create_context_no_error WGL_ARB_create_context_profile WGL_ARB_create_context_robustness WGL_ARB_context_flush_control WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_mult
[INFO] [WGL]: Adaptive VSync supported.
[INFO] [WGL]: wglSwapInterval(4)
[INFO] [GL]: Vendor: NVIDIA Corporation, Renderer: GeForce GTX 1060 6GB/PCIe/SSE2.
[INFO] [GL]: Version: 4.6.0 NVIDIA 417.35.
[INFO] [GL]: Using resolution 1920x1080
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[INFO] [GLSL]: Checking GLSL shader support ...
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] Setting up menu pipeline shaders for XMB ... 
[INFO] [GLSL]: Compiling ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling simple ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling modern snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling bokeh shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snowflake shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 4 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Using GL_RGB565 for texture uploads.
[INFO] [XInput]: Found XInput v1.3.
[INFO] [XInput]: Found controller, user #0
[INFO] [XInput]: Pads connected: 1
[INFO] [DINPUT]: Enumerating joypads ...
[INFO] [DINPUT]: Device #0 PID: {02A1} VID:{045E}
[INFO] [DINPUT]: Done enumerating joypads ...
[INFO] [XInput]: Attempting autoconf for "XInput Controller (User 1)", user #0
[INFO] [DINPUT]: Found XInput pad at index 0 (DINPUT index 0)
[INFO] [XInput]: Found VID/PID (045E/02A1) from DINPUT index 0 for "XInput Controller (User 1)", user #0
[INFO] [XInput]: Attempting autoconf for user #1
[INFO] [XInput]: Attempting autoconf for user #2
[INFO] [XInput]: Attempting autoconf for user #3
[INFO] [XInput]: Attempting autoconf for user #4
[INFO] [XInput]: Attempting autoconf for user #5
[INFO] [XInput]: Attempting autoconf for user #6
[INFO] [XInput]: Attempting autoconf for user #7
[INFO] [XInput]: Attempting autoconf for user #8
[INFO] [XInput]: Attempting autoconf for user #9
[INFO] [XInput]: Attempting autoconf for user #10
[INFO] [XInput]: Attempting autoconf for user #11
[INFO] [XInput]: Attempting autoconf for user #12
[INFO] [XInput]: Attempting autoconf for user #13
[INFO] [XInput]: Attempting autoconf for user #14
[INFO] [XInput]: Attempting autoconf for user #15
[INFO] [Joypad]: Found joypad driver: "xinput".
[INFO] [Autoconf]: 141 profiles found.
[INFO] [Font]: Using font rendering backend: freetype.
[INFO] [Video]: Found display server: win32
[INFO] [XAudio2]: Requesting 64 ms latency, using 64 ms latency.
[INFO] [Autoconf]: selected configuration: J:\_Downloads\RA\autoconfig\xinput\XInput_Controller_User_1.cfg
[INFO] [Menu]: Found menu display driver: "gl".
[INFO] [Menu]: Found menu display driver: "gl".
[INFO] [Font]: Using font rendering backend: freetype.
[INFO] [Font]: Using font rendering backend: freetype.
[INFO] [LED]: LED driver = 'null' 0000000000B9AF20
[INFO] [MIDI]: Initializing ...
[INFO] [MIDI]: Input disabled.
[INFO] [MIDI]: Output disabled.
[INFO] [MIDI]: Initialized "winmm" driver.
[INFO] SRAM will not be saved.
[INFO] Loading history file: [J:\_Downloads\RA\content_history.lpl].
[INFO] Loading history file: [J:\_Downloads\RA\content_music_history.lpl].
[INFO] Loading history file: [J:\_Downloads\RA\content_video_history.lpl].
[INFO] Loading history file: [J:\_Downloads\RA\content_image_history.lpl].
[INFO] Loading favorites file: [J:\_Downloads\RA\content_favorites.lpl].
[INFO] [Font]: Using font rendering backend: freetype.
[INFO] [Font]: Using font rendering backend: freetype.
[INFO] Using content: M:\Videos\Long Play Series\Sega Mega Drive\Toy_Story.mkv.
[INFO] arg #0: retroarch
[INFO] arg #1: M:\Videos\Long Play Series\Sega Mega Drive\Toy_Story.mkv
[INFO] arg #2: -s
[INFO] arg #3: J:\_Downloads\RA\saves
[INFO] arg #4: -S
[INFO] arg #5: J:\_Downloads\RA\states
[INFO] arg #6: -c
[INFO] arg #7: J:\_Downloads\RA\retroarch.cfg
[INFO] arg #8: -L
[INFO] arg #9: J:\_Downloads\RA\builtin
[INFO] arg #10: -v
[INFO] Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] Unloading game..
[INFO] Unloading core..
[INFO] Unloading core symbols..
[INFO] Threaded video stats: Frames pushed: 1122, Frames dropped: 0.
[INFO] Set config file to : J:\_Downloads\RA\retroarch.cfg
[WARN] --libretro argument "J:\_Downloads\RA\builtin" is neither a file nor directory. Ignoring.
[INFO] RetroArch 1.8.2 (Git b6a45645d8)
[INFO] Redirecting save file to "J:\_Downloads\RA\saves\Toy_Story.srm".
[INFO] Redirecting savestate to "J:\_Downloads\RA\states\Toy_Story.state".
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz
[INFO] Capabilities:  MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE4.2 AES AVX
[INFO] Built: Dec 25 2019
[INFO] Version: 1.8.2
[INFO] Git: b6a45645d8
[INFO] =================================================
[INFO] [Overrides] no core-specific overrides found at J:\_Downloads\RA\config\FFmpeg\FFmpeg.cfg.
[INFO] [Overrides] no content-dir-specific overrides found at J:\_Downloads\RA\config\FFmpeg\Sega Mega Drive.cfg.
[INFO] [Overrides] no game-specific overrides found at J:\_Downloads\RA\config\FFmpeg\Toy_Story.cfg.
[INFO] [Environ]: SET_VARIABLES.
[INFO] [Environ]: GET_LOG_INTERFACE.
[INFO] [Remaps]: remap directory: J:\_Downloads\RA\config\remaps
[INFO] Redirecting save file to "J:\_Downloads\RA\saves\Toy_Story.srm".
[INFO] Redirecting savestate to "J:\_Downloads\RA\states\Toy_Story.state".
[INFO] Content loading skipped. Implementation will load it on its own.
[INFO] [Environ]: SET_INPUT_DESCRIPTORS:
[INFO] [Environ]: SET_PIXEL_FORMAT: XRGB8888.
[libretro INFO] [FFMPEG] libavformat version:	58.29.100
[libretro INFO] [FFMPEG] libavcodec version:	58.54.100
[libretro INFO] [FFMPEG] libavutil version:	56.31.100
[libretro INFO] [FFMPEG] libswresample version:	3.5.100
[libretro INFO] [FFMPEG] libswscale version:	5.5.100
[libretro INFO] [FFMPEG] Media information:
[libretro INFO] [FFMPEG] Selected HW decoder dxva2.
[libretro INFO] [FFMPEG] Selected HW pixel format dxva2_vld.
[INFO] [Environ]: SET_HW_RENDER.
[INFO] Requesting OpenGL context.
[INFO] Skipping SRAM load..
[INFO] Version of libretro API: 1
[INFO] Compiled against API: 1
[INFO] [Cheats]: Load game-specific cheatfile: J:\_Downloads\RA\cheats\FFmpeg\Toy_Story.cht
[INFO] [Audio]: Set audio input rate to: 44100.00 Hz.
[INFO] [Video]: Video @ fullscreen
[INFO] [Video]: Using HW render, OpenGL driver forced.
[INFO] [Video]: Using configured "gl" driver for GL HW render.
[INFO] [GL]: Found GL context: wgl
[INFO] [GL]: Detecting screen resolution 1920x1080.
[INFO] Setting fullscreen to 1920x1080 @ 959Hz on device \\.\DISPLAY1.
[libretro INFO] [FFMPEG] Configured worker threads: 2
[INFO] [WGL] extensions: WGL_ARB_buffer_region WGL_ARB_create_context WGL_ARB_create_context_no_error WGL_ARB_create_context_profile WGL_ARB_create_context_robustness WGL_ARB_context_flush_control WGL_ARB_extensions_string WGL_ARB_make_current_read WGL_ARB_mult
[INFO] [WGL]: Adaptive VSync supported.
[INFO] [WGL]: wglSwapInterval(4)
[INFO] [GL]: Vendor: NVIDIA Corporation, Renderer: GeForce GTX 1060 6GB/PCIe/SSE2.
[INFO] [GL]: Version: 4.6.0 NVIDIA 417.35.
[INFO] [GL]: Using resolution 1920x1080
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[INFO] [GLSL]: Checking GLSL shader support ...
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] Setting up menu pipeline shaders for XMB ... 
[INFO] [GLSL]: Compiling ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling simple ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling modern snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling bokeh shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snowflake shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 1 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Initializing HW render (1024 x 1024).
[INFO] [GL]: Max texture size: 32768 px, renderbuffer size: 32768 px.
[INFO] [GL]: Supports FBO (render-to-texture).
[INFO] [XInput]: Found XInput v1.3.
[INFO] [XInput]: Found controller, user #0
[INFO] [XInput]: Pads connected: 1
[INFO] [DINPUT]: Enumerating joypads ...
[INFO] [DINPUT]: Device #0 PID: {02A1} VID:{045E}
[INFO] [DINPUT]: Done enumerating joypads ...
[INFO] [XInput]: Attempting autoconf for "XInput Controller (User 1)", user #0
[INFO] [DINPUT]: Found XInput pad at index 0 (DINPUT index 0)
[INFO] [XInput]: Found VID/PID (045E/02A1) from DINPUT index 0 for "XInput Controller (User 1)", user #0
[INFO] [XInput]: Attempting autoconf for user #1
[INFO] [XInput]: Attempting autoconf for user #2
[INFO] [XInput]: Attempting autoconf for user #3
[INFO] [XInput]: Attempting autoconf for user #4
[INFO] [XInput]: Attempting autoconf for user #5
[INFO] [XInput]: Attempting autoconf for user #6
[INFO] [XInput]: Attempting autoconf for user #7
[INFO] [XInput]: Attempting autoconf for user #8
[INFO] [XInput]: Attempting autoconf for user #9
[INFO] [XInput]: Attempting autoconf for user #10
[INFO] [XInput]: Attempting autoconf for user #11
[INFO] [XInput]: Attempting autoconf for user #12
[INFO] [XInput]: Attempting autoconf for user #13
[INFO] [XInput]: Attempting autoconf for user #14
[INFO] [XInput]: Attempting autoconf for user #15
[INFO] [Joypad]: Found joypad driver: "xinput".
[INFO] [Autoconf]: 141 profiles found.
[INFO] [Font]: Using font rendering backend: freetype.
[INFO] [Video]: Found display server: win32
[INFO] [XAudio2]: Requesting 64 ms latency, using 64 ms latency.
[INFO] [Autoconf]: selected configuration: J:\_Downloads\RA\autoconfig\xinput\XInput_Controller_User_1.cfg
[INFO] [Menu]: Found menu display driver: "gl".
[ERROR] Failed to open libretro core: "J:\_Downloads\RA\builtin"
[ERROR] Error(s): The specified module could not be found.

[INFO] [Font]: Using font rendering backend: freetype.
[INFO] [Font]: Using font rendering backend: freetype.
[INFO] [LED]: LED driver = 'null' 0000000000B9AF20
[INFO] [MIDI]: Initializing ...
[INFO] [MIDI]: Input disabled.
[INFO] [MIDI]: Output disabled.
[INFO] [MIDI]: Initialized "winmm" driver.
[INFO] SRAM will not be saved.
[INFO] Loading history file: [J:\_Downloads\RA\content_history.lpl].
[INFO] Loading history file: [J:\_Downloads\RA\content_music_history.lpl].
[INFO] Loading history file: [J:\_Downloads\RA\content_video_history.lpl].
[INFO] Loading history file: [J:\_Downloads\RA\content_image_history.lpl].
[INFO] Loading favorites file: [J:\_Downloads\RA\content_favorites.lpl].
[INFO] [GL]: VSync => on
[INFO] [WGL]: wglSwapInterval(4)
[ERROR] Failed to open libretro core: "J:\_Downloads\RA\builtin"
[ERROR] Error(s): The specified module could not be found.

[INFO] Paused.
[INFO] Unpaused.
[INFO] [config] Saved new config to "J:\_Downloads\RA\retroarch.cfg".
[INFO] [Cheats]: Save game-specific cheatfile: J:\_Downloads\RA\cheats\FFmpeg\Toy_Story.cht
[INFO] Content ran for a total of: 00 hours, 01 minutes, 27 seconds.
[INFO] Unloading game..
[INFO] Unloading core..
[INFO] Unloading core symbols..
[INFO] [Core Options]: Saved core options file to "J:\_Downloads\RA\retroarch-core-options.cfg"

I tried ffplay and the video plays perfectly smoothly, no stutters.

1 Like

Can you try tp change the following settings in the ffmpeg core and see if this helps?

“Use Hardware decoder” -> off “Software decoder threads count” -> auto

Please restart retroarch after saving these settings, since they require a restart.

Did that and still getting the stutters.