https://github.com/livepeer/transcode-cli
CLI transcoding tool
https://github.com/livepeer/transcode-cli
Last synced: 12 months ago
JSON representation
CLI transcoding tool
- Host: GitHub
- URL: https://github.com/livepeer/transcode-cli
- Owner: livepeer
- Created: 2021-12-09T23:42:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-22T16:57:12.000Z (over 4 years ago)
- Last Synced: 2025-07-17T21:07:45.470Z (12 months ago)
- Language: Go
- Size: 69.3 KB
- Stars: 9
- Watchers: 4
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Transcoding on Demand
[Latest release][latest]
Our Transcoding on Demand tool is a Command-Line Interface (CLI) that
allows an application to leverage the Livepeer network for video
transcoding, thus removing a complex transcoding scalability
requirement that usually comes with building a video streaming
service. At the same time, it's flexible enough to plug into any
bespoke video workflow, because any backend software can easily invoke
a cli command. It is open source, and currently in beta.
We welcome your feedback at and suggestions about
how this tool addresses your needs, or how it can be improved to help
you better address your needs.
You’re also welcome to communicate with our team in the [Livepeer
Discord server][discord] #video-dev channel.
## Installing `livepeer-transcode`
What you'll need:
- [A Livepeer.com API Key][1]
- A way to unzip packaged files
- MP4 or TS video that you'd like transcoded into other renditions
### Steps to install
- [Download the binary][latest] for your OS (Windows, Linux, Mac) and
arch.
- Execute the file
- **NOTE**: If you're on a Mac and get an "*unidentified
developer*" security warning, follow [this guide][2] to
circumvent it while we work on removing this warning.
## Using `livepeer-transcode`
Tool accepts `.mp4` and `.ts` file. Output be `.mp4`, `.ts` or `.m3u8`
(HLS manifest).
For HLS output tool will write master playlist and one media playlist
for each transcoding profile.
## Examples
MP4 Output:
```shell
./livepeer-transcode --api-key {API key} transcode name_of_input_video.mp4 name_of_output_video.mp4 -r 256x144 -b 400 --framerate 47 --profile baseline --gop 20s
```
or
```shell
./livepeer-transcode transcode --api-key API_KEY input_file_name.mp4 output_file_name.mp4 --profiles config.json
```
HLS output:
```shell
./livepeer-transcode transcode --api-key API_KEY input_file_name.mp4 output_dir/output_file_name.m3u8 --profiles config.json output_dir
```
## Subcommands
The subcommands are structured like this: `livepeer-transcode [subcommand]`
- `help` — Global help about the `livepeer-transcode`
- `list-presets` — Lists available transcoding presets
- `transcode` — Transcodes video file using Livepeer API
You can also use `livepeer-transcode [subcommand] --help` for more
information about a specific subcommand.
### Global Flags
The global flags should be specified before the subcommand and are the same for all:
- `-h` / `--help` — display help for livepeer-transcode
- `-v` / `--version` — display version of livepeer-transcode
- `-a` / `--api-host` — API-host string Livepeer API host (default "[livepeer.com](http://livepeer.com/)")
- `-k` / `--api-key` — API-key string for Livepeer API key
### The `transcode` subcommand
The `transcode` subcommand is used like this:
```shell
livepeer-transcode transcode input.[ts|mp4] output.[ts|mp4] [flags]
```
The first argument after `transcode` is the path to the input file to
be transcoded, and the second one is the path for the output file
where the transcoded renditions will be written. After that one must
specify flags to configure the transcoding job:
- `-h` / `--help` — display specific help for the `transcode` subcommand
- `-b` / `--bitrate` — set bitrate of the output in `Kbps`
- `-r` / `--resolution` — set resolution of the output
NOTE: Resolution will automatically adjust to be proportional to the
resolution of the input video to avoid stretching of the frames.
- `-f` / `--framerate` — set framerate of the output in frames per
second (`fps`)
- `-g` / `--gop` — set GOP size of the output, specified as the time
between two keyframes, in seconds.
- `-p` / `--presets` — comma-separated list of transcoding presets
(e.g. `P720p30fps16x9`). Use `list-presets` to get a list of presets
available to use.
- `-o` / `--profile` — determines hardware acceleration for
encoding. Options are `baseline`, `main`, or `high`.
- `--profiles` - file name with desired encoding profiles in JSON
format. Example [config.json](config.json)
## Profile structure
```jsonc
{
"name",
"width", // number
"height", // number
"bitrate", // number, in bits per second
"fps", // number
"fpsDen" // number, fps denominator, do not set if fractional fps is not needed
"gop" // string, for example: 2s
"profile" // one of - H264Baseline - H264Main - H264High - H264ConstrainedHigh
}
```
[1]: https://livepeer.com/docs/guides/start-live-streaming/api-key
[2]: https://support.apple.com/en-gb/guide/mac-help/mh40616/mac
[latest]: https://github.com/livepeer/transcode-cli/releases/latest
[discord]: https://discord.gg/uaPhtyrWsF