Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
548 views
in Technique[技术] by (71.8m points)

ffmpeg - Does converting .mp4 to .mkv change data fidelity?

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.


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

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...