Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am wondering when I convert a .mp4 to .mkv using the following command if the quality changes.

ffmpeg -i in.mp4 out.mkv

The input file, in.mp4 has a file size of 297 megabytes, while the out.mkv file has a size of 249 megabytes, ~15% lower. Upon manual inspection, the resolution, video, and audio streams are the same before/after (as I would have expected given my (limited) knowledge of ffmpeg).

Is the 15% size decrease by simply converting to mkv actually not affect the quality of the video? If so this seems like a very reasonable way of freeing up some space on my computer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
550 views
Welcome To Ask or Share your Answers For Others

1 Answer

The quality gets worse

This is due to generation loss because you are re-encoding the video and audio to lossy formats. But you may not notice the difference.

The output file size will vary depending on the input format, if it was encoded well or badly, your output format, and the settings you use.

MP4 to MKV without quality loss

You can just re-mux and avoid re-encoding by using stream copy mode:

ffmpeg -i input.mp4 -c copy output.mkv

You can think of it like a copy and paste. The video and audio is untouched and just put into a new container.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...