![]() ![]() How about the bash file? Inside setup-ffmpeg.sh add the following: #!/usr/bin/env bash echo 'deb jessie main non-free' > /etc/apt/sources.list echo 'deb-src jessie main non-free' > /etc/apt/sources.list apt-get update apt-get install -y -force-yes deb-multimedia-keyring apt-get remove -y -force-yes ffmpeg apt-get install -y -force-yes build-essential libmp3lame-dev libvorbis-dev libtheora-dev libspeex-dev yasm pkg-config libfaac-dev libopenjpeg-dev libx264-dev libav-tools ffmpeg Let’s also create the files we’ll need while we’re at it: touch Dockerfile server.js setup-ffmpeg.sh Let’s go to our terminal, create a fresh directory, and set up a node project: mkdir file-conversion-api & cd file-conversion-api & npm init ![]() If you’d rather use another framework, have at it, though the most up-to-date FFmpeg wrapper I could find was made for Node. We need Node to create our web server and coordinate our different libraries. In this example, we’ll be adding a simple web server that’ll be making FFmpeg requests. ![]() We can install FFmpeg inside the virtual container and then anything inside this container will be able to access FFmpeg’s functionality. The proper term for what it builds is a virtual container. I like to think of it as a slimmed down virtual machine. You can convert all sorts of video and audio files, and it’s what we’re going to use today. After many many years of bug fixes, this framework has become a sort of gold standard in the field. If you’ve researched encoding/decoding tools, chances are you’ve come across FFmpeg. With this approach, you should be able to convert any video or audio file you want provided it’s listed here: In this example we’ll convert a webm file to mp3. Thought I’d share how I went about building a file conversion API. Build a file conversion API using FFmpeg, Docker, and Node.js ![]()
0 Comments
Leave a Reply. |