This is a guide to getting a copy of the latest Daala source code and encoding a video with it.
There is also a Daala Quickstart Windows page.
- Standard build tools (autoconf, automake v1.11 or later, libtool, pkg-config, and a C compiler)
- libogg (v1.3 or later)
- libcheck (v0.9.8 or later, can be skipped if you pass --disable-unit-tests to ./configure)
- libsdl2 (can by skipped if you pass --disable-player to ./configure)
- libwxgtk2.8 (optional: only needed if --enable-analyzer is passed to ./configure)
Do not use linuxbrew.
Instructions for installing these packages are OS-specific (feel free to contribute some here, especially if you tried installing these somewhere and ran into difficulties; you will likely save other people some pain). If you have a package manager that has separate -dev versions with the public headers, make sure you install those in addition to the actual libraries.
Run the following command to install dependencies:
sudo apt-get install autoconf libtool libsdl2-gfx-dev libogg-dev libjpeg-dev libpng-dev check
Mac OS X
Install Apple's command line developer tools. E.g. install Xcode from the App Store and select 'Command Line Tools' from the Preferences::Downloads panel, or download and install the pkg directly from developer.apple.com.
Run the following command to install dependencies:
brew install autoconf automake libtool libogg libpng libjpeg check sdl2
Just run these commands:
git clone https://git.xiph.org/daala.git cd daala ./autogen.sh ./configure make
Note that the git clone can take several minutes to complete.
Make sure you run the git clone operation on the same machine where you intend to use the code. Checking out a copy on Windows and then trying to use it on Linux will not work, as executable permissions and line-endings will not be set properly.
Encoding a Video
Get a sample video or two in .y4m format from media.xiph.org.
These videos are relatively large and will take a long time to encode.
There are subsets of 1-second-long videos for faster encoding:
Xiph also maintains a set of still-image collections in .y4m format:
- Subset 1 (50 images, small training set)
- Subset 2 (50 images, small testing set)
- Subset 3 (1000 images, large training set)
- Subset 4 (1000 images, large testing set)
Using the encoder
Encode the video:
./examples/encoder_example -v 30 video.y4m -o video.ogv
- -v ??? specifies the amount of compression (currently from 0 to 511, where 0 is lossless, 511 is very lossy)
- video.y4m is the input video you want to encode
- -o video.ogv is the name of the encoded video file to output.
Use encoder_example.exe -h for the in-built help.
Decoding/Playing a Video
Play the video in a window:
For information on the controls available while playing, run
If you want to use a different player, you can decode the video back to .y4m with
./examples/dump_video video.ogv -o decoded_video.y4m
Or you can pipe the raw video stream directly to the player of your choice:
./examples/dump_video video.ogv | mpv -
Many other players can play back these .y4m files, and other tools can convert them to various other formats.
The Stream Analyzer
There is a bitstream analyzer, with a GUI based on wxWidgets available.
To run it:
where video.ogv is the file you want to open. If you omit it, you can open it via the analyzer's GUI.
The analyser may only work correctly with videos encoded using the same Daala version as itself, as the bitstream is still being changed regularly by the ongoing code development.
Using PNG Images
To encode a series of images:
make tools ./tools/png2y4m video%05d.png -o video.y4m
where %05d means your input images are named video00000.png, video00001.png, etc. You can leave out the %05d tag if you only want to convert a single image (which does not need to be numbered).
To convert a y4m back to PNGs:
./tools/y4m2png video.y4m -o video%05d.png
If you are converting a .y4m file that only contains a single frame (e.g., from one of the still-image subsets linked above), you can leave out the %05d tag. Conversion from PNG to Y4M uses the Rec 709 matrix with video levels, a box filter for chroma subsampling, and a triangular dither. Conversion back from Y4M to PNG uses the same matrix, levels, and box filter, but does not dither.
Converting to y4m from other formats
You can use the ffmpeg tool to generate y4m from any of its supported video formats:
ffmpeg -i video.webm -pix_fmt yuv420p video.y4m
Or just encode directly without an intermediate file:
ffmpeg -i video.webm -pix_fmt yuv420p -f yuv4mpegpipe - | ./encoder_example - -o video.ogv
Note that ffmpeg is optimized for speed. You may not get comparable results across machines.
Merging two y4m videos side-by-side
To combine two y4m videos into a single video (with the input videos displayed side-by-side), do:
ffmpeg -i left.y4m -i right.y4m -filter_complex "[0:v]setpts=PTS-STARTPTS, pad=iw*2:ih[bg]; \ [1:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=w" a_b_compare.y4m
avconv if needed.
Showing frame differences in a y4m file
To show the difference between two consecutive frames in a y4m file, do:
ffmpeg -i file.y4m -ss 0.03 -i file.y4m -filter_complex 'blend=all_mode=difference' -y diff.y4m
This actually compares the video with itself, but offset by 1 frame or 0.03 seconds.