Forced Attention

Stone statues salute silently while lookers at and passers by cheer.
Gusty gales cause commotion to the dismay of those most near.
Resulting rumbles snap onlookers from a trance when statutes fall.
Frustration forces former followers to point, sneer, and jeer. Up! Get tall!
While considered nothing down below, they are even less when left in tow.
Read more

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: http://en.wikipedia.org/wiki/Comparison_of_container_formats.

  • .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: http://en.wikipedia.org/wiki/Comparison_of_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.
Read more

Ripping Blu-Rays and DVDs to a Media Server

Hardware needed:

  • PC
  • BD-ROM / DVD-ROM
  • Large Hard Drive (mine is 2 TB)

Software needed:

Media is increasingly migrating towards streaming-only distribution. Discs, even BD/HD-DVD formats, have rather low limits on the amount of data that can be stored on each. These low limits and the increasing availability of high-speed and high-bandwidth internet connections are just two reasons that consumers have begun to rely on streaming digital content including movies, music, videos, and pictures. The convenience of streaming services like Netflix and Hulu allow consumers to avoid commercials and watch what they want and when they want. Products like DVR and TiVo are only band-aids on top of the real problem: cable companies disallowing customers to choose their own content at convenient times.

Just think about what you have to do in order to watch your DVDs and Blu-Rays. I have Blu-Rays in my possession that literally take 5 minutes just to load the main menu. This problem is magnified by useless services like BD-Live that require internet connectivity in order to load content like chat rooms and trailers that users may never even use. For users like me, I want to be able to access my content immediately and in the format of my choosing. The current implementation of HD media inconveniences consumers by disallowing various viewing options and restricting Blu-Rays to only existing on the original disc. In fact, the legality of copying  Blu-Rays for personal use even when creating simple backups is questionable because of the insane policies of the MPAA and the legislative pockets that they influence.

Unless you’re sharing and distributing your backups, I sincerely doubt any authority is going to care. The MPAA and other organizations that rely on Blu-Ray sales isn’t losing a single penny if you backup your physical media. You’ve already legally purchased the disc and are simply transferring the contents to a device of your choosing. Continue at your own discretion and follow these steps. Keep in mind that MakeMKV is not going to perform any transcoding of your content. The original video/audio codecs will be left untouched and will simply be transferred to a .mkv container.

  1. Download and install MakeMKV from the link above.
  2. Download and install Handbrake from the link above. (optional)
  3. Download and install VLC Player from the link above. (optional)
  4. Start up MakeMKV.
  5. Insert the DVD or Blu-Ray of your choice into your BD-ROM/DVD-ROM drive.
  6. Wait for MakeMKV to scan the disc and then click the big Disc –> HDD icon.
  7. Wait for MakeMKV to scan for titles, video, audio, and subtitles.
  8. Check and uncheck the desired contents to be included in the final .mkv output file. (I will write another post about specifics on video/audio codecs and subtitles.)
  9. Change the output path in the right panel and click the button to the right of the output path.
  10. Wait for MakeMKV to complete the process and transfer the final output to the shared folder of your media server.
Read more

Creating a Media Server using PS3 Media Server and a PS3

Hardware needed:

  • PC
  • PS3
  • TV
  • Switch
  • Receiver (optional)

Software needed:

Ideally your setup will look something like: PC (media server) –> Switch –> PS3 –> Receiver (optional) –> TV. The advantages of including a receiver between the PS3 and the TV include better speakers and the ability to decode some of the newer proprietary audio codecs such as DTS-HD and TrueHD (more on that in a different post.)

Follow these steps:

  1. Use the link above to obtain and install PS3 Media Server on the PC you’re using as your media server.
  2. Turn on your PS3.
  3. Start up PS3 Media Server and wait for it to scan the network for available renderers. When it’s done, you should see your PS3 in the “Detected media renderers” section. You can confirm connections or view any errors in the “Traces” tab.
  4. Under the “Navigation/Share Settings” tab, add any folders you want to share with your media renderers under the “Shared folders” section.
  5. On the PS3 menu, go to the appropriate section that you want to stream under (Pictures, Music, or Video), find the PS3 Media Server, and navigate to the content you want to stream.
  6. When you start streaming, PS3 Media Server will display information about what it is currently streaming, the buffer status, and the bitrate under the “Status” tab.

Quite honestly, this is all that needed to be done to get content streaming properly to my TV. In a separate post, I’ll talk about some of the more advanced options of PS3 Media Server, transcoding, video/audio codecs, subtitles, ripping Blu-Rays/DVDs, and lessons learned for the best streaming performance.… Read more

Solving a Simple ODE with Simulink

If you have just started learning Simulink, one of the easiest tasks is solving a simple ordinary differential equation. In fact, most of the beginning guides you will find through web searches will probably be similar to the example I am going to provide. Let’s start by assuming you have the following common spring-damper system. For reference, m is mass, c is the damper coefficient, k is the spring coefficient, x is the position, x-prime is the velocity, x-double-prime is the acceleration, and f(t) is a step-input function with a magnitude of 3.

p1formula

We begin first by solving for the second derivative of x. In this case, it ends up solving to:

p1formula_s

Now, it is time to place this into Simulink using the following blocks:

  • 2 integrator blocks
  • 3 gain blocks
  • 1 sum block
  • 1 step input block
  • 1 scope output block

Step 1) Connect two integrator blocks together to simulate a double integration as seen below:
step1

Step 2) Add the appropriate gain blocks to simulate c*x’ and kx.
step2

Step 3) Add the sum block to simulate f(t) – cx’ – kx.
step3

Step 4) Add the gain block after the summation to simulate the multiplication of (1 / m) and the step input function as the third input to the sum block added in Step 3. Make sure the step input function has the properties of Step Time = 0, Initial Value = 0, Final Value = 3.
step4

Step 5) Add the scope block for output after the second integration to view the plotted contents of the numerical solution.
step5

Using the following values for variables and initial conditions, you should see the plotted results as follows:
x(0)=0, x’(0)=0, x”(0)=0, m=0.25, c=0.5, k=1
resultsRead more

Generating Pseudo Random Numbers in MATLAB

I wrote the code found in this post in the Student Version of MATLAB R2009a (7.8.0.347) on Windows Vista SP2.

This function will return a vector of size i containing randomly generated numbers uniformly distributed between 0 and 1.… Read more