How to encode your video to a format, that can be played by most browsers?

Please note, that we do not support video encoding issues and questions! This documentation was made to try to help out, but any problem related to your video encoding has to be resolved by you!

You can use FFmpeg to encode your videos correctly. In this example the original video format is mp4, but it could be a different file format too.

☝️ Note: FFmpeg is available for Mac as well. In this article we'll cover the usage on Windows, but the FFmpeg commands are the same on Mac.

1
Step 1

Download FFmpeg for Windows.

2
Step 2

Unzip it to your computer, then enter its /bin folder. You should see a similar folder structure to this:

C:/ffmpeg[build details]/bin/

3
Step 3

Insert your original video into this bin folder and rename it to original.mp4:

C:/ffmpeg[build details]/bin/original.mp4

4
Step 4

Create a bat file in this folder. Let's call it encode.bat:

C:/ffmpeg[build details]/bin/encode.bat

5
Step 5

You should write this code into the bat file:

ffmpeg -i original.mp4 -vcodec h264 -an -strict -2 new.mp4
	
6
Step 6

Run the bat file. It should start running the code you entered. After it is done, a new.mp4 file should appear in your folder:

C:/ffmpeg[build details]/bin/new.mp4

This is the new video, which can be played in most browsers.

Additional options

There are multiple options offered by FFmpeg to work with your videos.

1
Resizing the video

The following code resizes the video to 1920*1080px.

ffmpeg -i original.mp4 -vf scale=1920:1080 -vcodec h264 -an -strict -2 new.mp4
	
2
First 10 seconds

Cut out the first 10 seconds, next to this resizing ( -ss is the start, -t is the end time in seconds):

ffmpeg -ss 0 -i original.mp4 -vf scale=1920:1080 -t 10 -vcodec h264 -an -strict -2 new.mp4
	
3
Create an image from the first frame
ffmpeg -i original.mp4 -vf scale=1920:1080 -vframes 1 firstframe.jpg
	
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.