VideoHelp Forum
+ Reply to Thread
Results 1 to 19 of 19
Thread
  1. Member
    Join Date
    Nov 2008
    Location
    Australia
    Search Comp PM
    Hi all,

    I'm determined to learn a bit more on videos and (to what I see) the complicated system of containers and codecs which make up what we watch.

    From my understanding we have different containers, .avi / .mkv / .mov / .mpg etc etc
    We also have different codecs, xvid / divx / h264 etc etc

    What relationship do the containers have on the video though, for instance why would we use .mkv over .avi? Lets say I have a 720p x264 dvd rip in a .mkv file, what would stop me changing it to a .avi file? Doesn't the computer just have to read the codec inside to decode the video information? Why can something like a ps3 read a x264 file inside a .avi but not a x264 file inside a .mkv?

    Sorry if this is pretty basic, but I'm in the newbie section for a reason

    Also is there any limitations on the quality of the video determined by the container? I.e. Is it impossible to get the same quality out of a .avi file as a .mkv file, assuming I'm using the same codec? Codecs are the main determining factor in quality isn't it?

    Thanks folks.
    Quote Quote  
  2. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Think of a mm container as a bucket, and the media streams as the liquid ingredients (oil, water, vinegar, etc). Different containers support different kinds of streams--some allow only audio + video, others allow those plus text, timecode, midi, pictures/graphics, subtitle overlays, etc--and different containers support certain # of those streams--some are 1 stream each, some 2, some more/unlimited. Also, some containers support only specific compatible codecs, while others potentially would allow any available codec. And some containers support only specific features to streams and their codecs, while others support much more--this includes things like AR flag and B-frames in video and multichannels and ultrahigh samplerates in audio. Lastly, some containers are older and have difficulty with streams that exceed 1, 2 or 4GB, whereas other containers have NO reasonable size limitation.

    I could go into it further, but it would be long, and it would probably behoove you to do a little research anyway. If you do, and get stuck further only, we can always clarify certain things...

    Readers/Players and set-top support are an additional matter, that's why sticking to STANDARDS is a good thing.

    Scott
    Quote Quote  
  3. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Containers, examples:
    1. Bucket
    2. Bucket with holes

    Contents (videos), examples:
    1. Large rocks
    2. Water

    Large rocks clearly go in both containers.
    Water can only be supported by one of the two containers.

    Not all containers can hold all formats.

    The only time "quality" is affected is by means of poor decompression (hindered by the container), with various artifacts as the result (freezing, choppy, etc).
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  4. Most containers are designed to be extensible. So, in theory, they support any type of stream or codec. The problem mostly stems around whether a container is actively supported by some standards setting body with enough clout to get everyone else to follow the standard.

    AVI, for example, is an instantiation of the RIFF standard. RIFF was designed to be extensible. But since AVI was abandoned by Microsoft there really isn't anyone around to define new extensions -- at least nobody big enough to make their extensions a standard that everybody else follows. And Microsoft's VFW library (used by many programs to access AVI files and no longer actively developed my MS) wouldn't know what to do with the new chunks. Divx (the company) has recently been defining extensions to the AVI format to support chapters, subtitles, and menus but it is probably too little, too late. They are moving on to MKV with their new h.264 encoder.

    There is also the issue of whether the standards setting bodies care to support certain features/codecs. For example, AC3 audio was only recently added to the MP4 container spec.
    Quote Quote  
  5. Member yoda313's Avatar
    Join Date
    Jun 2004
    Location
    The Animus
    Search Comp PM
    Originally Posted by peleus
    Codecs are the main determining factor in quality isn't it?
    Well this has been touched on by both lordsmurf and cornucopia. However to add a little more to the discussion BITRATE is another major factor in quality. The higher the bitrate the better the video will look (in general - of course this assumes a quality source was used in the conversion).

    A subset of this is that certain codecs look better at a given bitrate than others. Codec A will look better at x bitrate in container 1 than it will at the same bitrate and codec in container 2. Sometimes there are exceptions to this and some can look identical in different containers.

    Hope this helps a little.
    Donatello - The Shredder? Michelangelo - Maybe all that hardware is for making coleslaw?
    Quote Quote  
  6. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Some codecs are also self-sustaining, no container needed, such as MPEG-1 or MPEG-2.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  7. Member
    Join Date
    Jan 2007
    Location
    Republic of Texas
    Search Comp PM
    Peleus, you asked a good question that often needs to be addressed by people visiting this site. Many people have encountered frustrating issues, especially with the very broadly applied .avi container. I love the bucket analogy, and in the case of the avi "bucket," the substance contained in it can be varied like sand, rocks, water, oil, etc., in the forms of DV, RAW, Uncompressed RGB, Uncompressed YUV, Divx, Xvid, and so on. Many people purchasing editing and encoding applications that claim to handle AVI get frustrated because they find they are using the wrong type of AVI.

    Many people come here inquiring which is the best codec. A straight answer can never be given because sometimes you need sand, sometimes you need water, sometimes you need rocks, and sometimes you need oil. In the case of codec selection, some are better for editing, some are better for good visual quality with low storage space requirements, and some are better for broad distribution in a commonly used format. The "best" will depend ultimately on end use.

    In a perfect world, codecs would be more universal. But technology changes and applications vary. It gets difficult to keep up with everything.

    Thanks for bringing up this topic.
    Quote Quote  
  8. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Originally Posted by lordsmurf
    Some codecs are also self-sustaining, no container needed, such as MPEG-1 or MPEG-2.
    If you're referring to .M2V and .MP3 etc. you're technically right, but most times, the MPEG video and audio codec/streams are encapsulated in a MPEG1 System stream/MPEG2 Program stream/DVD Vob/MPEG2 Transport stream/MPEG4 FlexMux File. (Just wanted to make sure the newbies understood that, I'm sure you already know this Lordsmurf).

    Yeah, there's a lot of things to learn in this area. I used the "bucket" analogy to good use this last year while I was teaching at the Digital Arts School. You've got to come up with some analogy for people to be able to grasp all the technical permutations otherwise they'd really be overwhelmed. I also used a zipper/ropestrand analogy when dealing with muxing/demuxing.

    Scott
    Quote Quote  
  9. The main issue with MPEG PS container is that it isn't meant to to be flexible or extensible. It's for holding MPEG audio and video with a fixed range of properties. So it is inextricably linked to MPEG audio and video.
    Quote Quote  
  10. Member
    Join Date
    Nov 2008
    Location
    Australia
    Search Comp PM
    Guys thank you very much for your responses and outlines of my question. Much appreciated.

    I think I can understand now that some containers suit particular codec's better, and while in some cases there is a wide range of codec's to choose from, there are better tool's than others.

    I guess what you mean by "needing rocks or water" would be finding out what aim you have for your video.

    I.e. If you're after decient quality but low storage requirements look for codecs such as Xvid or DivX, who have reasonable quality but low storage capacity? If you're after better quality and storage isn't as much of an issue go for H264 or huffy or something?

    I'm guessing you can go down from h264 to divx or something to save space, I'm assuming there would be no point going from divx to h264 though (can't make quality out of air)?

    I'm keen to read up on what "tool" each codec is good for, especially looking at audio codec's as well, any particular guides out there you'd recommend for a newbie?
    Quote Quote  
  11. Banned
    Join Date
    Oct 2004
    Location
    Freedonia
    Search Comp PM
    Peleus - While it's good that you want to learn, some of your assumptions are not right. I think you're taking lordsmurf's analogy far too seriously.

    MPEG-2 was the successor video codec to MPEG-1. MPEG-2 could offer better compression and some other features missing in MPEG-1. Divx improved on MPEG-2 and could offer similar quality at a lower bit rate than MPEG-2 used. I am just making up these numbers, but for example, if an MPEG-2 video was encoded at 4000 Kbps, you could probably get similar quality from Divx at around 2000 Kbps. H.264 was even better and could offer equal quality at even lower bit rates. So H.264 offers the best quality at the lowest bit rate and has the smallest file sizes.

    As far as containers go, the only ones you should concern yourself with as a newbie are AVI and MKV. Don't worry about the MP4 container, which is inferior to MKV. MKV is the most flexible in terms of what it will hold for audio and video so that's why it's used. AVI is much more restrictive in terms of what it will hold. As to why the PS3 wants AVI and not MKV, just blame Sony for that. MKV requires a little more processing power and I guess they didn't want to deal with it.
    Quote Quote  
  12. Member
    Join Date
    Nov 2008
    Location
    Australia
    Search Comp PM
    Ok, thank you.

    Firstly I completely understand how "frustrating" it can be dealing with newbies, who don't understand the basics / mis-interpret things that are said, so thank you for taking the time to educate me.

    I think I saw my analogy that way because of the typical way you see (or I see) files, 4.7gb 720p rips in mkv files h264, and 700mb dvd rips in divx. From what you've just described though it seems as though h264 is superior in picture and quality for the same or lower bit rates. If that is the case, why would anyone ever use anything else?

    Is it purely for compatibility? Obviously DivX has wider support in DVD players etc at the moment. I'm just trying to find examples / situations where and why one codec would be better than another. Same goes for containers I image linking back to my original question, but I have a sneaking suspicion if I have the codec question answered it will make the container choice reasoning a lot clearer.

    Thanks again everyone for your help.
    Quote Quote  
  13. The more pixels per frame and the more frames per second there are in a video the more bitrate it takes to maintain quality. So a 1280x720 video (typical 4 GB h.264) requires much more bitrate than a 576x432 video (typical 700 MB Divx).

    Few set-top players support MKV or h.264. This is why Divx/Xvid in AVI has been preferred by the p2p community. Also h.264 takes much longer to encode and more CPU power to decode.
    Quote Quote  
  14. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Here's the thing about MKV...while it's a well thought out container format, it was designed by (for lack of a better term) semi-pro video hobbyists with good computer skills.
    There is no corporate backing, so no hardware standards/support. It might be ok as an interim (particularly for BT downloads, hehe), but you can only play it on compatible HTPC's--no settops, gaming systems, ipods, etc.
    In my book, that makes it much less desireable. I want something that is portable so I can show friends/relatives/clients.

    Scott
    Quote Quote  
  15. As an example of end-use driving the equation, while MKV may be technically better than MP4, I have two stand-alone devices that can handle h264 codec, but both require mp4 and will not play MKV whatsoever. Technically superior does not mean much if I can't see the video.

    As for why h264 is not as common as some others, encode one and you will be able to answer that question sometime the next day, or the day after that on a slower machine.

    H264 is often used on very hi quality source material, which somewhat skews your perception of the resulting file size.
    Quote Quote  
  16. Member
    Join Date
    Nov 2008
    Location
    Australia
    Search Comp PM
    So really in an ideal world we would probably use h264 and mkv for everything... if compatibility and computing power weren't issues.

    Because we don't live in that world, we typically only see h264 used for better quality sources (or niche area's in P2P) which is why my perception was skewed towards "it gives a much better picture" when really I was just seeing the good examples of it.

    Same thing with DivX and .avi, the main reason its around is because its great for chucking in a DVD player and getting it to work.

    To me that says that if time isn't an issue, and I want to back up DVD's of my own, I am most likely best off using .mkv and h264 if I only want to watch back through my computer?

    Thanks folks.
    Quote Quote  
  17. Member yoda313's Avatar
    Join Date
    Jun 2004
    Location
    The Animus
    Search Comp PM
    Originally Posted by peleus
    typical way you see (or I see) files, 4.7gb 720p rips in mkv files h264, and 700mb dvd rips in divx
    Well there are two things there - the 4.7gb tells you it is destined to be burnt to dvd. The 700mb is intended for cdr.

    The 720p is a high def conversion targeting dvd burners. This is because dvd burners are much more common than bluray at the moment. The 700mb is for cdr and that trends back to when cdr was more common than dvdr.

    Regarding mkv as a technically superiror format that may be true. However as is mentioned it is not as widely supported as divx or mp4. Mp4 can be handled by quite a bit like ipod, psp, zune, and other portable players. The trick with mp4 becomes which flavor you use. The aformentioned players don't talk to each other and have their own needs. Even the Zune that can take mp4 ends up having to reencode it to wmv upon synching to the zune. But I guess my point is mp4 has a little more support than mkv. (in general of course - these are grand sweeping statements - there are exceptions to every rule).

    Basically your choice of codec for compression comes down to a few choices:

    1 - playback destination
    2 - file size needs
    3 - specialty needs (like subtitles, chapters, menus, etc)

    1 - for PLAYBACK DESTINATION you need to choose how you will watch the compressed video. If you intend to burn to a cdr or dvdr for playback on a settop dvd player that would lend itself to divx/xvid (some can do wmv and mp4 generic but support is sporadic and VERY VERY PICKY). Even divx/xvid needs to meet certain criteria for dvd players before they can work well. Also portable players like ipod, archos, zune, psp, etc all have variations that need different focuses. And lastly if you only need to play it on your pc than pretty much any codec will work since a pc has the most flexibility in playing codecs.

    2 - File Size needs - BITRATE is the key determinant in file size for video files (and audio files as well but thats a seperate topic). As already mentioned certain formats handle low bitrate better than others. The lower the bitrate the smaller the filesize as a rule. Something like realvideo for webplayback may look decent enough on a small window in a browser but is not ideal for fullscreen playback of a feature length film. As you step up into the next target quality improves but necessarily filesize increases. Again if its a pc destination filesize usually isn't a concern but fixed size playback devices like a ipod/zune etc.. can only hold so much video and music before its full. So you have to balance file size and video quality with the codec you use.

    3 - specialty needs - Subtitle support I believe is the most widely supported subset of compressed video. As far as I know basically any compressed video format can handle subtitles. (I can't gaurantee it of course but that is a good assumption). However things like menus and chapters are a much more specific and limited subset of compressed video. I believe DIVX ULTRA is the only beast that will do both menus and chapters. There may be newer incarnations of mp4 and mkv that do this but I don't know anything about that. Also there would be almost no standalone support yet for newer functions like that. However you can pick up Divx Ultra certified dvd players that will function with menus and chapters. Again a pc would be able to mimick just about anything you need so its not as restrictive but if you don't have it configured as a htpc it might not be as practical to watch a 2 hour movie in your computer room as it is in the family room.

    So these are my takes on the dos and don'ts of compressed video. Of course these are somewhat generallized and there are always exceptions to the rules and updates I may not know about. But if you follow these outlines for your compression needs you will be saving time and effort and some frustation.

    Plus there are two more important factors to follow when converting video:

    1 - ALWAYS use the original video source whenever possible. DON'T recompress already compressed video. This is a no-no here. The extra time saved and space saved from going to divx to mp4 might seem like a good idea at the time but the results won't be as good as going from the original source straight to the mp4 format you need. (again your personal tastes may not notice any serious loss in quality but the "experts" all agree one conversion is much better than multiple conversions).

    2 - Always use good quality blank media. If your burning to cdr or dvdr or even bluray use quality rated blank discs. Also if you notice a video is freezing at the end of the movie try encoding to less than full capacity. Some are susceptible to bad edges and not filling up a disc will avoid the edges entirely.

    Hope this helps. Others here can elaborate on my albeit still novice level understanding of digital video. But this should give you a real world example to follow and some insights into why we do certain things here.
    Donatello - The Shredder? Michelangelo - Maybe all that hardware is for making coleslaw?
    Quote Quote  
  18. Member
    Join Date
    Jan 2007
    Location
    Republic of Texas
    Search Comp PM
    Another issue that helps determine format selection is end use. While h264 is coming of age as a great playback format, it is highly compressed and does not lend itself well to editing...as of yet.

    If your source material is DVD, and you simply want to make smaller-sized backups that look comparable to the eye, a good divx/xvid encode (1500 - 1800 kbps) will take much less time to make and will be compatible with more players than h264 -- right now, anyway.

    The "best" for one person might be the "worst" for another, depending on the individual's end application. That is why there is no single distinctive answer we can give you. And your "ideal world" codecs look absolutely nothing like mine.
    Quote Quote  
  19. Originally Posted by Cornucopia
    Here's the thing about MKV...while it's a well thought out container format, it was designed by (for lack of a better term) semi-pro video hobbyists with good computer skills.
    There is no corporate backing, so no hardware standards/support. It might be ok as an interim (particularly for BT downloads, hehe), but you can only play it on compatible HTPC's--no settops, gaming systems, ipods, etc.
    In my book, that makes it much less desireable. I want something that is portable so I can show friends/relatives/clients.

    Scott
    Well FWIW there is the WD player out now that seems to play MKV ok. I epect it to get better once a updated firmware is released.

    However for the $99 I paid on sale for it I'm happy. I have to USB drives plugged into it. Small easily portable, HDMI HD output, matched with a laptop type External drive or flash drive it is portable enough.

    It has a few needs to be fixed items such as playing a mpeg2 file when you stop fast forwarding it jumps ahead instead of the more desirable jump back a couple of seconds. This makes it harder to rewatch a segment.

    Right now no .divx support, renaming it .avi and it plays fine.
    It has played test mkv, wmv and .mp4 files from youtube and has spotty DVD ISo playing.(no menu etc.) I have great hopes that a firmware release will fix the gaps in its performance.

    Cheers
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!