Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tonytonyjan committed Aug 5, 2014
1 parent bd62c74 commit 08c6040
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions README.md
Expand Up @@ -4,7 +4,17 @@ A Sony Camera Remote API wrapper.

## Installation

gem install sonycam
$ gem install sonycam

## CLI Usage

$ sonycam api actTakePicture

The command above will prints the result as JSON format, you can process it with pipe, for example:

$ sonycam api actTakePicture | ruby -rjson -e "puts JSON.parse(ARGF.read).first"

The best way to learn sonycam CLI is make use of `sonycam help` command.

## Usage

Expand Down Expand Up @@ -47,21 +57,19 @@ api_client.request :actBoom
# => Sonycam::Error::NoSuchMethod: actBoom
```

### Liveview
## Livestream

```ruby
Liveview.stream(liveview_url) do |packet|
packet[:payload_data][:jpeg_data] # JPEG binary
end
```

For detail, read `PACKET.md` and `lib/sonycam/packet.rb`.
For detail, read `PACKET.md`, `lib/sonycam/packet.rb` and `examples/server.rb`.

## CLI Examples

The best way to learn sonycam CLI is make use of `sonycam help` command.
### CLI Example

### Livestream
`sonycam liveview` will print JPEG data stream to STDOUT, it can be easily used in pipe with commands such as `ffmpeg`, for example:

Record to mp4:

Expand All @@ -71,5 +79,5 @@ Record to mp4:
ffserver Stream:

$ ffserver -f examples/ffserver.conf
$ sonycam liveview | ffmpeg -r 30 -f image2pipe -c mjpeg -i pipe:0 -codec copy http://127.0.0.1:8080/feed1.ffm
$ sonycam liveview | ffmpeg -f image2pipe -c mjpeg -i pipe:0 -codec copy http://127.0.0.1:8080/feed1.ffm
$ open examples/index.html

0 comments on commit 08c6040

Please sign in to comment.