What are some recommended PHP extensions or functions for accurately determining the MIME type of a video file for streaming purposes?

When streaming video files, it is important to accurately determine the MIME type of the file in order to ensure proper playback and compatibility with the player. One recommended way to achieve this is by using the PHP `finfo` extension, which allows you to determine the MIME type of a file based on its content. By using the `finfo_file()` function, you can retrieve the MIME type of a video file and use it for streaming purposes.

$filename = 'video.mp4';

$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($finfo, $filename);
finfo_close($finfo);

echo $mime_type;