When I try to download video from YouTube in FireFox browser, it shows only MKV video extension. How to download MP4 video from YouTube in FireFox?

You need to close all YouTube web pages in FireFox. Then you need to clear cache in FireFox and delete cookies for YouTube.com

To do this click on FireFox menu (arrow 1 on the image), select on "Settings" menu item (arrow 2 on the image), select "Privacy & Security" tab (arrow 3 on the image) and press "Clear Data..." button in "Cookies and Site Date" section.

Open 'Clear Data...' dialog in FireFox

Uncheck "Cookies and Site Data" option to clear only cache (arrow 1 on the image) and press "Clear" (arrow 2 on the image).

Clear 'Cached Web Content' in FireFox

Then press "Manage Data" (arrow 1 on the image) and on a new dialog enter "youtube" in search bar to find cookies for YouTube and select it in the list (arrow 2 on the image). Then press "Remove Selected" (arrow 3 on the image) and then "Save Changes" (arrow 4 on the image).

Clear cookies for YouTube in FireFox

After this you can open YouTube site in FireFox again and play any video. IDM should show MP4 format option on its video download panel for that video.