1

Is it important to convert mp4 video to another formats like webm or is mp4 enough?

I tried to convert to webm in online services, but it makes the size of the video file much bigger. The size before was 7 MB and after it was converted it became 12MB.

<video controls>
    <source
        src="video.webm"
        type="video/webm"
    >
    <source
        src="video.mp4"
        type="video/mp4"
    >
</video>

I want small page sizes, good performance, good quality, and browser compatibility.

2

https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Video_and_audio_content

Firstly,

The audio and video tracks within the container hold data in the appropriate format for the codec used to encode that media. Different formats are used for audio tracks versus video tracks. Each audio track is encoded using an audio codec, while video tracks are encoded using (as you probably have guessed) a video codec.

Since MDN uses mp4 in demo, I don't see any contraindications. For better compression you may use Cloudinary or Sirv or any dedicated video CDN.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.