diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a662dae --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Alfred Gutierrez + +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. \ No newline at end of file diff --git a/README.md b/README.md index 3c3f4c0..7f70e5f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,59 @@ # `ffmpegd` An FFmpeg server with a websocket API for [FFmpeg Commander](https://github.com/alfg/ffmpeg-commander). +The goal is to provide a simple interface for sending FFmpeg jobs from the browser (and other supported clients in the future) while reporting realtime progress details. + +**Currently a work-in-progress!* + ## Install -TODO +``` +$ go get -u github.com/alfg/ffmpegd +``` + +Release binaries coming soon. ## Usage -TODO +* [ffmpeg](https://www.ffmpeg.org/download.html) must be installed and available on your `$PATH`. +* Run `ffmpegd`: +``` +$ ffmpegd +``` + +This wil start the websocket server in your current working directory and wait for a connection. + +* Go to https://alfg.github.io/ffmpeg-commander/ in the browser +* Enable `ffmpegd` in Options. +* Once connected, you can start sending encode jobs to ffmpegd! + +## Example +### `ffmpegd` with a job in progress from `ffmpeg-commander` +``` +$ ffmpegd + +███████╗███████╗███╗ ███╗██████╗ ███████╗ ██████╗ ██████╗ +██╔════╝██╔════╝████╗ ████║██╔══██╗██╔════╝██╔════╝ ██╔══██╗ +█████╗ █████╗ ██╔████╔██║██████╔╝█████╗ ██║ ███╗██║ ██║ +██╔══╝ ██╔══╝ ██║╚██╔╝██║██╔═══╝ ██╔══╝ ██║ ██║██║ ██║ +██║ ██║ ██║ ╚═╝ ██║██║ ███████╗╚██████╔╝██████╔╝ +╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═════╝ + v0.0.1 + +[ffmpegd] - websocket server for ffmpeg-commander. + +Server started on port :8080. +Go to https://alfg.github.io/ffmpeg-commander to connect! + +Encoding... 6111 / 17620 (34.68%) 3.37x @ 80.77 +``` +![ffmpeg-commander](screenshot.png) + + +## TODO +* Support all `ffmpeg-comamnder` JSON options. +* More CLI flags for server, ports, cwd and daemon mode. +* Logging options and output +* API documentation +* Docker ## License MIT diff --git a/main.go b/main.go index 3619774..d006cfa 100644 --- a/main.go +++ b/main.go @@ -19,15 +19,15 @@ const ( ██╔══╝ ██╔══╝ ██║╚██╔╝██║██╔═══╝ ██╔══╝ ██║ ██║██║ ██║ ██║ ██║ ██║ ╚═╝ ██║██║ ███████╗╚██████╔╝██████╔╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═════╝ + v0.0.1 ` - Banner = "[\u001b[32mffmpegd\u001b[0m] - websocket server for ffmpeg-commander.\n" - Usage = ` + Version = "0.0.1" + Description = "[\u001b[32mffmpegd\u001b[0m] - websocket server for ffmpeg-commander.\n" + Usage = ` Usage: ffmpegd [port] ffmpegd version -- This version. ` - - Version = "0.0.1" ) var clients = make(map[*websocket.Conn]bool) @@ -59,16 +59,19 @@ var progressCh chan struct{} func main() { printBanner() + // HTTP/WS Server. startServer() } func printBanner() { fmt.Println(Logo) - fmt.Println(Banner) + fmt.Println(Description) } func startServer() { http.HandleFunc("/ws", handleConnections) + + // Handles incoming WS messages from client. go handleMessages() fmt.Println("Server started on port :8080.") diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..bbf3482 Binary files /dev/null and b/screenshot.png differ