HTTP server for converting video into different formats, like MP4, AVI and etc.
There are two ways of usage Video converter at the moment:
-
Server runs on Java Virtual Machine so be sure you have Java on your computer. You can download latest version here.
-
Adding jar to your project
- If you use build system like Maven or Gradle follow this guide.
- Your can download jar directly from our latest release.
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()
}
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
You make a request using POST method submitting a form with no more than one video file item.
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)
- clone project:
git clone https://github.com/AndreyBychkov/VideoConverter.git
- run
gradle build
from project directory. - run tests:
gradle test
-
Open project folder in IDE.
-
Run /src/main/kotlin/runServer.kt to launch server on 127.0.0.1:8080.
Or you can run server any way you prefer.
If the server returns an Internal Error 500 it will be displayed on the page.