The best container to use (.AVI or .MP4)

HandBrake for Windows support
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
stew23
Posts: 6
Joined: Tue Jul 21, 2009 4:04 pm

The best container to use (.AVI or .MP4)

Post by stew23 »

Hey guys. First post here. Thanks for all the help & knowledge I've gained from reading up on the discussions so far. Basically, I have settled (and am very happy with) the Universal preset. I convert the DVDs @ 59% & also have Detelecine & Decomb selected. I don't have all that much knowledge @ all on this kinda stuff, but the quality & file size using those settings seem good.

Since I'm planning on converting many DVDs using the x264 codec, I'm wondering which container to use: AVI or MP4. I notice most people here (in the best presets topic) opt for MP4 over AVI, but I'm not sure why. I've been using AVI so far since I've noticed that that is by far the most popular container used when people upload DVD rips to bittorrent & the like. I've heard that MP4 supports chapters or something? Is that why everyone here uses MP4? I don't care for splitting my movies or TV episodes into "chapters" bnut does MP4 have other advantages? Does x264 (the codec I'm using) not play well under the AVI format? Should AVI only really be used when using the XviD or DivX codecs? Sorry for the silly questions!

For the record, I plan to watch these files on my PC computer (using VLC or the like) and also through XBMC (via streaming from my PC) on a big TV screen.

Also, can anyone shed some light on why I am getting a LARGER output file size rip (using the EXACT same settings) when my source file is compressed (DVD-5 DVD or ripped to a VIDEO_TS folder), compared to getting a SMALLER output file when my source is an original commercial dual layer DVD-9 or ripped to a VIDEO_TS folder. Am I making sense?

Thanks in advance.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: The best container to use (.AVI or .MP4)

Post by rhester »

MP4 can do a lot of things AVI can't, including (but not limited to):

- variable frame rate (AVI can kinda-sorta fake this)
- multiple audio tracks/languages
- embedded soft subtitles (without the need for external .srt files)
- anamorphic video (AVI can also do this, but not all players can grok it)

In short, AVI is a painfully outdated "container" that should be taken out back and shot. :)

H.264-in-AVI is problematic at best. I've read reports it can be made to work, though I have no idea why you'd want to.

In regards to the larger rips from smaller sources, if you're using constant quality (it sounds like you are), it all comes down to the apparent complexity of the source. "Shrunken" DVD9->DVD5 disks introduce quite a bit of sometimes-not-very-visible digital "noise" in the process of having their quality downsampled, which actually requires more bitrate to reproduce accurately when transcoding to H.264. In the world of transcoding, the "cleaner" the source, the better - and odds are the DVD9 original will be cleaner than the downsampled copy.

Rodney
stew23
Posts: 6
Joined: Tue Jul 21, 2009 4:04 pm

Re: The best container to use (.AVI or .MP4)

Post by stew23 »

Thank you so much rhester... you've really helped me out with some answers!
rhester wrote: In short, AVI is a painfully outdated "container" that should be taken out back and shot. :)
Haha okay. Wonder why all the big torrent release groups are still using AVIs then?
rhester wrote:H.264-in-AVI is problematic at best. I've read reports it can be made to work, though I have no idea why you'd want to.
It's not that I wanted to as such, I guess I just thought AVI would be more compatible, and match most of my other video files I have (90% of them are AVI).

Now you've mentioned that it can be problematic, I won't be using x264 with AVI any longer. Maybe I should have left the "Universal" codec & container settings as they were :roll:
rhester wrote:"Shrunken" DVD9->DVD5 disks introduce quite a bit of sometimes-not-very-visible digital "noise" in the process of having their quality downsampled, which actually requires more bitrate to reproduce accurately when transcoding to H.264. In the world of transcoding, the "cleaner" the source, the better - and odds are the DVD9 original will be cleaner than the downsampled copy.
That makes complete sense now you explain it. I definitely won't be "shrinking" my DVDs before I start ripping them to file anymore. You've really managed to explain it in a way I understand it... much appreciated.

One silly question... would I be better off ripping my DVD (with no "shrinking") to my HDD before I start the Handbrake process? Or is it okay to rip the files directly from disk?

One more sillier question... I've decided to use the x264 codec. Shall I use the M4V/MP4 or the MKV container? I just wanna get this right! :D (and is there *ANY* difference between M4V & MP4?) Thanks in advance.
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: The best container to use (.AVI or .MP4)

Post by TedJ »

stew23 wrote:One silly question... would I be better off ripping my DVD (with no "shrinking") to my HDD before I start the Handbrake process? Or is it okay to rip the files directly from disk?
Taking into consideration that the Windows GUI is unable to read encrypted DVDs without the aid of an on-the-fly decrypter such as DVD43 or AnyDVD, I would tend to pre-rip to HDD. This also has the advantage that you can queue up several titles to encode overnight or while you're at work.
One more sillier question... I've decided to use the x264 codec. Shall I use the M4V/MP4 or the MKV container? I just wanna get this right! :D (and is there *ANY* difference between M4V & MP4?) Thanks in advance.
The choice between MKV and MP4 really depends on your playback equipment - MP4 tends to be better supported by hardware players (Apple TV, PS3), while MKV is only supported by a few players (PCH A-110 and the WDTV come to mind).
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: The best container to use (.AVI or .MP4)

Post by rhester »

stew23 wrote:is there *ANY* difference between M4V & MP4?
From our standpoint? Only the characters in the filename extension. :)

Apple playback devices, in particular, disable certain functionality (chapters, multiple audio track support, et al) if the extension is not .m4v (which is particularly ironic given that most other tools consider .m4v to be video only with no audio or other streams). We just go with what works in an effort to achieve widest compatibility (most other players really don't care what the extension is, they use "magic" bytes to identify the container) to try to make sure that HandBrake in general "just works".

Rodney
peter_h
Posts: 17
Joined: Thu Jul 23, 2009 11:40 pm

Re: The best container to use (.AVI or .MP4)

Post by peter_h »

I change all .AVI files I receive to .MP4 anyway. Why?

Well this tip may only be applicable to Windows users...

I store extra information in the Comments field of the file (found under Properties>Summary tab) - such as the initials of the people who have watched it (great for tracking what episode you're up to watching), ratings, and who I'd recommend this for (flatmates and family members).

Putting this info in Comments is great because it travels with the file, and is not in some external player application's database. It can also be viewed in a standard Explorer details view.

Or using Xplorer2, as I do, comments are even simpler to use - press ALT-Z to add a comment to the selected file(s).

Now I don't know why, but you can't store comments in .AVI files, but you can in .MP4 files. And since my player, VLC, plays back .AVI files that have been renamed to .MP4, it works brilliantly for me.

Note that comments are stored in an ADS (Alternative Data Stream) of the file, so you'll have to always use NTFS-formatted drives to maintain them.
Olórin
Posts: 1
Joined: Mon Aug 03, 2009 12:07 pm

Re: The best container to use (.AVI or .MP4)

Post by Olórin »

I too am in the same boat that I am converting many DVDs over to video files to be played on my PC. After experimenting and reading much on this forum I can narrowed it down to MP4 or MKV for the container and x264 for the codec. I have question about the audio codec though. My options for MP4 are AAC or AC3. I can only get MP4 and AAC to play in quicktime. It will play in VLC, Zoom, WMPC and PowerDVD but does not play in the DIvX player (jerky and crashes) or WMP. If I encode it using AC3 the only thing that plays it is VLC. I know Quicktime has to be AAC but WMP, WMPC Zoom and PowerDVD play the video but know Audio (which is probably related to the software expecting AAC?). Here is my CLI configuration for MP4.

Code: Select all

 -i "D:\DaVinci_Code" -t 1 -c 1 -o "D:\Movies\DaVinci_Code-1-1-1 decomb.mp4" -f mp4 --decomb  -p  -e x264 -b 3000 -2  -T  -a 1 -E faac -B 160 -R 0 -6 dpl2 -D 1 -F  --markers="e:\tmp\DaVinci_Code-1-chapters.csv" -x ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:b-pyramid=1:me=umh:subq=9:analyse=all:8x8dct=1:trellis=1:no-fast-pskip=1:psy-rd=1,1 -v 
If I encode it for MKV I can use AC3, AAC, MP3 or Vorbis as my audio codec. From what I have read AAC or AC3 are better technologies (although I have not read much about Vorbis). If I encode with MKV/AAC I can play the file in VLC, Zoom, WMPC, WMP and DivX player but not Quicktime or PowerDVD (which apparently PowerDVD will never play MKV file). If I encode MKV with AC3 It will play in DivX and VLX. I can not get anything to play in Quicktime or PwerDVD adn playback in Zoom, WMP and WMPC are choppy with Zomm only playing Audio. CLI for this is

Code: Select all

 -i "D:\DaVinci_Code" -t 1 -c 1 -o "D:\Movies\DaVinci_Code-1-1-1 decomb AC3.mkv" -f mkv --decomb  -p  -e x264 -b 3000 -2  -T  -a 1 -E ac3 -B 160 -R 0 -6 dpl2 -D 1 -F  --markers="e:\tmp\DaVinci_Code-1-chapters.csv" -x ref=3:mixed-refs=1:bframes=6:weightb=1:direct=auto:b-pyramid=1:me=umh:subq=9:analyse=all:8x8dct=1:trellis=1:no-fast-pskip=1:psy-rd=1,1 -v 
I am not submitting this necessarily to get some sort of resolution to these issues as much as soem background and information on Audio codecs. From what I gather this is no "one all" format that works in 90% of the players. Since my focus is on the PC (I will convert for other applications when needed) I am more curious about the audio codec. I get my greatest versatility with MKV/AAC and second is MP4/AAC. However if AC3 is a better option then I can live with less players. However, AAC might be a better option.

Just an FYI, and why I am posting this in this topic, I was using AVI and x264. I had pretty good results but occasionally, as a move played, the audio and video would get out of sync. I have not had that problem with MP4 or MKV.

Thanks for your time,

- Olórin
stew23
Posts: 6
Joined: Tue Jul 21, 2009 4:04 pm

Re: The best container to use (.AVI or .MP4)

Post by stew23 »

Cheers Rodney for clarifying a few more things.

I can see now everyone's reason for opting for the newer H.264 codec (and .MP4 extension) over XviD/AVI.

But here's my major issue... I wish to play these files on my modded XBox (running XBMC). The files using the settings I have setup (which do play awesomely on my PC, and I am happy with) will not render correctly on my XBMC. The frames are skipping all the time unless it's a really non-action scene. This means that anything encoded in the x264 setting is essentially unplayable. The way I understand it is that the H.264 codec - although a small enough file size - requires twice as much processing power than say an XviD file at similar settings which the first generation XBox cannot handle too well.. I've found detailed guides on the net on how to encode to H.264 for XBMC on XBox compatibility, but it's really too complex for me to work out, and even then my files are still skipping frames. In this scenario would my only real option be to bite the bullet and just XviD/AVI the damn DVDs? At least I know they will play perfectly on the first generation XBox lol. Or am I simply encoding my DVDs at too high a H.264 bitrate? (using Universal)

Anyone's advice on this would be great. Thanks in advance.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: The best container to use (.AVI or .MP4)

Post by rhester »

Gen 1 is pretty weak, but there's nothing preventing you from putting MPEG-4 (a la XviD/ffmpeg) into a MP4 container, and I would imagine the device would grok that fine. H.264 is much more efficient but much more power-hungry than the older MPEG-4 standard, no doubt.

You can experiment with lowering the bitrate and/or CQ value for H.264 encodes, but I imagine you'll rapidly hit a point of diminishing returns where the only thing that plays decently looks like crap. MPEG-4 is almost certainly a better codec for use on a legacy system like that.

Rodney
stew23
Posts: 6
Joined: Tue Jul 21, 2009 4:04 pm

Re: The best container to use (.AVI or .MP4)

Post by stew23 »

Thanks for the prompt reply!

So would I be correct in assuming that there isn't really an 'encode to H.264 for XBox using Handbrake' guide or preset doing the rounds simply because it's a poor idea? And like you said, because by the time you do get it to play flawlessly, the quality (bitrate) will be extremely low?

I think encoding my DVDs using ffmpeg/XviD (MP4 container) might be the best option then. I wasn't sure anyone here was using the MP4 container for anything other than H.264 though. But I guess in my case it's probably a good solution. Cheers for the tip.

I've just stumbled upon a little issue though... I downloaded the most recent SVN version of Handbrake only to see that it has removed all options for XviD & the AVI container (but ffmpeg is there). Never mind I thought, and I simply reinstalled 0.9.3. But weird, the XviD codec option didn't return. Should I just use ffmpeg (under the MP4 container)? Or is XviD a better option? And how is it even technically possible that a complete uninstall and fresh install of 0.9.2 (or 0.9.3.) won't give me the options I had upon the initial installation a while back? Strange...

Thanks.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: The best container to use (.AVI or .MP4)

Post by rhester »

I don't know why you don't see XviD with reinstall of 0.9.3, but it should be there. XviD and AVI are definitely deprecated in 0.9.4/SVN and beyond - the former because it's too difficult to keep integrated and the latter because it's just an abortion of a container and doesn't support most of HandBrake's current features.

ffmpeg's MPEG-4 support is unfortunately not as good as XviD's quality-wise, but we had to cut our losses somewhere, and H.264 is definitely the way into the future anyway. Time for an Xbox upgrade to a 360, perhaps? =)

Rodney
stew23
Posts: 6
Joined: Tue Jul 21, 2009 4:04 pm

Re: The best container to use (.AVI or .MP4)

Post by stew23 »

Ah okay, thanx. I'll have to figure out a way of getting the XviD/AVI option back myself If I want it then... something certainly went weird with the install!

I've seen the quality from a H.264 rip myself... I ripped many movies & TV episodes to the format and can't argue with you there. You can definitely include me as a fan. An XBox upgrade to 360 hey? :P I wish it were that easy. Unfortunately XBox 360s are not able to be modded and have the amazing XBMC software ran on them (blame Micro$oft). If it were possible, then I wouldn't be in this situation, as the processing power of the 360 would have no issues playing H.264 (and XBMC itself is clearly a supporter of H.264). I also think the native unmodded XBox 360 software/OS/dash/player (whatever you call it) can only play the dreaded WMV format (could be wrong?). It's really all just another case of progress being held up. For what it's worth I'm not even a gamer; the XBox was bought second hand recently for the sole purpose of acting as a media centre.

Rodney you've been fantastic with all your knowledge, so I hate to keep asking silly questions! But... (this goes out to everyone else) I ripped an entire season of 30 Rock (720 x 576) using FFmpeg (to MP4) and settled on a bitrate of 2000 (I couldn't work out the slider bar option... the percentages seem to have a different unit of measurement than the x264 options. Is it correct to say that encoding @ 59% using H.264 is not the equivalent of encoding @ 59% FFmpeg? My slider settings were spitting out weird bit rates to the point where I settled on 2000. Does that seem like an okay compromise? (My files turned out just over 300MB).

Also, is it correct to assume that a DVD resolution of @ 720x304 will not need as high a bitrate than that of a 720x576 DVD due to the fact it's technically close to half it's size?

One more thing... since I will probably sadly end up having to encode to XviD or FFmpeg (and if I'm not worried about having any more than one audio track or subtitles) are there any real advantages of using the MP4 container? Because I'm always sharing my files with people who "play their DivX files" in their "DivX compatible" DVD player (it's the big thing around here! [Australia]). Will the fact I am now using the MP4 container (as opposed to AVI) prevent these files from being played in these DVD players? I'm guessing so, rite?

Thanks a million for all this help!!!
User avatar
s55
HandBrake Team
Posts: 10350
Joined: Sun Dec 24, 2006 1:05 pm

Re: The best container to use (.AVI or .MP4)

Post by s55 »

You can't install old versions over new versions. The installer will only overwrite if it has newer files. You need to completely remove the old version.
rhester
Veteran User
Posts: 2888
Joined: Tue Apr 18, 2006 10:24 pm

Re: The best container to use (.AVI or .MP4)

Post by rhester »

stew23 wrote:I ripped an entire season of 30 Rock (720 x 576) using FFmpeg (to MP4) and settled on a bitrate of 2000 (I couldn't work out the slider bar option... the percentages seem to have a different unit of measurement than the x264 options. Is it correct to say that encoding @ 59% using H.264 is not the equivalent of encoding @ 59% FFmpeg? My slider settings were spitting out weird bit rates to the point where I settled on 2000. Does that seem like an okay compromise? (My files turned out just over 300MB).
The percentages are definitely different between the two codecs. 2000kb/s is adequate for ffmpeg - not great, but adequate. I might have opted for 2500kb/s, but it's a question of what looks good to you.
stew23 wrote:Also, is it correct to assume that a DVD resolution of @ 720x304 will not need as high a bitrate than that of a 720x576 DVD due to the fact it's technically close to half it's size?
Correct, bitrate to achieve a certain visual quality is very much a function of resolution (technically macroblocks, but functionally the same thing).
stew23 wrote:One more thing... since I will probably sadly end up having to encode to XviD or FFmpeg (and if I'm not worried about having any more than one audio track or subtitles) are there any real advantages of using the MP4 container? Because I'm always sharing my files with people who "play their DivX files" in their "DivX compatible" DVD player (it's the big thing around here! [Australia]). Will the fact I am now using the MP4 container (as opposed to AVI) prevent these files from being played in these DVD players? I'm guessing so, rite?
"It depends". :) One big advantage of MP4 containers is that they can deal with variable frame rates - so if you rip mixed film and video NTSC content (where some of the content is hard-telecined from 23.976 progressive and some is 29.97 interlaced in the same title), MP4 containers really shine. If you're doing straight PAL and not doing anything fancy, AVI should be pretty much as good as MP4. I don't know whether the players you're referring to support MP4 containers or not (some do, some don't - easiest way to find out is to try, because sometimes functionality like this gets "snuck in" in firmware updates without being documented), but bear in mind HandBrake *will not* support AVI in the next release...so if the players won't grok MP4 containers, you're going to need to keep 0.9.3 around one way or another.

Rodney
stew23
Posts: 6
Joined: Tue Jul 21, 2009 4:04 pm

Re: The best container to use (.AVI or .MP4)

Post by stew23 »

Thanks once again for your expertise Rodney :D

s55 — Yeah true, it's probably not the ideal thing to do. But even when I uninstalled Handbrake (to reinstall an older version), it wouldn't fix my issue. As it turns out the uninstaller did not actually "uninstall" as I thought it would; I had to manually delete the folder from Program Files (and maybe Docs & Settings... can't remember). But I got my XviD codec back lol.

Okay, 2500 might be a better encode then. I'd rather get the best possible quality. But when I said the height was 576 pixels, I probably should have said 400, as that's what Handbrake gives me after the automatic cropping (Interesting though, that AutoGK gives me a vertical resolution of 416).

You're going to think I'm a bit of a pest, but having scoured the net for information and bitrate calculators, I am still yet to find a graph or tool which will tell me the best bitrate to use for an XviD encode for any given particular resolution. I see there are many apps that claim to "calculate" bitrates & stuff for you, but I have no interest in down-sampling & cramming my rip onto one CD (or splitting it to the size of exactly 2 CDs) the way "the scene" does... to me that just seems ridiculous, and I'm not sure who still burns their movies to CD. Surely every movie should be encoded based on it's own properties, right? (which you basically said in your previous post Rodney. Feel free to tell me otherwise though!) Check this out... I am looking for a graph like that for encoding to XviD.

The reason I'm asking about that (and plan to use the Average Bitrate option instead), is because I'm confused to the max with the XviD (and FFmpeg) Constant Quality slider option (the slider seems to work way better using H.264). For a 3 minute & 11 seconds chapter of a TV episode (output resolution is 720 x 404), here are the bitrates it has given me - using XviD: (please don't shoot me for using XviD either :P)
  • 87%, 88%, 89% and 90% all give me a file size of 32.8MB @ a bitrate of 1133 kbps
  • 91%, 92% and 93% all give me a file size of 46.2MB @ a bitrate of 1663 kbps
  • 94%, 95% and 96% all give me a file size of 78.9MB @ a bitrate of 2962 kbps
  • 97%, 98%, 99% and 100% all give me a file size of 312MB @ a bitrate of 12,247 kbps
It seems there is no middle ground there! Why do 3 or 4 different percentage values give me the same setting? Are there only a certain amount of "levels" or something? The difference between 93% and 94% is almost doubling the bitrate! Or is it this way simply because Handbrake doesn't worry too much about the older codecs to give more settings?

I read somewhere else here that if you insist on encoding to MPEG-4, then you are probably better off not using Handbrake at all? If that's true, then it's a shame, because it's the easiest program to navigate.

Very interesting Rodney about the firmware possibly sneaking in MP4, etc. Rodney... guess I'll have to try and see :) And I can see that the variable frame rate is a lot smarter also.

Any further help / advice / information on anything I've mentioned would be greatly appreciated. Cheers.
spurssimon
Posts: 1
Joined: Wed Sep 09, 2009 11:37 pm

Re: The best container to use (.AVI or .MP4)

Post by spurssimon »

ive been trying to convert mkvs x264 into a mp4s so my xbox 360 will read them and i cant even get the 360 to see mp4 files so if you did could you tell me how cheers converted using handbrake ubuntu 9.04
Post Reply