Skip to content

HTTP server that converts uploaded video into a specified format

License

Notifications You must be signed in to change notification settings

AndreyBychkov/VideoConverter

Repository files navigation

Video converter

Build Status

HTTP server for converting video into different formats, like MP4, AVI and etc.

There are two ways of usage Video converter at the moment:

  1. Native
  2. User Interface

Getting Started

Installing dependencies

  1. Server runs on Java Virtual Machine so be sure you have Java on your computer. You can download latest version here.

  2. Adding jar to your project

    1. If you use build system like Maven or Gradle follow this guide.
    2. Your can download jar directly from our latest release.

Running server

Here you can see sample pipeline.

val server = Server(host = "127.0.0.1", port = 8080)
server.start()
...
server.stop()

Remember that server occupies thread it is started in. So you usually run it something like this:

thread {
    server.run()
}

Using server

Roots

You can convert video using following request template: "/convert/${format}", where format is video format you want to convert your file into. Format must be in lowercase.

Example: /convert/avi

Requests

You make a request using POST method submitting a form with no more than one video file item.

Response

If request if correct server response to you with a content of converted file, represented as array of bytes.

Example of usage:

val response: ByteArray = request.post(...)
val videoFile = File("path/to/file")
videoFile.writeBytes(response)

Building from source

  1. clone project: git clone https://github.com/AndreyBychkov/VideoConverter.git
  2. run gradle build from project directory.
  3. run tests: gradle test

User Interface

Running script

  1. Open project folder in IDE.

  2. Run /src/main/kotlin/runServer.kt to launch server on 127.0.0.1:8080.

    Or you can run server any way you prefer.

jpg

If the server returns an Internal Error 500 it will be displayed on the page.