Convert H264 to MKV
Turn H264 videos into MKV. Re-encoded to H.264 unless video.codec says otherwise, because a raw stream carries no timestamps and copied B-frames would play out of order.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop H264 files on the dialor turn it to pick what to do
A raw H.264 stream in an MKV container.The video is re-encoded to H.264 and wrapped in Matroska, as one file.
What you get
One MKV file. A raw H.264 stream has no container, and MKV gives it one that holds video, multiple audio tracks and subtitle tracks.
The video is re-encoded to H.264 unless you pick another codec with Video codec. A raw stream carries no timestamps, and copied B-frames would play out of order, so the picture is not copied as it is.
Choosing a codec
Video codec sets how the picture is compressed. H264 plays almost everywhere. H265 gives about half the size of H.264, but older browsers cannot play it. VP9 is open and well supported in browsers. AV1 gives the smallest files and is the slowest to encode.
Constant rate factor sets the quality target from 0 to 51. Lower keeps more detail and makes a bigger file. A few steps up or down changes the size noticeably.
Resize, trim and speed
Set Max width or Set Max height to shrink a video that is larger than the limit. The shape is kept, and a smaller video is never enlarged. Both accept 16 to 20000.
Set Start at to cut seconds from the beginning, and Stop at to end at a second of the original. Stop at counts from the start of the original, so it must be later than Start at.
Set Speed to play faster or slower, from 0.25 to 4. Voices keep their pitch. Set Frame rate to change frames per second, and Rotate to turn the result by 90, 180 or 270 degrees clockwise.
When it fails
The conversion stops with
input_corruptedwhen the file could not be parsed. To go the other way, use MKV to H264.
H264 and MKV.What each format is, and the options this conversion takes.
- 01 · max_height
Max height (px)
Shrinks anything taller than this, keeping its shape. Anything shorter stays as it is, so nothing is ever enlarged.
16 to 20000 - 02 · max_width
Max width (px)
Shrinks anything wider than this, keeping its shape. Anything narrower stays as it is, so nothing is ever enlarged.
16 to 20000 - 03 · rotate
Rotate
Turns the result clockwise by a quarter, a half or three quarters.
90 · 180 · 270 - 04 · speed
Speed
Plays faster or slower. 2 is twice as fast and 0.5 half as fast. Voices keep their pitch.
0.25 to 4 - 05 · trim_end
Stop at (s)
Stops at this second of the original. It counts from the start of the original, not from where trimming starts, so it must be later than Start at.
0 to 86400 - 06 · trim_start
Start at (s)
Cuts this many seconds from the beginning. Decimals such as 1.5 work.
0 to 86400 - 07 · video.codec
Video codec
How the picture is compressed. Newer codecs make smaller files at the same quality but take longer to encode and play on fewer devices.
h264Plays almost everywhere.h265About half the size of H.264, but older browsers cannot play it.vp9Open and well supported in browsers.av1The smallest files, and the slowest to encode.
- 08 · video.crf
Constant rate factor
The quality target for the video. Lower keeps more detail and makes a bigger file. A few steps up or down changes the size noticeably.
0 to 51 - 09 · video.fps
Frame rate (fps)
Frames per second. Fewer frames make a smaller file and choppier motion. 24 to 30 looks natural, and 10 to 15 is common for animated pictures.
1 to 120 - 10 · video.stabilize
Stabilize
Steadies a video shot by hand. The motion is measured first, then smoothed, and the picture is zoomed in a little so the moving edges stay out of view. It takes about twice as long.
The formats
Raw H.264 Stream
An H.264 elementary stream with no container, as encoders and cameras write it.
- Extensions
- .h264 .264
- MIME type
- video
/h264 - Kind
- Video
Matroska Video
Matroska, an open container that holds any codec plus multiple audio and subtitle tracks.
- Extensions
- .mkv
- MIME type
- video
/x -matroska - Kind
- Video
In your code.The same H264 to MKV conversion through the API, for your app or your agent.
$ cv convert clip.h264 clip.mkv$ cv convert clip.h264 clip.mkvQuestions.What people ask about H264 to MKV.
It is re-encoded to H.264 unless you choose another codec with Video codec. A raw stream has no timestamps, and copied B-frames would play out of order.
Yes. Set Video codec to h265, vp9 or av1. Newer codecs make smaller files at the same quality but take longer to encode and play on fewer devices.
The file could not be parsed. The conversion stops with input_corrupted when that happens.
Yes. Set Start at to cut from the beginning and Stop at to end at a second of the original. Decimals such as 1.5 work for Start at.