How-to guide: Recording Live Gameplay in RetroPie’s RetroArch Emulators Natively on the Raspberry Pi (and Twitch streaming)
-
@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.
-
@selsine Cheers selsine, that's great to hear. I've responded to your comments on my blog as well (sorry for the delay in replying). Thanks
-
I've still not got around to revisiting the issue of getting Streaming to Twitch working, however this weekend a user posted a couple of links in the comments section of my blog post for the guide; in their linked article they use ffmpeg to stream from the Pi, albeit not from within RetroArch. I feel sure there's a way to combine all the available information and get this working!
-
@RetroResolution I actually got Twitch streaming working today and wrote a quick blog post about it: How To Live Stream To Twitch from a RetroPie
I ended up using the following FFmpeg settings, 'libmp3lame' caused a bus error and would crash so I switched to 'aac':
vcodec = libx264 acodec = libfdk_aac pix_fmt = yuv420p threads = 2 scale_factor = 1 format = flv video_preset = ultrafast video_profile = baseline video_tune = animation video_level = 1.2 sample_rate = 44100 audio_preset = aac_he_v2
I'm still trying to figure out the FFmpeg settings because what is available in the config file doesn't seem to match what the FFmpeg documentation has 100%. I'm assuming that some translation is happening but I'm not sure.
Maybe someone who knows FFmpeg really well can point us in the right direction.
If it's up my Twitch stream is here:
-
@selsine said in How-to guide: Recording Live Gameplay in RetroPie’s RetroArch Emulators Natively on the Raspberry Pi (and Twitch streaming):
The following config settings seem to be working much better than my previous settings:
vcodec = libx264 acodec = libfdk_aac pix_fmt = yuv420p threads = 2 scale_factor = 1 format = flv video_preset = ultrafast video_profile = main video_tune = animation video_bufsize = 512k video_minrate = 512k video_maxrate = 512k video_r = 60 video_g = 120 video_keyint_min = 60 sample_rate = 44100 audio_preset = aac_he_v2 audio_global_quality = 1
-
How about Youtube streaming? Is it possible?
-
@Rion said in How-to guide: Recording Live Gameplay in RetroPie’s RetroArch Emulators Natively on the Raspberry Pi (and Twitch streaming):
How about Youtube streaming? Is it possible?
Yup, I wrote up a quick guide: How To Live Stream To YouTube from a RetroPie
It's the same thing as streaming to twitch except you use the YouTube RTMP URL and your YouTube stream key.
I've noticed that the performance on the YouTube live stream isn't as good as the twitch stream, so the FFmpeg settings probably need to be tweaked.
-
Great work on the guide, thank you very much! Using scale_factor on the cfg to double the resolution really ramps up the CPU usage to make it impossible! I found a way to make it work and failed to get a recording thus far though.
Raspberry Pi 3 has an integrated hardware encoder, dubbed h264_omx and to use it you need to compile ffmpeg with these added:
–enable-omx
–enable-omx-rpi
–enable-mmalI compiled FFMPEG with these, but when I choose h264_omx as my encoder it results in an empty recording. What am I doing wrong?
Also, most encoders and formats do not work, which is really super weird.
By the way, if this works as intended, the hardware encoder can do live transcoded 720p livestreams or recordings with no sweat. I've seen a person use a raspberry pi 2 as a transcoding PC through nginx-rtmp to stream to Twitch.
-
Hi all,
I've managed to get gameplay recording working for PSX after following the great guides BUT I have hit a bit of a snag. Some PSX games record OK at first when you launch it so the intro, menus etc record OK, but as soon as you get in to the actual game the screen goes black and I can only hear sound. What have I done wrong?
I tested 3 PSX games:
Retropie 4.1
Retroarch 1.3.6Alexi Lalas International Soccer [See video below]
Lone Soldier
Doom (worked OK with no issues ??)
These are both using my config.cfg file which is as follows:
format = matroska
threads = 3
vcodec = libx264rgb
video_preset = ultrafast
video_tune = animation
pix_fmt = bgr24
video_qp = 0
acodec = flacCould it be an NTSC/PAL related problem?
Any ideas?
Thanks!
-
@RetroResolution , hi!
First of all, thank you for the rich tutorial! Besides I haven't accomplished to start the recordings, I think I will get there.
I am new to Retropie, but I could understand almost everything you told about this process.
I have a Raspberry Pi 3 running Retropie (fresh 4.1 installation) . I Did not install over an existing Raspbian, but instead, I've burned a Retropie 4.1.
RetroArch version is 1.3.6.I have succeeded the FFmpeg installation (used your script).
But, on the step:
"Rebuilding RetroArch to Enable FFmpeg Recording"
after following your instructions with the script:
#remove the config that disables ffmpeg on the RPI
sed -i "s/--disable-ffmpeg//" scriptmodules/emulators/retroarch.sh
#build new retroarch from source
sudo ./retropie_packages.sh retroarch
#put the file back how it was
git checkout scriptmodules/emulators/retroarch.shI 've got this:
I've tried to find the ffmpeg driver on settings menu ( I'm using Retroach 1.3.6)
but it still shows 'null'.Well, I've read your new considerations about "OBTAIN AND BUILD SPECIFIC VERSION OF RETROARCH TO ENABLE FFMPEG RECORDING".
I repeated all command line procedures as suggested by you and in the end I've got to this:
What am I doing wrong? Sorry for the long post, but I believe this is a feedback to you, as new releases come always with issues!Thank you!
Filipe
-
I compiled FFMPEG with these, but when I choose h264_omx as my encoder it results in an empty recording. What am I doing wrong?
Does anything show up in your /dev/shm/runcommand.log logfile when you try to use h264_omx?
-
Hey all!
I just want to say that I made it! I have flawless videos recordings from SNES!
But, as a feedback, I will put something I realized after trying different things.
First, as I posted before, I was trying to follow all procedures as described by the rich tutorial written by @RetroResolution - Recording Live Gameplay in RetroPie’s RetroArch Emulators Natively on the Raspberry Pi .
I was using a fresh Retropie 4.1 installation. As I told on the previous post, I've failed to rebuild Retroarch.
So, I decided to install the last version of Raspbian Jessie Light (without Pixel).
Then, I first installed FFmpeg using the All in One Script ( thanks again, @RetroResolution!) and tested it, confirming it was working properly.
I have manually installed and configured Retropie and, after using the few steps first described in the tutorial:
"OBTAIN AND BUILD SPECIFIC VERSION OF RETROARCH TO ENABLE FFMPEG RECORDING".
I still could not succeed!!!
Well, I got really intrigued with this persistent issue: fail to apply pach when running retroarch.sh during the rebuilding procedure...
So, as a last try, I went to the little tutorial posted by @selsine (thanks for that: How To Record A GamePlay Video From A RetroPie) because you put something important there:
"And finally execute it, but NOT as root:
$ . /home/pi/tools/build-retroarch-with-ffmpeg.sh"
And suddenly, Retroarch is rebuilt!
Well, I don't know if it has something to do with the permissions (ownership) but it did run.
Now, I am just testing some configurations, but it seem to run really smooth to me!
To conclude:
I suspect it does not work using retropie image from the website. If you manually install, it works! Please, correct me if I'm wrong.
And, many thanks to you guys for the amazing information you share!
-
@budegarower That's great. I'm pretty sure that you have to run it not as root. I think I remember running into the same issues when I was setting everything up.
-
got it recording but have no audio output to my tv the recording has audio though using hdmi
-
What do we need to do to make this come in standard release? I'd love to see this built in.
-
@selsine no, only the retroarch command is shown, e.g.:
pi@retropie:~ $ cat /dev/shm/runcommand.log
Parameters:
Executing: /opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-fbalpha/fbalpha_libretro.so --record /mnt/retropie/recording_$(date +%Y-%m-%d-%H%M%S).mkv --recordconfig /home/pi/RetroPie/recording/config.cfg --config /opt/retropie/configs/neogeo/retroarch.cfg "/home/pi/RetroPie/roms/neogeo/mspacmnf.zip" --appendconfig /dev/shm/retroarch.cfg
pi@retropie:~ $ -
Hello everybody,
thanks for your fantastic guide @RetroResolution , I got it working with almost no problems.However what I am experiencing with my Pi model 3 / 10,000kbit upload bandwidth (wlan though) is that my emulator stutters/lags slightly to badly in intervals of 20 minutes or so, and the stream was cut off completely after 2 hours. Cpu temperature/load and memory load were all good. At first I thought it might be related to me not using a real storage instead of the SD card but the swap file is always size 0 (using YARMan Web to check). I looked for some sort of logs but couldn't find anything relevant (runcommand.log has no errors). I already tried increasing the buffer size but that didn't do anything good.
Does anyone have an idea what this could be?
Btw I also found a -hwaccel option in ffmpeg which is disabled by default although there would be devices available. Would that be advisable? Couldn't figure out how to correctly use this though ("stream specifier"?)
edit: the following settings work for me:
video_bufsize = 4096k
video_minrate = 384k
video_maxrate = 384k
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.