MKV vs MP4 (M4v)

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Charlie98

Diamond Member
Nov 6, 2011
6,292
62
91
My guess is that he's using Handbrake to "rip" the videos, and it's doing several things at once making the whole process more confusing in the end. That's why I suggested he simply rip the raw video to MKV format.

Yes, I am... AnyDVD to break it, Handbrake to.... what? Encode it? And, yes, I'm in Win7.

I don't want to spend just a whole bunch of effort on BD's... I only have about 10 of them. I wasn't all that wow'ed with BD playback on the stand-alone LG player we have, and the disks themselves are quite fragile. We ruined our original copy of Star Trek already.... :mad: (I think the darned player scuffed it up,) so we aren't even buying BD any longer.

The other downside is the file size based on what I've seen (and Zxian confirms... 35GB for one movie!?!?) I don't have that kind of storage.

I have or had MPC-HC already, but never really used it for anything... never needed to.
 

AkumaX

Lifer
Apr 20, 2000
12,642
3
81
Yes, I am... AnyDVD to break it, Handbrake to.... what? Encode it? And, yes, I'm in Win7.

I don't want to spend just a whole bunch of effort on BD's... I only have about 10 of them. I wasn't all that wow'ed with BD playback on the stand-alone LG player we have, and the disks themselves are quite fragile. We ruined our original copy of Star Trek already.... :mad: (I think the darned player scuffed it up,) so we aren't even buying BD any longer.

The other downside is the file size based on what I've seen (and Zxian confirms... 35GB for one movie!?!?) I don't have that kind of storage.

I have or had MPC-HC already, but never really used it for anything... never needed to.

Already ripped? Good.. good..

Personally, I use MeGUI to do everything. However, there is a bit of a learning curve.

Recently, I've had very good luck with XMedia Recode, however. This might suite you better.
http://www.videohelp.com/tools/XMedia-Recode
 

Charlie98

Diamond Member
Nov 6, 2011
6,292
62
91
Already ripped? Good.. good..

Personally, I use MeGUI to do everything. However, there is a bit of a learning curve.

Recently, I've had very good luck with XMedia Recode, however. This might suite you better.
http://www.videohelp.com/tools/XMedia-Recode

Hmmm... maybe I am missing something, re: ripping to BD. What I've done so far, with success, is use AnyDVD to break the disk, and then use Handbrake to encode (if that's the correct word) the disk to MKV. I can play the MKV file with VLC but not WMC/MB.

I would like to be able to play my BR file with WMC/MB... what you are saying (I think) is I can use XMedia or MeGUI (or Handbrake?) to remux it into a MP4 format (container) so I can play it with WMC and the file size won't be astronomical?
 

Zxian

Senior member
May 26, 2011
579
0
0
You're partially right. AnyDVD has been breaking the copy protection. Handbrake has been encoding the video using an h.264 codec. Handbrake has then muxed the video (h.264) and audio (dts/aac/whatever) streams into an mkv file.

If you want to use MKV files in WMC, all you need to do is apply the registry entries that are found in the following link. This will make MKV files discoverable in WMC.

http://www.hack7mc.com/2009/02/mkvs-for-minimalists-on-windows-7.html

Don't bother with installing FFDShow or Gabest - just use the LAV Filters I mentioned eariler. They're simpler to setup.

I personally wouldn't bother with mp4 files for anything other than iDevices. The format is far more restrictive regarding what you can put into it. MKV files can contain anything. As long as you have the right filters installed to decode whatever streams come out of that file, it'll just work.


Ripping from a DVD is, conceptually, no different than BluRay. The source video and audio are usually re-encoded, and then muxed into a container. The only real difference is the number of pixels in each video frame. :)
 
Last edited:

AkumaX

Lifer
Apr 20, 2000
12,642
3
81
Hmmm... maybe I am missing something, re: ripping to BD. What I've done so far, with success, is use AnyDVD to break the disk, and then use Handbrake to encode (if that's the correct word) the disk to MKV. I can play the MKV file with VLC but not WMC/MB.

I would like to be able to play my BR file with WMC/MB... what you are saying (I think) is I can use XMedia or MeGUI (or Handbrake?) to remux it into a MP4 format (container) so I can play it with WMC and the file size won't be astronomical?

Yah, you're right. To put it simply:

AnyDVD to break the disc, and copy to hard drive - I refer to this as "ripping".
Now you have a giant 30GB-45GB BluRay structure on your hard drive. You want to compress it to a smaller file size, just the main movie portion, and possibly remove any extras (such as extra audio)
So you could use HandBrake, XMedia, or MeGUI to do that.
Also, HandBrake, XMedia, and MeGUI will stick that final video/audio file, and mux the video/audio into an .mkv or .mp4 container.

I downloaded HandBrake, and couldn't figure out how to "change containers". I did see however, that you can choose either .mp4 or .mkv as a final container.

I check XMedia. I could open my .mkv, and chose, say, some Apple preset. I was able to choose "Video Copy" instead of "Convert", so that it'll just take the underlying video stream and copy it directly into the final container (.mp4). However, I couldn't figure out how to "Audio Copy", it would want to re-encode the audio as well.

I was able to use MeGUI to: extract the raw video and raw audio from the .mkv, and then remux them back into an .mp4 (straight source copies, no encoding/converting involved), no increase in file sizes, etc...

------

You're partially right. AnyDVD has been breaking the copy protection. Handbrake has been encoding the video using an h.264 codec. Handbrake has then muxed the video (h.264) and audio (dts/aac/whatever) streams into an mkv file.

If you want to use MKV files in WMC, all you need to do is apply the registry entries that are found in the following link. This will make MKV files discoverable in WMC.

http://www.hack7mc.com/2009/02/mkvs-for-minimalists-on-windows-7.html

Don't bother with installing FFDShow or Gabest - just use the LAV Filters I mentioned eariler. They're simpler to setup.

I personally wouldn't bother with mp4 files for anything other than iDevices. The format is far more restrictive regarding what you can put into it. MKV files can contain anything. As long as you have the right filters installed to decode whatever streams come out of that file, it'll just work.


Ripping from a DVD is, conceptually, no different than BluRay. The source video and audio are usually re-encoded, and then muxed into a container. The only real difference is the number of pixels in each video frame. :)

It's funny that you think mp4 files are 'restrictive'. They are there to (somewhat) preserve compatibility between all types of media players. I think the fact that .mkv's can contain anything is why it's so problematic between players. Until .mkv's take off, .mp4's going to be here for a while.
 

ctbrowncoat

Junior Member
Dec 24, 2013
1
0
0
An unencoded BluRay movie will be large. 16GB is pretty small by my standards. :p

...

Once you've got that file on your system, you should be able to play it using VLC or MPC-HC. If you've managed to cross this milestone, then we can worry about re-encoding the video to save some disk space and make it possible to play back on multiple devices. :)

Hey Zxian, not sure if you're still following this thread... can you share your thoughts on that last point? RE-encoding an MKV video to save space? I'm using Plex Media Server and a Blu-ray rip from MakeMKV is usually in the 20-30GB file. Huge! Using Handbrake to re-encode it to 720 or 1080 tends to save space, but one movie takes like 12 hours to re-encode! (Unless I'm doing something horribly wrong.) Any other suggestions for making those huge, raw MKV rips smaller while maintaining high quality for use by Plex?

THANKS in advance!
 

smitbret

Diamond Member
Jul 27, 2006
3,389
23
81
Hey Zxian, not sure if you're still following this thread... can you share your thoughts on that last point? RE-encoding an MKV video to save space? I'm using Plex Media Server and a Blu-ray rip from MakeMKV is usually in the 20-30GB file. Huge! Using Handbrake to re-encode it to 720 or 1080 tends to save space, but one movie takes like 12 hours to re-encode! (Unless I'm doing something horribly wrong.) Any other suggestions for making those huge, raw MKV rips smaller while maintaining high quality for use by Plex?

THANKS in advance!

I know I'm not the guy that you specifically asked for but I can answer your question.... kind of.

"Quality" is a subjective thing and is also influenced by things like screen size and distance you sit from the screen. Any time you re encode, you are going to lose some quality, there's no way around it. The smaller you make the file, the lower the quality.

Re-encoding a movie can take anywhere from 1 hour to 20 hours depending on the settings you use. The faster the encode, the lower the quality. Keep in mind that nothing replaces file size and bitrate. No matter how good your settings or how long the encode took, a 5GB will not have anywhere near the quality of a 20GB rip. But you can make perceivable difference with the settings where one 5GB file looks much better than another 5GB file.

Only you can decide the quality you require. I can offer suggestions and settings that I use, but basically, it's an art.
 

mindbomb

Senior member
May 30, 2013
363
0
0
mp4 is better for compatibility, but limited in terms of audio, only stereo AAC.
mkv can do 7.1 flac if you wanted.
 

SlitheryDee

Lifer
Feb 2, 2005
17,252
19
81
I would think there would be zero difference as far as quality. The streams that go into both containers are the same. You can always extract the streams and recombine them if you want to change containers. I primarily use mkv files, but I guess mp4 would have better compatibility. At least I've noticed more devices that support it out of the box.
 

mindbomb

Senior member
May 30, 2013
363
0
0
i forgot subtitles. if you use mp4, you have to use text subtitles. Which means you have to ocr subs. with mkv, you can just put in the bluray subs and call it a day.
 

Anteaus

Platinum Member
Oct 28, 2010
2,448
4
81
A more abrupt way to view it is to say that using .MKV is lossless (relative to the source, it isn't true lossless when compared to the masters) and .MP4 (H.264, specifically) is Lossy. If you want to maintain the original quality of the source media, then .MKV is preferable. If you don't mind a drop in fidelity, whether it be noticeable or not, then H.264 is preferable. I should preface this by saying that most recent releases on Blu-ray are already h.264 and technically lossy and you are simply using handbrake to re-encode it to reduce file size.

Ultimately, the deciding factor is space. In an ideal world, we would all use .MKV.

OP, you didn't make a bad decision using Handbrake if you are happy with the results. That said, if you are looking to create "reference" level copies of your media, then you might need to rethink it. Just remember that you will need to prepare for an extraordinary increase in storage needs. For comparison, the average Blu-ray release is 25-35 GB just for the film, excluding extras. Handbrake can get that down to 4-8GB in many cases with little loss in relative fidelity. So, in short, a "handbraked" collection will have 1/4 to 1/3 of the storage requirements of .MKV. Trust me when I say, it will add up very quickly.
 
Last edited:

smitbret

Diamond Member
Jul 27, 2006
3,389
23
81
A more abrupt way to view it is to say that using .MKV is lossless (relative to the source, it isn't true lossless when compared to the masters) and .MP4 (H.264, specifically) is Lossy. If you want to maintain the original quality of the source media, then .MKV is preferable. If you don't mind a drop in fidelity, whether it be noticeable or not, then H.264 is preferable. I should preface this by saying that most recent releases on Blu-ray are already h.264 and technically lossy and you are simply using handbrake to re-encode it to reduce file size.

Um, no offense, but this is quite possibly the most incorrect information posted on the internet.

.mkv or .mp4 have 0% influence on quality. The only difference is the type of streams you can put into them and the type of devices that will play them back.

Also, comparing .h264 to .mkv is like comparing an engine to a completed car. Not only that, but the vast majority of .mkv files contain an .h264 video stream.
 

LoveMachine

Senior member
May 8, 2012
491
3
81
Yep. MP4 and MKV are just containers. Both can hold the same types of information, neither has a significant effect on final file size, nor quality of video/audio. I have tons of 1080p mutichannel DTS-HD MA pgs subtitled MP4s that play on XBMC just as well as MKVs at the same size. If I remember correctly, MP4s don't hold chapter information, but otherwise, they hold the same info that MKVs can. It's just that certain gadgets (Apple, first and foremost) don't support MKVs, my guess being their reputation as files created from not-quite-legal means.
 

mindbomb

Senior member
May 30, 2013
363
0
0
An mp4 file should always be h264 video, stereo aac audio, with the option for text subtitles. I'm not sure if there exists software to mux dts and pgs into an mp4, or why there would be, nor would I expect a player to actually play it. And in a broader sense, why would you put incompatible audio/subs in a container whose sole advantage is compatibility. There would be no point to having the file be an mp4 at that point.
 

LoveMachine

Senior member
May 8, 2012
491
3
81
An mp4 file should always be h264 video, stereo aac audio, with the option for text subtitles. I'm not sure if there exists software to mux dts and pgs into an mp4, or why there would be, nor would I expect a player to actually play it. And in a broader sense, why would you put incompatible audio/subs in a container whose sole advantage is compatibility. There would be no point to having the file be an mp4 at that point.

Because my AppleTV2 doesn't play MKVs. I rip my movies (DVD/BR), convert them using Handbrake to MP4 so that the ATV can see them upstairs for the kids. Down in the ManCave, I can watch the same file, using XBMC, with DTS-HD MA, pgs subtitles, the full shebangabang. I don't get why I'm being told MP4s don't carry anything better than stereo AAC, when in fact my AVR is lighting up with the appropriate codec indicator and I'm hearing lovely 7.1 audio.
 

LoveMachine

Senior member
May 8, 2012
491
3
81
And to clarify, Handbrake allows you to add multiple tracks. The ATV2 preset puts in the first track as stereo aac for compatibility with everything, then adds a second track that, in my case, can be up to 7.1 FLAC that can be played on more advanced devices or HTPC software. So, a question for your question, Mindbomb. Why should I have 2 files for the same movie (MP4 for the ATV2, MKV for the others) when a single properly muxed MP4 can do it all?

And finally, ZOMBIE THREAD...I'd be happy to let this 'un die.
 

mindbomb

Senior member
May 30, 2013
363
0
0
Well, that is a clever solution, but that is a unique problem. In general, you use mkv because it is incredibly flexible. You use mp4 because of it's compatibility. The compatibility benefit is only obtained if you use the prototypical mp4 video,audio, and subs.
 

smitbret

Diamond Member
Jul 27, 2006
3,389
23
81
Well, that is a clever solution, but that is a unique problem. In general, you use mkv because it is incredibly flexible. You use mp4 because of it's compatibility. The compatibility benefit is only obtained if you use the prototypical mp4 video,audio, and subs.

This.

Back when I was ripping for my PS3, I converted my DVD rips to .mp4. It would have a Level 4.1 .h264 with a 2-channel DPLII .aac track for the first audio track and Pass thru the DTS stream as audio track 2. That way it was compatible with just about any device and if I really wanted the DTS track I could take 3 minutes to remux with MKVToolnix or just use a device that would play back the 2nd audio track in .mp4.
 

powerhouse65

Junior Member
Dec 29, 2013
24
0
0
I know I'm not the guy that you specifically asked for but I can answer your question.... kind of.

"Quality" is a subjective thing and is also influenced by things like screen size and distance you sit from the screen. Any time you re encode, you are going to lose some quality, there's no way around it. The smaller you make the file, the lower the quality.

... I can offer suggestions and settings that I use, but basically, it's an art.

I'm using Handbrake (on a Linux rig) to rip/encode DVDs, and occasionally BR. I noticed different settings as to the kind of material I'm encoding - like cartoons, movies, etc. What are your recommendations, also with regard to quality settings?

I'm viewing on a 45" TV, distance ~7-10 feet / 2-3m, using XBMC. So far I've been impressed with BR rips ~4-5GB @1080p.

So, what are your suggestions re 1080p, 720p, and regular DVD rips with HB?

P.S.: Computing power/encoding time is not (yet) an obstacle.
 

smitbret

Diamond Member
Jul 27, 2006
3,389
23
81
I'm using Handbrake (on a Linux rig) to rip/encode DVDs, and occasionally BR. I noticed different settings as to the kind of material I'm encoding - like cartoons, movies, etc. What are your recommendations, also with regard to quality settings?

I'm viewing on a 45" TV, distance ~7-10 feet / 2-3m, using XBMC. So far I've been impressed with BR rips ~4-5GB @1080p.

So, what are your suggestions re 1080p, 720p, and regular DVD rips with HB?

P.S.: Computing power/encoding time is not (yet) an obstacle.

At that seating distance, I wouldn't use 720p unless I had plans to use the same video file with a larger TV in the near future, in which case you may want the added file size for 1080p. 720p will save a lot of space and for most movies it won't affect how much you enjoy it, the perceived difference is not much if it is a good encode.

With Blu-Ray rips, I always set the frame rate as constant with "Same as Source" since I will occasionally run into a device that struggles with Variable Frame Rates

I will either set the RF for 18 or I will do a 2-Pass with Turbo selected and a bitrate of 2200-3000 depending on how busy the images are or how much action is in the film. If I chose 1080p instead of 720p, I will run 5500-6500 depending on source material. That usually gets me a 720p file that is 3.5-5GB and a 1080p that is 6-8GB. I use the Advanced Tabs instead of the simple settings on this screen.

My audio selections will depend on my container, although, lately I have been just doing an Audio #1 of 2-channel .aac with DPLII @ 160kbps and also passing through the highest quality track for Audio #2.

Subtitles and chapters are completely up to you and your personal taste. If I feel like I need to burn forced subtitles into the movie, I actually use RipBot264 instead of Handbrake because it just seems to handle different subtitle formatting better.

Advanced Tab
Ref Frames 4 - There are some devices like the Sony PS3 that won't support more than that
B-Frames 3 - I hate b-frames because if you don't give enough bitrate to the movie they seem to cause blocks and splotched in the dark areas/shadows. I would use less if I could, but I never use more.

Adaptive B-Frames - Automatic
Adaptive Direct Mode - Optimal
Motion Est Method - UMH
Subpixel Motion Est - 10
Trellis - Always

And I pretty much leave everything else alone.

With a mid range CPU like an FX6100 or Phenom II 955 x 4, a 2-pass 1080p will take about 14-20 hours. One pass RF at 18 will take about 8-12.

With simple animation, you could be able to drop the bitrate and save file size if you set it to more reference frames. Some people will encode 8-10 reference frames but that just slows your encode to a crawl for an increase of less than 1% in quality. It really is diminishing returns and after about the 3rd it really narrows quickly.
 

powerhouse65

Junior Member
Dec 29, 2013
24
0
0
@smitbret: 1000 thanks to you - your explanations are perfect, just what I was looking for. I really appreciate it. Your post has been bookmarked.
 

Mazza

Junior Member
Mar 30, 2001
9
0
0
Um, no offense, but this is quite possibly the most incorrect information posted on the internet.

.mkv or .mp4 have 0% influence on quality. The only difference is the type of streams you can put into them and the type of devices that will play them back.

Also, comparing .h264 to .mkv is like comparing an engine to a completed car. Not only that, but the vast majority of .mkv files contain an .h264 video stream.
It's surprising how many people have this misconception. I recently encoded something and put it on HDBits. It just so happened to be in the .mp4 container with x264 and 2.0 AAC. Somebody commented that I should "encode to mkv not mp4".

I had to state the same thing as you to dispel the ignorance.
 

Charlie98

Diamond Member
Nov 6, 2011
6,292
62
91
I will either set the RF for 18 or I will do a 2-Pass with Turbo selected and a bitrate of 2200-3000 depending on how busy the images are or how much action is in the film.

Does 2-pass really make a difference? I've never tried it...