In this series I would like to clarify the following questions. How can you test local videos and videos provided by a server? What tools are there? How could the test environment look like? … So these tutorials should provide an entry into the subject of video testing. In this part, we will provide the test environment.
Specification
- VirtualBox (5.1.28)
- Vagrant (2.0.0)
- ffmpeg (3.3.3-tessus)
additional Software
Files
# create project $ mkdir -p ~/Projects/ && cd ~/Projects/ # clone all files from repository $ git clone https://github.com/Lupin3000/VideoTest.git # change directory $ cd ~/Projects/VideoTest
Project Structure
$ tree . ├── src │ ├── directstream.html │ ├── index.html │ ├── livestream.html │ ├── nginx.conf │ └── simplevideo.html └── Vagrantfile
Prepare and run your test environment
The test environment will created by Vagrant. The Vagrant Base box needs to be provided with Debian 9. Therefore you have now 2 options. You can use a Debian 9 Base box from Vagrant cloud or you create your own. To create your own Debian 9 Base box you can use my Packer Git repository.
Please ensure, that the Vagrantfile is properly configured (config.vm.box_url, config.vm.box) before start-up environment.
# modify Vagrantfile (box name) $ vim Vagrantfile # start new environment $ vagrant up --provision-with install,prepare,start # open in browser $ open -a Safari http://localhost:8080/
After successful start you will find some informations on start page about How-to create, modify, upload and stream videos. In second tutorial we will have a detailed look on it.
To understand the background somewhat better, take a look!
# tail nginx log files (optional) $ vagrant ssh -c 'sudo tail -f /usr/local/nginx/logs/*.log' # show content of directory (optional) $ vagrant ssh -c 'sudo ls -la /tmp/hls/'
Develop some more
There are even more ways to publish video files (Media Streaming Server). You can easily expand the environment. Just customize/create the configurations and files in the “src” folder as well as the Vagrantfile. For Dynamic Adaptive Streaming over HTTP (DASH) support take a look here. This link opens the commercial software solution.
Note: You simply link the IDE with the “src” folder. To change the images and videos, just run vagant provisioner.
# run specific SHELL provisioner (video) $ vagrant provision --provision-with video # restart after configuration $ vagrant up --provision-with stop,prepare,start
Download and install ffmpeg binaries on macOS
Currently official ffmpeg packages are available for Windows, Linux (Debian, Ubuntu, Fedora, RedHat) and macOS. You can download latest versions here.
Here now a solution for macOS users, if you don’t like to install many additional software on your system (static FFmpeg binaries).
# download ffmpeg $ curl -C - -k https://evermeet.cx/ffmpeg/ffmpeg-3.3.3.7z -o ~/Downloads/ffmpeg-3.3.3.7z # install debian package $ vagrant ssh -c 'sudo apt install -y p7zip-full' # copy archive (into shared folder) $ cp ~/Downloads/ffmpeg-3.3.3.7z ~/Projects/VideoTest/src/ # unzip archive $ vagrant ssh -c '7z x /home/vagrant/src/ffmpeg-3.3.3.7z' # mv binary into src $ vagrant ssh -c 'mv /home/vagrant/ffmpeg /home/vagrant/src/ffmpeg' # delete archive (on shared folder) $ rm ~/Projects/VideoTest/src/ffmpeg-3.3.3.7z # mv binary into project folder (from shared folder) $ mv ~/Projects/VideoTest/src/ffmpeg ~/Projects/VideoTest/ # ensure binary is executable $ chmod +x ffmpeg
Now some basic ffmpeg commands, which should work now. If you like,you can move the binary into directory “/usr/local/”.
# show version $ ~/Projects/VideoTest/ffmpeg -version # show help $ ~/Projects/VideoTest/ffmpeg -help # list codecs $ ~/Projects/VideoTest/ffmpeg -codecs # list formats $ ~/Projects/VideoTest/ffmpeg -formats
Okay, that’s it for first tutorial.