How-to guide: Recording Live Gameplay in RetroPie’s RetroArch Emulators Natively on the Raspberry Pi (and Twitch streaming)
-
@meleu it's pretty much all done for the love of it!
-
@RetroResolution I enjoy your writing style. It's precise and detailed! ;-)
-
From tests it seems that sometime in the last few days some changes have been made to RetroArch 1.3.6; as well as adding a very funky new UI, when recording is enabled using FFmpeg something fails when the PlayStation emulator lr-pcsx-rearmed is used (as soon as runcommand starts the emulator segmentation faults are logged, and the system returns to Emulation Station). Recording from VCS, Megadrive, 32X, and SNES were all working as normal.
[Edit - the 'funky new UI' turned out to be an old interface which resurfaced due to a missing default value in the codebase - see @meleu 's post, below]
I have determined the steps required to pull a specific version of RetroArch from the Git archive (in this case 1.3.6 as released on 17th July), and have the existing RetroPie setup system build this (instead of the default behaviour of pulling the very latest source code).
I'll write this up as an addendum to my original guide, but for now the required process is:
OBTAIN AND BUILD SPECIFIC VERSION OF RETROARCH TO ENABLE FFMPEG RECORDING
[edit - updated 28th September 2016 - adding manual ./configure step due to minor change in build subsystem; adding
sudo
to various commands following change in permissions of temporary build directories; adding creation of temporary build directories]Modify the RetroPie setup script for RetroArch:
cd /home/pi/RetroPie-Setup
If the following directories are not already present:
sudo mkdir tmp
sudo mkdir tmp/build
remove parameter which is disabling ffmpeg in retroarch:
sed -i "s/--disable-ffmpeg//" scriptmodules/emulators/retroarch.sh
Edit the script to prevent call which obtains the very latest version of RetroArch source from git repository:
sed -i 's@\(gitPullOrClone "$md_build" https://github.com/libretro/RetroArch.git\)@#\1@' scriptmodules/emulators/retroarch.sh
Obtain RetroArch version 1.3.6 (as a tar) from the git archive:
cd /home/pi/RetroPie-Setup/tmp/build
sudo wget https://github.com/libretro/RetroArch/archive/v1.3.6.tar.gz
Unpack tar archive file:
sudo tar xzvf v1.3.6.tar.gz
Remove the tar file:
sudo rm v1.3.6.tar.gz
Rename directory to that expected by setup script:
sudo mv RetroArch-1.3.6/ retroarch
cd retroarch
Manually run the configuration script for RetroArch
sudo ./configure
Run the setup script to build RetroArch 1.3.6 with ffmpeg enabled:
cd /home/pi/RetroPie-Setup
sudo ./retropie_packages.sh retroarch
Replace the modified script file (to prevent issues when running future updates via the retropie setup script, due to uncommitted changes in the local git repository casused by modifying this file)
git checkout scriptmodules/emulators/retroarch.sh
NOTE:
after running the script, the temporary build folder should be empty
/home/pi/RetroPie-Setup/tmp/build
...and
/opt/retropie/emulators/retroarch
should contain the freshly rebuilt version 1.3.6 retroarch -
@RetroResolution this trick useful for testing bugs between versions. Thanks for sharing.
But the RetroArch user interface you mentioned is the xmb menu driver. You can explicitly get the "old" rgui back setting
menu_driver = "rgui"
.Cheers.
-
@meleu thanks Meleu. The UI regression threw me somewhat - I started a new thread when I first noticed problems; @dankcushions was on there along with others, and also talked about the UI options - thanks for mentioning it though.
Resolving the loss of recording using the PlayStation emulator was my main focus - it's the main reason I started the entire FFmpeg project in the first place!
[Edit - somehow it's two weeks later and I've not yet written this update into the main guide...]
-
@RetroResolution I seem to hitting a snag. I followed everything to a T and have ffmpeg compiled, built retroarch with ffmpeg, set it up. Boots, emultationstation loads fine, emultators and roms play just fine...however when I go into RGUI and try to verify recording functionality is there, when I select Settings it says "No Information is Available" So I can't seem to see any retroarch settings.
I tried just passing the record parameter as well which launches the ROM but recording never happens or kicks off the ffmpeg process.
Any help would be greatly appreciated!
-
@shaun040 Hi,
I'll see what I can do!
Can you let me know which version of RetroPie you have installed?
Regarding the RetroArch RGUI, are you accessing this from within a running emulator, or via the RetroPie sub-menu in Emulation Station?
Can you let me know what the version number of RetroArch is, as reported in the bottom-left of the screen in the RGUI menu?
When following the guide, did you modify the version of RetroArch which RetroPie-Setup pulls by default (e.g. the very latest version from github), or did you follow the modified instructions to build the version of retroarch which was released in July 2016 (e.g. the instructions which are in this comments section ('OBTAIN AND BUILD SPECIFIC VERSION OF RETROARCH TO ENABLE FFMPEG RECORDING') and also in the comments section of the guide at: https://retroresolution.com/2016/07/06/recording-live-gameplay-in-retropies-retroarch-emulators-natively-on-the-raspberry-pi/)?
Thanks
-
@RetroResolution Thanks for replying!
RetroPie - 4.0.3
RGUI - 1.3.6
I've tried both accessing the RGUI menu via an emulator and the sub menu in emulation station. Once in the RGUI menu, I can use the arrow keys to select various menu items then pressing right shift is when I get the error.
In regards to setup, I tried both the default which pulls the latest then also tried the code to pull an exact version with the same results.
The very peculiar thing is I have a old SD card with RP 1.2.2 from a pre-built image and get the same error trying to get deeper into settings. Am I missing something simple? Is there a special key to get into sub menus? Enter doesn't work and it seems right shift and arrow keys are the only keys that do anything.
Cheers,
Shaun -
@shaun040 Hi,
Technically nothing actually needs to be done from within the RetroArch RGUI menu to configure the recording feature once it's been enabled during the build phase, but as you noted the feature isn't working for you via the runcommand menu configuration.
I'm unsure why you're not able to navigate RGUI which makes me wonder if something isn't working in the rebuilding RetroArch step (although given that you've used both approaches it's unlikely that this is the problem).
As a test, can you revert the RetroArch installation by installing the latest binary using the RetroPie-Setup menu, then test if you can navigate RGUI? You should be able to use whichever controller you have configured - if it works within the emulator, it should work within RGUI.
Have you checked the runcommand log ouput to see if it's revealing any information regarding the failure of the recording? On pre v4 RetroPie this was in \tmp\runcommand.log, but on the latest version I tested on I noticed this log file has been moved (unfortunately I can't recall where the new location is - my working system is still running RetropIe 3.8; my test system has just been re-purposed as a media center, and my new Raspberry Pi 3 test machine hasn't yet had RetroPie installed)
-
@RetroResolution Ok, so I managed to get settings to work.
Before I was logging into the machine via console then launching emulationstation by just running that command from the shell.
From there...rgui would only work with a keyboard since that was always plugged in on boot. Controller wouldn't work even if I unplugged the keyboard.
I then set emulationstation to start on boot and unplugged the keyboard so only the controller is there at the start. I can now get to the sub-menus in Settings! Success!
So as you mentioned in your article, the Recording menu is not there. However, I do see the Record function in the Driver menu but it is set to "null". I did check I ran the script without the --disable-ffmpeg. I'm now in the process of recompiling ffmpeg then going to re-run retroarch_packages.sh and check again.
I'll let you know how that goes!
Cheers,
Shaun -
@shaun040 Hi,
I've just noticed that the Raspbian image has been updated with a new 'Pixel' X-Windows desktop. I don't know if this has any impact - it shouldn't as far as I know, but you can never tell.
I'll start putting together an installation with the latest Raspbian Jessie / Pixel as the base, then I'll run through building ffmpeg, and finally install RetroPie and see if it works.
Is your RetroPie installation built on top of a Raspbian Jessie image, or did you use a RetroPie image as the base? (In all my tests I've always started with Raspian as the base, as per my guide https://retroresolution.com/2016/03/31/multipurpose-raspberry-pi-installing-a-media-gaming-pc-replacement/)
-
Whilst running through the instructions on a fresh Raspbian Jessie Pixel build, and using the latest RetroPie, I noticed an incorrect path in my revised instructions (above) which build a specific version of RetroArch.
I've edited the relevant post, above. The corrected line is:
sed -i 's@\(gitPullOrClone "$md_build" https://github.com/libretro/RetroArch.git\)@#\1@' scriptmodules/emulators/retroarch.sh
Without the correct path, the original
sed
command fails, and thus the system would still fetch the latest source version of RetroArch, rather than the specific build of 1.3.6 as was intended.I'm still installing things, so I don't yet know if changes to Raspbian and/or RetroPie are causing problems for recording. Thus far ffmpeg compiles, which in itself is great news.
-
Well, the good news is that I was able to build RetroArch with FFmpeg recording enabled, and have seen in RGUI that under Settings/Driver the 'Record Driver' entry is 'ffmpeg'.
I haven't actually tested the recording, as I'll need to move some roms and bios files onto the new test system, and setup the emulator.cfg files, but it looks like it will work on the latest Raspbian and latest RetroPie.
For reasons I haven't yet determined, I cannot now build a specific version of RetroArch using the instructions I posted earlier in this thread (that said, the blog commenter which prompted the creation of that approach has subsequently confirmed that his installation works fine using the original approach, in which the RetroPie-Setup script fetches the latest RetroArch version from github)
For posterity, the error I get when attempting to build 1.3.6 of retroarch as released on July 17th is:
Checking operating system ... Linux Unknown option --enable-opengles Makefile:9: config.mk: No such file or directory rm -rf obj-unix rm -f retroarch rm -f *.d Makefile:9: config.mk: No such file or directory config.mk is outdated or non-existing. Run ./configure again. Makefile:128: recipe for target 'config.mk' failed make: *** [config.mk] Error 1 /home/pi/RetroPie-Setup Could not successfully build RetroArch - frontend to the libretro emulator cores - required by all lr-* emulators (/home/pi/RetroPie-Setup/tmp/build/retroarch/retroarch not found).
It seems to me that the owner and permissions of the /tmp/build directories which the setup script creates beneath /home/pi/retropie-setup have changed - I believe they were both 'Pi' on my previous installations, but are now 'root'.
Regarding the error 'unknown option --enable-opengles', this is on the same line as the 'disable--fmpeg' command which the SED instruction removes, however I've checked that this works cleanly, and also manually excised the instruction, but with no success.
I'm wondering if you have any insights @meleu ? - you seem to be pretty hot on this stuff!
-
@RetroResolution I did run into that error as well earlier. After running ./configure manually and re-running the script it did rebuild retroarch but I still had the ffmpeg issue.
The good news is after recompiling ffmpeg and then pulling down a fresh latest copy of retropie, ffmpeg is now showing as enabled!
Thanks for your help!
-
@shaun040 that's great news, I'm glad recording is working for you.
I'm determined to work out why building a specific release of retroarch is no longer working - I suspect it's a change in RetroPie's build scripts, but just in case, could you let me know if your system was built on the new Raspbian image (with the Pixel desktop theme)?
-
I built it it on Raspian Lite - file name is 2016-05-27-raspbian-jessie-lite.img
I see that there is a newer version so I must have downloaded this one a day or 2 prior to the 9/23/2016 release being put up to download.
-
@shaun040 hi,
Thanks for this information, I appreciate it - that's also good news in that it eliminates the latest Raspbian as the issue regarding building a specific RetroArch version (I suspected as such - after all it can compile all of ffmpeg and assorted codecs).
Thanks also for noting that you were able to compile the July 17th build of retroarch 1.3.6 after manually running ./configure - that's where I got to last night (but I didn't actually do that, it was getting late!)
-
Further to yesterday's posts regarding problems with the custom build of RetoArch, it appears that some changes in the current/latest RetroPie build system have necessitated slightly revised steps to obtain and compile the specific RetroArch 1.3.6 build as released on 17th July.
I've edited the earlier post in which the steps are detailed, adding the creation of a couple of temporary directories, adding
sudo
to a few commands, and running the retroarch./configure
manually.As noted yesterday, it should only be necessary to run through these additional steps if an overnight build of RetroArch happens to conflict in some manner - normally the simpler approach to rebuilding RetroArch, as covered in the main guide, will suffice.
-
@RetroResolution just to finish off the updates from yesterday and today, I've just successfully tested recording from the following RetroArch emulators:
PlayStation (lr-pcsx-reamred),
VCS (lr-stella),
Megadrive (lr-picodrive).These tests were made on a fresh install of Raspbian Jessie with Pixel (Image 2016-09-23), with the latest RetroPie installed on top (4.0.3) as per my guide:
-
This is a great guide. I followed it last night and got gameplay recording working on my RetroPie with only a few hiccups. I've blogged about my experience and the steps I took (which are basically RetroResolution's steps) here: How To Record A GamePlay Video From A RetroPie
Personally I think that this would make a great default addition to RetroPie in the future.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.