Videos
For videos with audio tracks, we recommend encoding videos using ffmpeg with the following
settings:
ffmpeg -i INPUT \
-preset veryslow \
-keyint_min 2 -g 24 -sc_threshold 0 \
-c:v libx264 -pix_fmt yuv420p -crf 17 \
-c:a aac -b:a 256k -ac 2 -ar 48000 \
-movflags +frag_keyframe+empty_moov+default_base_moof \
OUTPUT.mp4
This ensures wide browser compatibility. A CRF value below 18 is generally considered visually lossless. For audio, compression at 256 kbps or above is considered unnoticeable [1, 2].
For videos without audio, use the following settings:
ffmpeg -i INPUT \
-preset veryslow \
-keyint_min 2 -g 24 -sc_threshold 0 \
-c:v libx264 -pix_fmt yuv420p -crf 17 \
-an \
-movflags +frag_keyframe+empty_moov+default_base_moof \
OUTPUT.mp4
The -movflags option creates fragmented mp4 files, which our platform requires for mp4 videos.
Videos uploaded to our platform are fragmented automatically, using ffmpeg to remux without
transcoding. Videos in self-hosted datasets must already be fragmented: we only read your URLs and
cannot rewrite your files, so processing a self-hosted dataset that contains an unfragmented mp4
fails with a media validation error (<file> is not fragmented.) and leaves the dataset in an
error state.
References
[1] Pras et al. (2009). Subjective Evaluation of MP3 Compression for Different Musical Genres.
[2] Hines et al. (2014). Perceived Audio Quality for Streaming Stereo Music.