WELCOME TO MY WEBSITE. ENJOY YOUR STAY. HOPEFULLY LINUX WORLD IS NOT THAT SCARY AS THEY SAY.

BROUGHT ТО YOU WITH LINUX, IIS 5.0, MYSQL, PHP, WORDPRESS AND PASSION.

Record gameplay in Retroarch with ffmpeg on Raspberry Pi 3 model b+

retroarch recording ffmpeg raspberry pi linux debian digtvbg

Recording your retro games with Rpi 3b+ - it's possible

To record retro games playback videos on raspberry pi we would need a couple of things neatly set up and running. First of all, a working raspberry pi 3 micro computer with suitable peripherals is a must. Custom build of ffmpeg would bring some more spice to the mix so I would recommend doing so. Building retroarch with some cores doesn’t sound like a rocket science so huge thumbs up for that step too.

Building software sometimes seems intimidating or irritating at first because of at lest two obvious things – dependencies (external libraries/other software) needed for building and the limited cpu processing power raspberry pi which is vital for the time needed for building. For the recording gameplay task with ffmpeg and retroarch on raspberry it would be wise to start with building ffmpeg. It relies on quite a few external pieces of software and libraries, it supports raspberry pi 3 gpu encoding as well. When you install all the needed dependencies with apt in linux then you can obtain ffmpeg source with this command:

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg

Once ffmpeg source is fully cloned on the local raspberry pi 3 machine you can run its “configure” script to select what functionality you would like to enable in the binary.

It’s a matter of personal preference and needs. As of now I’m building ffmpeg with these configure arguments:

./configure –enable-libv4l2 –enable-libtwolame –enable-librsvg –enable-librtmp –enable-libspeex –enable-libfribidi –enable-libfontconfig –enable-libcdio –enable-libcaca –enable-libbluray –disable-htmlpages –disable-manpages –disable-logging –disable-podpages –disable-txtpages –disable-debug –disable-doc –enable-avisynth –enable-gmp –enable-libsoxr –enable-gray –enable-avresample –enable-gpl –enable-nonfree –enable-static –enable-libx264 –enable-libfdk-aac –enable-libvpx –enable-libopus –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-omx –enable-omx-rpi –enable-mmal –enable-libxcb –enable-libfreetype –enable-libass –enable-gnutls –disable-opencl –enable-libcodec2 –enable-libdc1394 –enable-pic –enable-shared –enable-version3 –extra-cflags=’-march=armv7ve -mfpu=neon-vfpv4 -mtune=cortex-a53′

Building ffmpeg takes some time even on the 4 cores cpu of raspberry pi (make -j4)

Install ffmpeg and get retroarch souce:

git clone https://github.com/libretro/RetroArch.git

Configure it with something like this:

./configure –disable-cheevos –disable-langextra –disable-opengl1 –disable-oss –disable-pulse –disable-sdl –disable-sdl2 –disable-x11 –disable-wayland –enable-alsa –enable-dbus –enable-dispmanx –enable-floathard –enable-neon –enable-videocore –enable-ffmpeg –enable-systemd –enable-threads

Build it with make -j4 and install it (sudo make install).

Get your favorite emulator in the form of retroarch core, let’s say this is Nestopia UnEnded. Clone its source code locally:

git clone https://github.com/libretro/nestopia.git

build it like this – in nestopis/libretro run: make -j4 platform=rpi2

copy the resulting .so file (nestopia_libretro.so) to retroarch cores folder (~/.config/retroacrh/cores/)

 

So far ffmpeg is ready, retroarch is ready and at least one emulator should be ready as well. How to actually record gameplay videos then? Here is how:

Create a simple recording config which retroarch will use to tell ffmpeg how to encode the video file, contents of this config (for example retroarch-recording.conf) should be like this:

format = mp4
threads = 3
vcodec = libx264
vprofile = main
video_preset = ultrafast
video_tune = animation
pix_fmt = yuv420p
video_qp = 23
scale_factor = 2
acodec = libfdk_aac

Most of the options are quite well documented online, I would just like to note that vprofile = main was essential to configure because without it h264 was encoding by default in video profile “high”. Google chrome and Opera browser play back such file fine but the couple of versions of Firefox I tests simply failed. So “vprofile = main” makes the resulting video files so much more web compatible. Having figured out the recording config let’s continue with actual command to start playing & recording with ffmpeg:

retroarch -L /path/to/nestopia_libretro.so –record “/path/to/recorded/game-video.mp4” –recordconfig /path/to/retroarch-recording.conf /path/to/actual-nes-game-rom.nes

Provided you’ve already enabled ffmpeg in retroarch settings (recording) then after issuing the long command (sent on terminal or in your favourite RA frontend) you will enjoy playing the game you selected + added bonus – all the gameplay recorded to a web browser compatible mp4 file.

Note1: Recording is done in software, for some reason gpu recording does work but the resulting picture quality is horrendous anyone’s taste.

Note2: pcsx_rearmed and mame 2003 plus emulator cores feel laggy when playing but the actual recorded video is just fine @ 60fps (maybe gpu recoding could be a compromise which I would never resort to)

Note3: nestopia, snes9x and genesis plus gx on the other hand are great for recording.

 

 

 

Record gameplay in Retroarch with ffmpeg on Raspberry Pi 3 model b+
Scroll to top