If you’re already into retro gaming and Raspberry Pi DIY projects, you’ll know that a RetroPie setup is one of the easiest (and cheapest) ways to go if you want to re-live (or discover for the first time) video games from the golden era. However, if you also enjoy recording your gameplay, you may have noticed that this option isn’t available by default in the current stable RetroPie 4.3 release as it might be on a regular console like an XBox or PlayStation for example.
Since ffmpeg isn’t readily available in RetroPie 4.3 on Raspbian Jessie 4.9, the only way to setup gameplay recording would be to install the ffmpeg codecs and recompile RetroArch with ffmpeg enabled. This has been achieved and heavily documented in separate posts by RetroResolution and Selsine.
Full disclosure: After successfully installing ffmpeg and required codecs using the aforementioned posts, we were still unable to successfully recompile RetroArch. Every attempt resulted in the following error, even after a fresh install:
Could not successfully build retroarch - RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators (/home/pi/RetroPie-Setup/tmp/build/retroarch/retroarch not found).
So, after extensive searching, we could not find a solution, and decided to put that project on hold for a few months. However, a much easier alternative soon presented itself.
Gameplay Recording on RetroPie 4.3.15 Stretch
A couple of months ago, the fine folks over at RetroPie released some Retropie 4.3.15 images built on Raspian Stretch for testing on Raspberry Pi 2/3/3 B+ as well as on Raspberry Pi 1/Zero. Needless to say, one of the first things we checked after installing this testing image was whether or not RetroArch includes ffmpeg by default.
Disclaimer: Since we are still beta testing and we haven’t fully explored the RetroArch GUI, some of these steps still require some backend configuration.
We tested by doing the following:
1. Create this config file with the following contents:
format = matroska
threads = 3
vcodec = libx264rgb
video_preset = ultrafast
video_tune = animation
pix_fmt = bgr24
video_qp = 0
acodec = flac
2. Edit emulators.cfg for the emulator with which you want to record. We are using mame-libretro for our example:
We added the following line to /opt/retropie/configs/mame-libretro/emulators.cfg. Pay attention to the path in bold as this will depend on your system and where you are saving your recordings.
lr-mame2003-record = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so --config /opt/retropie/configs/mame-libretro/retroarch.cfg --record /home/pi/RetroPie/recordings/recording_MAME-LIB_$(date +%Y-%m-%d-%H%M%S).mkv --recordconfig /home/pi/RetroPie/recording/config.cfg %ROM%"
default = "lr-mame2003-record"
Note above that default = “lr-mame2003-record”. To change this and use lr-mame2003 (recording off) while launching a game from EmulationStation, hold A on your controller to choose lr-mame2003 instead.
3. Confirm Successful Recordings
If everything went according to plan,you should have a file with a similar format in your save folder:
Saving your recordings
Since the video files can be quite large, it’s recommended that you save your recordings to a usb key or on a network share (NFS) where you have plenty of space. I previously wrote about setting up NFS shares on RetroPie if you’re interested knowing more about that topic.
And that’s it! This was tested on a fresh installation using the following software/hardware. We’re still exploring this beta version of RetroPie but of course, this is all a just pre-cursor to the upcoming release of RetroPie 4.4 which should have all kinds of new features, including the ability to record gameplay.
Raspberry Pi 3