Skip to content

rickycodes/retrorecord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retrorecord Build Status

share screenshots and recrordings to twitter:
https://twitter.com/whatmeplaying

Requirements

This was originally built to run on a Raspberry Pi 3 Model B running RetroPie. I've been able to get it working on my MiSTer as well. I'm sure it would work on other Retroarch's or with any system that's capturing screenshots or videos. I wouldn't try this on an older Pi 1, or single core system. The screenshot stuff should work (maybe this should be configurable?) but the recording/gif converting would likely be too slow on a single core system (it can already bog down the Pi 3 at times).

Requirements:

software command version
cargo cargo >=0.22.0
gifski gifski =0.8.2
ffmpeg ffmpeg =3.1.4

You need cargo to compile. gifski and ffmpeg are only required for video encoding and if you're only capturing screenshots they're not required.

If you are setting these things up on RetroPie you can follow these guides:

Installation

clone this repo somewhere:
git clone git@github.com:rickycodes/retrorecord.git

Configuration

The application requires the following environment variables to be exported on your system eg:

export TWITTER_CONSUMER_KEY= \
TWITTER_CONSUMER_SECRET= \
TWITTER_ACCESS_TOKEN= \
TWITTER_ACCESS_TOKEN_SECRET= \
SCREENSHOTS_DIR=/home/pi/.config/retroarch/screenshots/ \
RECORDINGS_DIR=/home/pi/recordings/ \
GIFS_DIR=/home/pi/gifs/

The directories should match what you have set on the system. /home/pi/.config/retroarch/screenshots/ above is common for retroarch,

If you don't have the above env vars set the application will quit on startup:

application started...
prompts are OFF
Couldn't read SCREENSHOTS_DIR (environment variable not found)

Cross compilation

If you're interested in building a bin that works on a pi from a non armv7 arch I've included a Docker file and a build script which provide some clues on how to do this.

Building the container

docker build -t retrorecord .

Running it

docker run --publish 8000:8000 --detach --name rr retrorecord

Building on the container

docker exec -it rr cargo build --verbose --target=armv7-unknown-linux-gnueabihf --release

This will create a release bin that you can then move to to your pi or host os eg:

wget http://localhost:8000/target/armv7-unknown-linux-gnueabihf/release/retrorecord

Don't forget to make it executable!

sudo chmod +x retrorecord

If you try running on an arch that doesn't match the target you'll get:

bash: ./retrorecord: cannot execute binary file: Exec format error

Build

build with cargo:
cargo build
or:
cargo build --release

Tests

run unit tests:
cargo test --verbose

Startup

run the binary:
./retrorecord
or:
./retrorecord --prompt
(this will prompt you before posting)

Usage:

run the binary:
./retrorecord
and you should see:

application started...
prompts are OFF

Screenshot:

Get to a screen in game that you'd like to capture and enter the main menu of RetroArch:
Go into the "Quick Menu" and select "Take Screenshot":

retrorecord will print something like this to stdout:

file written: "/home/pi/.config/retroarch/screenshots/Super Mario Bros 3 (U) (PRG 1)-180425-190211.png"
posted tweet!

Recording

Launch a game that has an emulator with an option where you've enabled recording:
(Press a button to configure):
Select default emulator, or Select emulator for ROM:
Select the emulator where you've enabled recording:
Now simply launching the game will start recording:

Once you exit the game the recording will stop and you should seem some ffmpeg output from retrorecord followed by:

gif complete!
gif_path is "/home/pi/gifs/output.gif"
posted tweet!

If you want to record specific sections of a game consider using save states: play the game with the normal emulator to a point where you'd like to start recording, save state then relaunch with the recording enabled and load state to record from that point onward.

Notes

All this app really does is watch folders for screenshots & recordings, so presumably you could get this to work on most systems? While this was used to create whatmeplaying you could use a similar setup to post screenshots/videos/gifs from games to anywhere (so long as there's an API of some sort).

Most of the magic (literally ImageMagick) is in the mkvToGif.sh file

License

MIT License

Copyright © 2017 Ricky Miller

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.