# CLI transcode script with AMD AMF hardware acceleration
This repository contains a unified command-line script for transcoding
video using FFmpeg with AMD's Advanced Media Framework (AMF).
## Usage
```bash
./transcode [file] [options]
```
A bare filename (no options) is treated as the input file with default
settings: bitrate `5` Mbit/s, codec `av1`.
Bitrate values are plain integers in **megabits per second (Mbit/s)**.
| Long option | Short | Description |
| ------------ | ----- | ----------------------------------------------------------------- |
| `--input` | `-i` | Input file |
| `--bitrate` | `-b` | Target bitrate in Mbit/s, positive integer (default: `5`) |
| `--format` | `-f` | Codec: `av1` or `h265` (default: `av1`) |
| `--codec` | `-c` | Alias for `--format` |
| `--output` | `-o` | Output file (default: `<name>_<codec>_<bitrate>M.mp4`) |
| `--verbose` | `-v` | Print settings, the ffmpeg command and full ffmpeg output |
| `--help` | `-h` | Show help |
The bitrate may also be passed as the second positional argument.
### Examples
```bash
./transcode video.mkv # av1, 5 Mbit/s (defaults)
./transcode video.mkv 40 # av1, 40 Mbit/s
./transcode -i video.mkv -f h265 -b 20 # h265, 20 Mbit/s
./transcode video.mkv -o out.mp4 -v # explicit output, verbose
```
**Output:** Transcoded file saved to script's directory
## Installation
Link to a location in your PATH:
```bash
cp transcode ~/.local/bin/
```