Wednesday, December 21, 2011

From 1080p MKV to 720p MP4

I started with a 13 GB MKV with 1080p h264 video and DTS 5.1 sound. This was far too overwhelming for my current media centre. So I decided to transform and transcode the file into an mp4 with 720p video and stereo AAC audio.

I did this in Ubuntu.

I couldn't simply use avidemux to transcode the video and audio (as I often have done), perhaps because this MKV was not standard enough to be compatible, perhaps because the MKV was so huge, I don't know exactly. So I took a more circuitous route.

First step, tear apart the MKV into its component parts (elementary streams). The odd file extensions are useful to make it clear that these are containerless streams, that really can't be played by (most) video players.

The H264 video first:
mkvextract tracks original.1080p.video.mkv 1:video.h264

Then the DTS audio:
mkvextract tracks original.1080p.video.mkv 2:audio.dts

Second step, put the h264 video into an MP4 container.

mp4creator -create=video.h264 -rate=23.976 -use64bits h264.video.mp4

I found that I needed the -use64bits parameter to get mp4creator to handle the huge file size. The -rate=23.976 was the frame rate of the video, found using VLC.

Third step, use avidemux to crop, resize and transcode the video. As with many "1080p" videos, the width was 1920 but the height was only 880, and a few rows of pixels at the bottom were duplicated. I cropped the sides and the bottom first to get 1554x874, approximately 16:9 aspect ratio (yes, I lost quite a bit on the sides, but I prefer a full screen experience). I got these dimensions by opening a calculator and entering 16 / 9 x 874. The 874 was my post-crop height. I figured out how much to crop from the sides by using (1920 - 1554) / 2, which gave 183, and you can't crop odd numbers, so I cropped 182 off of the left and 184 off of the right. Then I resized using MPlayer resize (to 1280 x 720) and Lanzcos3 resize method.

I encoded with x264, single pass, using a very high quality setting, (quantizer 20). I saved to "video.720.mp4". This produced a 5.3 GB file. The same encoding, set to quantizer 26, produced a more "smeary", more noticeably compressed video, but it still looked reasonably good and it was only 1.4 GB. So you can decide what you prefer.

Waiting for this bit is the longest piece of the puzzle. Whoo. Hours.

Fourth step, I used VLC to transcode the raw DTS to stereo AAC in an mp4 container. I used "Convert/Save" in the File menu, and set the profile to "Audio - AAC (MP4)". I made sure "Video" was unchecked in the "Video codec" tab and in the "Audio codec" tab, I set the Codec to "MP4 Audio (AAC)", the bitrate to 192 kb/s, channels to 2, and sample rate to 48000. I set the output file name to "audio.aac.mp4". I hit the Save and Start buttons and waited. This was short in comparison to the video transcode.

Fifth and final step, I put the video and audio back together using ffmpeg.

ffmpeg -i audio.aac.mp4 -i video.720.mp4 -acodec copy -vcodec copy final.video.mp4

The final video was 5.5 GB in size, quite large, but so beautiful and sharp! You can still see the film grain. This video not only played on my media PC, it also played very nicely on my HP TouchPad.

Labels: , , , , , , ,

Tuesday, April 01, 2008

Vivian's First Easter Egg Hunt

Here's a video of Vivian, at 2.5 years, at her Oma and Opa's house, having her first Easter egg hunt. March 2008.


Labels: , , , , , ,

Tuesday, July 24, 2007

Twinko Twinko Tar

Vivian surprised me tonight by suddenly bursting into song as I changed her diaper. I ran off and got the video camera and I was able to get her to sing a few "verses" of her version of Twinkle, Twinkle, Little Star. Mozart wouldn't recognize the melody, and nobody but a doting father would recognize the lyrics, but, as the aforementioned doting father, I must say that it's an impressive feat for a 21.5 month old child. Still, I'm not going to be entering her on American Idol anytime soon.

Warning: The following video may be overwhelmingly "precious".



Here are a couple of funny "outtakes" from the video that I have to include, because they are funny too:

Labels: , , , , , , , ,

Wednesday, June 06, 2007

That didn't sound like "bye-bye"

Vivian was in the yard last evening when I came home on my bicycle. She ran over and inspected it, and I told her that it was a "bicycle." As she is wont to do these days, she repeated the word quietly to herself.

This morning, as I was getting ready for work, I told Vivian that I was going to work on my bicycle. I picked up my pannier, leaned over her, said "bye-bye!" and kissed her forehead. She looked up at me and said something that made both me and Vivian's mommy gasp involuntarily. It took me a second to realize what Vivian was really saying, and I thought mommy had figured it out too, because she was laughing so hard. But, as I was going out the front gate, I could see Vivian in the front window, pointing at me. Mommy opened the window and said, bewildered, "She's still saying that!"

"It's okay, she's just saying 'bicycle,'" I explained.

A look of great relief came over mommy's face as I turned and headed to work.

What did Vivian sound like she was saying that made us both gasp? I'll let you be the judge. Here's a short video where Vivian says her new word for us all:

Labels: , , , ,

Tuesday, April 03, 2007

Roasting Coffee in a Popcorn Pumper

So I roasted my own coffee on the weekend, using my old Popcorn Pumper air popper, and using the instructions I found on Sweet Maria's.



The bit at the end with me swirling the beans in a metal collander is the cooling process for the beans. It comes after the "before and after pictures" because it was from the second batch I roasted...

I used green beans from JJ Bean, a Proctor Silex Popcorn Pumper, a metal collander, and a glass jar to store the roasted beans. I found that a batch took me around 8 or 9 minutes.

Labels: , , ,