Blu-Ray Containers, Video/Audio Codecs, and Subtitles

In the previous couple of posts, I described some short techniques to accomplishing a simple media server using your legally purchased Blu-Ray and DVD movies. If you are anything like me, you will most likely start getting confused when you look at MakeMKV and Handbrakes more advanced features such as which video/audio codecs to use. You may even run into some crazy streaming playback anomalies regarding TrueHD 7.1 and PGS subtitles like I did. Well, I do not have all the answers for you, but I can at least give you a little bit of information and allow you to take solace in the fact that someone else out there is experiencing similar problems!

Please note that these lists of containers and codecs is not comprehensive. I have chosen commonly found files and formats for convenience and brevity.

Media Container Formats

A lot of people get confused about the differences between all the slang, acronyms, terminologies, and file formats that get tossed around on forums and blogs. Trust me, I know that it can be confusing when someone says something like, “Oh, it’s easy, just create a .mkv, and encode the video with x.264 and the audio in AC-3.” If you have no prior knowledge of these terms, you will be more than a little bit confused.

The bottom line is that there are four common components to movie media files: containers, video tracks, audio tracks, and subtitle tracks. Containers do exactly what you would guess: they contain the rest of the content. When you see a .avi file, that’s a movie file using the AVI container format. It contains video tracks, audio tracks, and possibly subtitle tracks.

See the following for a comparison between different containers:

  • .m2ts – Non-open format commonly found in Blu-Ray discs and AVHCD. You’ll find this format when you rip a Blu-Ray using straight Blu-Ray copy software like DVDFab. This format supports menus that are commonly found on Blu-Ray discs.
  • .mkv – Open source, widely supported container that can support an unlimited amount of any video, audio, and subtitle tracks.
  • .avi – Microsoft developed container developed in the early 90s with too many limitations to list here. There is no reason to use this container over .mkv.
  • .mp4 – Widely supported container based on the MPEG-4 standard with similar capabilities as .mkv. There are some limitations as to which video and audio codecs it will accept, but most of the more common codecs are supported.

My recommendation for most movies that you rip: MKV

Video Codecs

Contained within a file, video codecs determine the quality and other attributes of a video track. For the most part, you are going to run into H.264 and VC-1 when dealing with Blu-Rays and MPEG-2 when dealing with DVDs.

See the following for a comparison between different video codecs:

  • H.264 – The most commonly used high definition video compression codec used in Blu-Rays (players must support H.264), YouTube, iTunes, Flash Player, Silverlight, and various media broadcasts. You really cannot go wrong by choosing this codec as your video compression choice. It fits nicely into the MKV container.
  • VC-1 – Microsoft proprietary compression codec used only in Blu-Rays, Windows Media kit, Silverlight, Slingbox, and HD-DVD. Try to avoid this codec.
  • MPEG-2 – Widely used and supported lossy codec found in DVDs and digital television/satellite broadcasts. When ripping high definition content, do not use this codec.

If you are dead set on keeping the movies you rip in the original format, then you will have to deal with all three of the above codecs. If you want to match all your movies to a single video codec, then the simple choice is H.264.

Audio Codecs

This is where things get a little confusing even for the more technically inclined of consumers. I think the confusion is expanded simply because the companies behind these audio formats are intentionally obtuse when defining and describing their latest and greatest inventions. Names like “TrueHD” certainly do not help in identifying what exactly the format provides. In addition, many consumers simply do not have the equipment required to take advantage of many of the higher end high definition audio formats. This can include limitations related to channel availability and whether or not the consumer has a receiver or sound card capable of decoding proprietary high definition audio formats.

There are a lot of different audio formats and I cannot possibly describe every detail of every format, so I will just provide a basic overview of each with any caveats that I have learned through the use of each.

See the following for a comparison between different audio formats:

  • Dolby Digital / DD / AC-3 – Lossy audio compression commonly found in DVDs and Blu-Rays. In Blu-Rays, this track is usually an alternate to the lossless track for consumers without the equipment required to decode and output certain lossless audio formats. This format has a 5.1 maximum channel limit.
  • AAC – As an improvement over MP3 formats, this lossy ISO standard for audio compression is supported in nearly all consumer devices. Some examples of supported devices are cell phones, handheld game systems, game consoles, and various MP3 players.
  • DTS – As a direct competitor to Dolby formats, this lossy audio compression is commonly found in DVDs and Blu-Rays. In Blu-Rays, this format is usually an alternate to lossless formats on the same disc for consumers without the equipment required to decode and output certain lossless audio formats. This format supports 5.1 channels and in some cases 7.1.
  • DTS-HD – Lossless audio format found in HD-DVD and Blu-Rays. This format has a 8 maximum channel limit.
  • Dolby TrueHD – Lossless audio format found in HD-DVD and Blu-Rays. This format has a 8 maximum channel limit. I have personally been unable to get this audio format to play 100% properly when streamed through PS3 Media Server. For some reason, the front channel audio will jump to the back channels randomly during playback. I have not had had the time to investigate further, so let me know if you find anything relating to this in your journey.
  • Linear PCM – Lossless audio format commonly found in CDs and certain DVDs when higher quality music is required for fidelity. Your PS3 has direct support for PCM formatted audio and will perform transcoding of TrueHD and DTS-HD audio into PCM in order to feed the data via HDMI. The quality should be identical since all three are lossless formats.

Making a straight up recommendation for audio is a tough choice and is especially true with Blu-Rays. For DVDs, I usually stick with the supplied AC-3 5.1 audio track. With Blu-Rays, I either attempt to rip the 5.1 DTS-HD or the 5.1 Dolby TrueHD audio track. If I run into problems with audio when streaming, I usually just transcode the audio to 5.1 AC-3. I cannot tell any audible difference between a lot of the formats, so as long as the audio takes advantage of my surround sound without sounding like absolute crap, I am good to go.

Subtitle Formats

Like audio formats, there are a ton of subtitle formats that I cannot cover in detail. However, be aware that subtitles can exist in a text or image based format. Blu-Rays will most commonly contain image based subtitles that are currently unsupported in PS3 Media Server and quite difficult to convert to a text based format. There is a convoluted process of extracting the image based subtitles and converting them to a format that is readable by an optical character reader (OCR) software package. Using OCR software, you can convert image to text, but do not expect to have perfect results.

Some common terminology that you will encounter when learning about subtitles is “forced” and “burned”. Forced subtitles are what you see when foreign languages are presented in the movie. For example, Kill Bill has many Japanese parts that have forced English subtitles. If you only want to see subtitles during these parts, then make sure to rip and use the forced subtitle track of the language of your choice. Burned subtitles are permanently encoded into the video track and cannot be removed by simple extracting the subtitle track. One good example of this is Inglourious Basterds. Because the subtitles are such an integral part of that movie (the clever use of mixing languages adds to the fun of the film), you will notice that the video track contains the subtitles as burned in. One benefit to this approach is that you will not need to require the media server to stream the subtitle tracks. However, on the other hand, you cannot remove the subtitles from the video.