Libretro FFmpeg

This is a very atypical libretro core, basically a movie player. Uses FFmpeg to decode.

Note that this is not how you’d normally write a movie player. Movie players are high-latency w/ fancy A/V sync mechanisms and aims for bit-perfect audio. This implementation keeps video and audio in lock internally, and relies on low latency in frontend to keep sync within tolerance levels.

Use cases are:

  • Easy playing around with scaling shaders for video.
  • Playing around with temporal interpolation (not commonly implemented afaik).

Features:

  • Toggleable temporal interpolation (blends frames to fake 60 fps). This is kinda taxing on CPU so it’s done in GL.
  • ASS subtitles (for animu :v)
  • Seeking w/ d-pad (MPlayer-like, left/right 10s, up/down 1 min)

Only tested on Linux. Runs on GLES at least.

Deps:

  • libass
  • libavcodec/avformat/avutil/swresample

Source:

1 Like

I’ve been playing around with this some already and it’s pretty sweet :smiley:

I had to build a new FFmpeg because the ones in the ubuntu raring repos didn’t have time.h, but otherwise it builds and works as expected. Cgwg’s CRT shader makes some pretty awful-looking SD videos watchable…

I haven’t played with the temporal interpolation yet, but I’m excited to see such an option available for Linux, as I don’t think there’s anything else like it that works realtime.

1 Like

This is some great stuff - could you move it over to the libretro organization please? I’d like to expand on it.

Tried to build with Mingw. No luck. Maybe I didn’t get all the necessary libraries/dependencies in order or something, but for all I know it may not compile on Mingw at all. I am really, really interested in seeing a working core of this.

Just get yourself Linux if you want to be on the cutting edge of all things libretro/RetroArch - Windows sucks for development (and some other things).

hunterk, would you mind uploading your binary? I was unable to compile it on Debian, but hopefully a core from Ubuntu is close enough to work.

@sparklewind Here you go: http://www.mediafire.com/download/lebyig4dd5ha4bc/ffmpeg_libretro.so

Well what can I say. Really great work! :smiley: It’s very simple to use, and I love how you can use all the Cg shaders. Just the gamma shader alone can make a big difference on some old movies and series. Thanks a lot Maister for making this.

And thanks hunterk for uploading your build, it works here. :slight_smile:

Funny I had this same exact idea the other day, I have a hobby of collecting old laser discs and unfortunately SD content generally looks like crap on HD monitors, but throw some shaders and a CRT filter on top and it would make old content tolerable again! Excellent work.

Ok finally got a chance to want to try this out and I have no clue what to do!

How do I launch the .so file on windows (or can I even?), anyone got a .dll core I can use?

@solid12345 the .so library is linux-only (64-bit, at that). I’ll see if I can cross-compile one for you tomorrow. It’ll probably be 32-bit, since I already have most of the necessary 32-bit libraries installed.

Implemented audio/subtitle track switching (tap L and R to cycle through streams). There is a delay when swapping due to buffering in the thread, but should be fine.

I just had a play with this and it’s great. Grabbed a few 80s music videos from YouTube and watched them with CRT-Geom as the shader. Ah, the nostalgia - you could bottle it. Thank you Maister for making this.

I made a PKGBUILD for Arch Linux, as that is about the limit of my usefulness right now:

https://aur.archlinux.org/packages/libretro-ffmpeg-git

Cool, I’ve had a PKGBUILD for this since maister made this public i just never got around to uploading it to AUR, so thanks for doing that.

and to your comment on that page. that is definitely fine with me, I just borrowed maisters PKGBUILD that he had for libssnes cores when this project was SSNES, and then with the pacman update to 4.0 made it to what it is today.

If you do feel like changing anything in that PKGBUILD maybe change the pkgdesc to “libretro implementation of FFmpeg. (Video Player)” just to match the rest of the packages.

Has anyone had a chance to compile this for Windows? I’m looking forward to trying it out.

You need the deps. Building libretro FFmpeg itself for Windows should be pretty much hassle free once that’s sorted out.

So will we ever see a .dll for us noobs who know nothing about software compiling Maister or are the dependencies not something that can be distributed with it?

If I ever feel like spending some good hours finding and compiling the deps for Windows, maybe. It’s pretty far down on my TODO-list. There’s no particular reason why it can’t be done, so.

EDIT: Yes, compiling software on Windows can be a real PITA.

Yeah, I tried it and ran into dependency hell with libass. It can be really hard to find precompiled 32- and 64-bit binaries of open-source libraries in Windows…

Ok, so here are some builds without SSA/ASS subs (cba finding deps). For those who want to build yourself, use http://ffmpeg.zeranoe.com/builds/, grab shared/dev packages.

Copy stuff in deps/ into RetroArch folder. Overwriting other ffmpeg libs is fine. ffmpeg_libretro.dll is with libretro GL, ffmpeg_sw_libretro.dll renders using software interface. Should be just as fast except that only GL path supports temporal interpolation.

I’ve only tested for 2 mins in Wine, so might not work for you. 64-bit build is 100% untested. Just built and copied over libs.

https://anonfiles.com/file/3fa255fa6c0821301576868a0205981f