Giter Club home page Giter Club logo

asciinema's Introduction

asciinema

Build Status license

asciinema (aka asciinema CLI or asciinema recorder) is a command-line tool for recording terminal sessions.

Unlike typical screen recording software, which records visual output of a screen into a heavyweight video files (.mp4, .mov), asciinema recorder runs inside a terminal, capturing terminal session output into a lightweight recording files in the asciicast format (.cast).

The recordings can be replayed in a terminal, embedded on a web page with the asciinema player, or published to an asciinema server, such as asciinema.org, for further sharing.

asciinema CLI demo

Notable features:

To record a session run this command in your shell:

asciinema rec demo.cast

To stream a session via built-in HTTP server run:

asciinema stream --serve

To stream a session via a relay (asciinema server) run:

asciinema stream --relay

Check out the Getting started guide for installation and usage overview.

Building

Building asciinema from source requires the Rust compiler (1.70 or later), and the Cargo package manager. If they are not available via your system package manager then use rustup.

To download the source code, build the asciinema binary, and install it in $HOME/.cargo/bin run:

cargo install --locked --git https://github.com/asciinema/asciinema

Then, ensure $HOME/.cargo/bin is in your shell's $PATH.

Alternatively, you can manually download the source code and build the asciinema binary with:

git clone https://github.com/asciinema/asciinema
cd asciinema
cargo build --release

This produces the binary in release mode (--release) at target/release/asciinema. You can just copy the binary to a directory in your $PATH.

To generate man pages and shell completion files, set ASCIINEMA_GEN_DIR to the path where these artifacts should be stored. For example:

ASCIINEMA_GEN_DIR=/foo cargo build --release

The above command will build the binary and place the man pages in /foo/man/, and the shell completion files in the /foo/completion/ directory.

Note

Windows is currently not supported. (See #467)

Development

This branch contains the next generation of the asciinema CLI, written in Rust (about the rewrite). It is still in a work-in-progress stage, so if you wish to propose any code changes, please first reach out to the team via forum, Matrix or IRC.

The previous generation of the asciinema CLI, written in Python, can be found in the main branch.

Donations

Sustainability of asciinema development relies on donations and sponsorships.

Please help the software project you use and love. Become a supporter or a corporate sponsor.

asciinema is sponsored by:

Consulting

If you're interested in integration or customization of asciinema to suit your needs, check asciinema consulting services.

License

© 2011 Marcin Kulik.

All code is licensed under the GPL, v3 or later. See LICENSE file for details.

asciinema's People

Contributors

alex avatar amr-keleg avatar avmnu-sng avatar bastiaanb avatar bentranter avatar caseyscarborough avatar cfelder avatar crazymerlyn avatar crestwave avatar davidbradway avatar dependabot[bot] avatar djds avatar djpohly avatar fornwall avatar gmjosack avatar gpotter2 avatar harkabeeparolus avatar jakubjedelsky avatar jellyfrog avatar krz8 avatar ku1ik avatar kurtpfeifle avatar laughedelic avatar low-power avatar samdmarshall avatar swills avatar theatrus avatar vanyakosmos avatar wyvernixtl avatar xfgusta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciinema's Issues

time processbar should be always visible

the processbar for time should be always visible under the recording.

and the processbar should also display elepsed time (on left) and remaining time (on right)

Save data to files while recording in real time

If one wants to record a really large screencast (kernel build, cluster deploy or just a terminal session of several days long), it would require alot of memory. There is also a risk of that asciinema process can be killed, and in this case even if it catched anything, data wil be lost.

To solve this, asciinema can save data into files in real time. Then it would be possible to recover aborted screencasts and record really long sessions. It also partially solves #21.

Better error messaging

Based on https://bugzilla.redhat.com/show_bug.cgi?id=1070266

When user try to upload a session onto server where asciinema's service doesn't run, one gets this ugly python output:

~ Asciicast recording finished.
~ Do you want to upload it? [Y/n] 
~ Uploading...
Traceback (most recent call last):
  File "/usr/bin/asciinema", line 9, in <module>
    load_entry_point('asciinema==0.9.8', 'console_scripts', 'asciinema')()
  File "/usr/lib/python2.7/site-packages/asciinema/__main__.py", line 7, in main
    get_command(sys.argv[1:], Config()).execute()
  File "/usr/lib/python2.7/site-packages/asciinema/commands/record.py", line 24, in execute
    self._upload_asciicast(asciicast)
  File "/usr/lib/python2.7/site-packages/asciinema/commands/record.py", line 46, in _upload_asciicast
    url = self.uploader.upload(self.api_url, self.api_token, asciicast)
  File "/usr/lib/python2.7/site-packages/asciinema/uploader.py", line 29, in upload
    headers=headers)
  File "/usr/lib/python2.7/site-packages/asciinema/requests_http_adapter.py", line 7, in post
    response = requests.post(url, data=fields, files=files, headers=headers)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 88, in post
    return request('post', url, data=data, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 335, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 438, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 327, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=3000): Max retries exceeded with url: /api/asciicasts (Caused by <class 'socket.error'>: [Errno 111] Connection refused)

Can be there any nice-looking error message about no possibility to connect/upload session to server instead?

Send screencasts to a different server

This might be solved by #14, but now that this is more than just a script you put in your path (right?) it might be nice to have an environment variable or something to point asciinema at a different server to upload screencasts.

Change install instructions to use HTTPS

The install instructions provide this command:

curl -sL get.ascii.io | bash

The install script is served over HTTPS, but the redirect from get.ascii.io happens in the clear. An attacker on the network could tamper with this redirect in order to run arbitrary commands on your computer.

The install instructions should use a https:// URL. If you don't already have a certificate for get.ascii.io, you can get one for free from StartSSL.

Record non-interactive programs by piping them to `asciiio` command

Currently you can run custom command instead of a shell by using "-c" option:

asciiio -c 'make'

This uses pty and still allows for interactive programs to be properly captured.

For non-interactive scripts we could implement reading from stdin, without need for forking/spawning child process etc:

make | asciiio

Subcommand: play

Would be nice to be able to replay any asciicast also inside your terminal with:

$ asciiio play 1234

where 1234 is id of asciicast found on the website.

Review recorded file before uploading

Some people are interested in reviewing the whole recorded output before uploading.

At the moment after recording there's question displayed:

Do you want to upload? [Y/n]

We can change it to:

y - upload, v - view recorded text, q - quit. [Y/v/q]?

Entering "v" would open the whole recorded text in less. Quitting less would
print above prompt again allowing you to upload/review/quit.

Thoughts?

Time on asciicast details

there should be a time field in ascii casts properties on page and also on index page

just like on Y.T.

getopt Python error on OS X 10.7.5

When I try run run asciiio I get a Python error:

$ asciiio
/usr/local/bin/asciiio:395: Warning: 'as' will become a reserved keyword in Python 2.6
  File "/usr/local/bin/asciiio", line 395
    except getopt.error as msg:
                     ^
SyntaxError: invalid syntax

$ python -V
Python 2.5.6

Any ideas?

Run shell as a login shell?

I noticed on many asciicasts that people explicitly source .bash_profile to get their colored prompt, functions and other handy stuff. Some people even get errors printed because their prompt uses some functions that they have defined in .bash_profile (prompt like other ENV variables gets inherited but functions not).

This is because recorder runs user's shell as interactive shell, but not as login shell.
Some terminal emulators run shell as login shell (with "-l" option), some not.
Recorder just does equivalent of exec $SHELL which translates to exec /bin/bash or exec /bin/zsh.

If there's a way in python script to check if the current shell in which it operates is a login shell we could use this information when spawning new inner shell. Getting the full command that was run to spawn user's current shell would also be helpfull.

Save recordings offline?

I'd like to know if it's a desirable feature to save recordings offline - e.g. record console and then save the relevant files offline. They could then be used to play on websites other than asciinema.org (given an extracted player).

One of the problems with this so far is that the python script just does some basic recording. Then there is a whole lot of post processing going on in the asciinema.org webapp (Ruby).

I already extracted (and adjusted/unrailsified) the relevant ruby parts and implemented basic saving in the python script. You can see what I've done on the save-files-locally branch of my fork.

Of course for this to be cool and sustainable the ruby post processing bits would have to go into a gem which can then be used by both offline people and the website could depend on it.

This together with an assets gem of the player (which is not too hard to extract) could enable people to record and show their own recordings without going through the website :)

I guess this somehow relates to #21

What do you think?

Thanks for your awesome work on this technology!

display shortcuts while recording

please embed also the pressed shortcuts into the recordings, so that a student can replay the cast in his console with the same shortcuts.

it can be shown as overlay or on a sidebar

or maybe also als a transcript under the video (like the transsript you can display if you have switched on translation captions on Y.T.)

Windows not supported, right?

A quick pip install test from the Github repo reveals that asciicinema doesn't work out of the box on Windows, even though it does install an .exe to the Python Scripts folder. On my Win7 machine It fails with ImportError: No module named termios.

A little searching reveals there (probably) isn't a Windows equivalent,
http://stackoverflow.com/questions/933745/what-is-the-windows-equivalent-to-the-capabilities-defined-in-sys-select-h-and-t, and that therefore asciicinema is likely not supposed to work on Windows.

It would be good if the Readme states what operating systems asciicinema is intended for / known to work on.

Pause feature (in recording mode)

It would be really useful to be able to pause and continue the asciinema recording process at any time. This is useful for outside interruptions, a long series of commands or executions.

I think one way to do this would be to use ctrl+z for pause and fg to get back to the session.

Python 3.4 Support ?

Hi.
Since I'm using Archlinux I'm always up to date both with Python 3 branch and Python 2 branch.
Here is the recent traceback I got (used the git version)
Traceback (most recent call last):
File "/usr/bin/asciinema", line 9, in
load_entry_point('asciinema==0.9.8', 'console_scripts', 'asciinema')()
File "/usr/lib/python3.4/site-packages/asciinema/main.py", line 7, in main
get_command(sys.argv[1:], Config()).execute()
File "/usr/lib/python3.4/site-packages/asciinema/commands/record.py", line 24, in execute
self._upload_asciicast(asciicast)
File "/usr/lib/python3.4/site-packages/asciinema/commands/record.py", line 46, in _upload_asciicast
url = self.uploader.upload(self.api_url, self.api_token, asciicast)
File "/usr/lib/python3.4/site-packages/asciinema/uploader.py", line 29, in upload
headers=headers)
File "/usr/lib/python3.4/site-packages/asciinema/requests_http_adapter.py", line 7, in post
response = requests.post(url, data=fields, files=files, headers=headers)
File "/usr/lib/python3.4/site-packages/requests/api.py", line 88, in post
return request('post', url, data=data, *_kwargs)
File "/usr/lib/python3.4/site-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/lib/python3.4/site-packages/requests/sessions.py", line 335, in request
resp = self.send(prep, *_send_kwargs)
File "/usr/lib/python3.4/site-packages/requests/sessions.py", line 438, in send
r = adapter.send(request, *_kwargs)
File "/usr/lib/python3.4/site-packages/requests/adapters.py", line 292, in send
timeout=timeout
File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 423, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 238, in _get_conn
return conn or self._new_conn()
File "/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 205, in _new_conn
strict=self.strict)
TypeError: init() got an unexpected keyword argument 'strict'

I don't know if the 'strict' argument is part of some specification or not.
Is there a way I could work with asciinema with 3.4 ? :)

delete from the command line

I somehow was able to upload a screencast without logging in (just by logging in), and now there doesn't seem to be a way to delete this screencast. http://ascii.io/a/1062

I have tried logging in as user ~pi, but that did not help, it seems to think its some other user pi (pi is my local username on my machine)

pty test fails with "Inappropriate ioctl for device"

Pty test fails when runs with routed output (eg. piped to tee command). Problem is in fcntl.ioctl, which return error in non-interactive shell environment.

nosetests -v tests/pty_recorder_test.py | tee tests.log

======================================================================
ERROR: tests.pty_recorder_test.TestPtyRecorder.test_record_command_returns_stdout_instance
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/asciinema-0.9.7/tests/pty_recorder_test.py", line 37, in test_record_command_returns_stdout_instance
    output = pty_recorder.record_command('ls -l')
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 102, in record_command
    _set_pty_size()
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 30, in _set_pty_size
    fcntl.ioctl(pty.STDOUT_FILENO, termios.TIOCGWINSZ, buf, True)
IOError: [Errno 25] Inappropriate ioctl for device
======================================================================
ERROR: tests.pty_recorder_test.TestPtyRecorder.test_record_command_writes_to_stdout
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/builddir/build/BUILD/asciinema-0.9.7/tests/pty_recorder_test.py", line 47, in test_record_command_writes_to_stdout
    pty_recorder.record_command(command, output)
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 102, in record_command
    _set_pty_size()
  File "/builddir/build/BUILD/asciinema-0.9.7/asciinema/pty_recorder.py", line 30, in _set_pty_size
    fcntl.ioctl(pty.STDOUT_FILENO, termios.TIOCGWINSZ, buf, True)
IOError: [Errno 25] Inappropriate ioctl for device
----------------------------------------------------------------------

Edit befor upload

Sometimes you type in something private (directory names, hidden ip adresses).

there should be a method to anonymize some data before uploading.

asciinema rec DistributionNotFound on Mac 10.9

Hello,

I am attempting to get 'asciinema rec' going on a new laptop:

  • mac 10.9.2
  • xcode xcode 5.1.1 w/cli
  • python '2.7.5 (default, Sep 12 2013, 21:33:34) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]'

I am seeing the following:

asciinema rec
Traceback (most recent call last):
File "/usr/local/bin/asciinema", line 5, in
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in
working_set.require(requires)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: requests>=1.1.0

Any thoughts? Love the idea, keep up the good work.

Regards.

Ron

git branch parsing output error only in recording mode

Hi !
This looks like a great tool, but I just met an issue, and I'm not able to find anything in the history.

So here it is : https://asciinema.org/a/7767. As you can see there is an error :

bash: parse_git_branch: command not found

So it is for sure connected to this line in my .bash_profile :

#Color branches
parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ \[\1\]/'
}

PS1='\t:\[\033[0;32m\]\u\[\033[0m\]@\[\033[01;31m\]\w\[\033[1;35m\]$(parse_git_branch)\[\033[00m\] \$ ' 

Any hint would be appreciated.

Thanks

Git completion wc status in bash prompt not working

I have git-completion enabled in my bash profile:

source ~/git-completion.bash
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="verbose"
# \$(parse_svn_revision)
export PS1="\[\033[1;30m\][\$(date +%H:%M)] \w \[\033[0m\]\$(__git_ps1 '(%s) ')\n\[\033[1;30m\]>\[\033[0m\] "

When I start recording a session, env variables seems to be inherited by the newly spawned shell, but not the function form git-completion:

bash: __git_ps1: command not found

ProductName: Mac OS X
ProductVersion: 10.7.3
BuildVersion: 11D50b

Requests version is wrong

It gives this error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/asciinema", line 5, in
from pkg_resources import load_entry_point
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 2671, in
working_set.require(requires)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 654, in require
needed = self.resolve(parse_requirements(requirements))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg/pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: requests>=1.1.0

So I install requests. It grabs version 2.2.1. Which is >= 1.1.0... right?

So yeah, that's wrong. Any suggestions?

Cannot confirm/deny upload after finished recording (OSX)

After recording in the terminal, I press Ctrl+d, which prints out (the extra indentation on the second line is literally how it shows up):

~ Asciicast recording finished.
                               ~ Do you want to upload it? [Y/n]

After this point, I cannot confirm nor deny the upload. In fact, if I type anything it does not show up in the terminal after the above is displayed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.