Cast for two

Showing posts with label mpeg-4. Show all posts
Showing posts with label mpeg-4. Show all posts

Saturday, October 06, 2007

Convert muxed MPEG-1 to MOV or MPEG-4

A lot of Sony digital picture camera's also capture video. Some store the captured video files into muxed MPEG-1 files and have extension .MPG. To check if your Sony camera does this, proceed as follows. Open up the "Window" menu in Quicktime and select "Show Filminfo". It reports the structure of the file as "MPEG1 Muxed, 640x480 pixels" (other sizes are possible). Those files can be played back by Quicktime but when exporting to another videoformat or saving as mov, the audio does not come along. Importing such files into Imovie '08 or Final Cut Pro 2 also do not work propely. (Read iMovie does not work with muxed MPEG-1 and MPEG-2 clips about that and written by Apple).

To get rid of those pesky muxed mpeg-1 files, I now describe a procedure that does not need recoding of the captured original file. Instead, it allows to losslessly transforms the muxed mpeg-1 file into a Quicktime mov file without any convertion loss nor lengthy encodings. You only need one freeware tool that you can download from Apple's side.

To get rid of the muxed MPEG-1 files you need MPEG Streamclip. (MPEG Streamclip for windows). I tested this with a movie file captured by a Sony Cybershot DSC-W1. First, I started MPEG Streamclip:

Next, I dragged the MPEG movie movXXXXX.mpg to the application (XXXXX is the number of your movie, in the test case it is mov01249.mpg):

Then, select from the File menu, "Demux to M2V and AIFF":

Specify where the two new files must be saved and click Save.
Now, double click on the new movXXXXX.m2v file to open up Quicktime Pro. If you now export the movie or save as mov, the audio will be in it. This is because if movXXXXX.aiff is in the same directory as where movXXXXX.m2v is stored, Quicktime Pro will automatically load the video with extension .m2v and the audio file with extension .aiff together. (as explained by Heny Kautz). You can now save as a movXXXXX.mov file for editing or export to another format (for exmple MPEG-4). This is the resulting file in MPEG-4 format mov01249.mp4. You can download that file, play it with Quicktime and try to import it into Imovie '08 or Final Cut Pro 2. It should work. Succes.

Wednesday, October 03, 2007

Make mp4 files faststart with MP4box

The beta Flash player 9 , allows for playback of mp4 files containing AVC video and AAC audio. The example worked but the entire file was first downloaded before playback started. This is because the so called moov atom, is not in front of the file. To fix this on Mac OSX, I first downloaded MP4box (for OSX/PPC). Then, I issued the command: mp4box -inter 500 test.mp4 and uploaded the test.mp4 file. Now, the demo is faststart!

To make sure, I made no errors, I made a second example that is indeed not fast start. The I issued the mp4box command:

The resulting file benefiet_inter.mp4 is included in a third demo that is fast start: Third Test of mp4 in Flash version 9

This is the info you get from mp4box -info:


l02958:~/Desktop ln$ ../../../Applications/MP4Box -info benefiet_inter.mp4
* Movie Info *
Timescale 600 - Duration 00:03:35.006
Fragmented File no - 2 track(s)
File Brand mp42 - version 1
Created: GMT Wed Oct 3 17:55:44 2007

File has no MPEG4 IOD/OD

Track # 1 Info - TrackID 1 - TimeScale 600 - Duration 00:03:34.920
Media Info: Language "English" - Type "vide" - Sub Type "avc1" - 5373 samples
MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
AVC/H264 Video - Visual Size 384 x 224 - Profile Main @ Level 1.3
NAL Unit length bits: 32
Self-synchronized

Track # 2 Info - TrackID 2 - TimeScale 32000 - Duration 00:03:35.008
Media Info: Language "English" - Type "soun" - Sub Type "mp4a" - 6719 samples
MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
MPEG-4 Audio AAC LC - 1 Channel(s) - SampleRate 32000
Synchronized on stream 1

It would be nice that somehow I could figure out where the moov atom is with mp4box. But that's for another post.

Saturday, September 29, 2007

HD videocamera's that record on Flash cards

It looks that in the near future MPEG-4 AVC video will be possible along the three main steps of a web video production flow : 1) capturing, 2) editing and 3) presenting on the web.

  1. In the coming months, a lot of new consumer and prosumer camera's will be released on the market, aiming at the Christmas shopping window, that capture H264 video in HD resolutions (720 lines or more). Interesting is that some record straight to non-volatile flash memory. This allows for smaller camera's that can be made cheaper, more low power, smaller and more robust because of less moving parts. Flash cards become affordable. For example a 4 GB class 6 SDHC card can be bought for around 50 euro. An 8GB card with the same speed cost less then 100 euro. Another big advantage is that they can be mounted as an extra drive to the computer for editing. This completely nullifies the time ingest take with tapes.
  2. Also editing software get ready for MPEG-4 AVC: Imovie 08, Final Cut Pro 2 and Adobe Premiere CS3 support it.
  3. Adobe's upcoming release "moviestar" allows for playback of MPEG-4 AVC/AAC in the browser with hardware acceleration using Flash 9. (Earlier post about this news)
With the advent of MPEG-4 AVC/AAC camera's, editors and ubiquitous web playback, it's time to explore a new innovative workflow optimized for video on the web. Let's start with a look to the camera's:
  • Hercules Webcam Dualpix HD
  • Price: 49,95 euro, available in Fnac
  • Format: 1280x960p30
  • Website from manufacturer
  • Remark: altough this camera allows for 1280x960p30, in practice limited bandwith, disk or processor speed may be require to lower the video size. The HD stands for Hercules DualPix and NOT for High Definition. Don't fall in marketing trick (like I did).
  • De Aiptek GO-HD 720p
  • Sample1
  • Price: $299
  • Format: 1280x720p30
  • Sensortype: 1x 5MP CMOS, size unknown ?
  • Video Codec: MPEG-4 Part 10 AVC/H.264
  • Audio Codec: AAC, Stereo, 48,000 kHz
  • Capture bitrate: +/- 4Mbits/second
  • Container format: Quicktime Mov
  • Kodak Easyshare Z1275
  • Price: 230 euro
  • Specifications from manufacturer
  • Sensortype: 1/1.72 in. CCD
  • Format: 1280x720p30 , 30 frames per second
  • Video codec: MPEG-4 Part 2
  • Audio codec: μ-Law 2:1, Mono, 16,000 kHz
  • Container format: Quicktime Mov
  • Capture bitrate: +/- 8Mbits/second
  • Available: september 2007
  • Sanyo's Xacti DMX-HD700
  • Price: $609
  • Sensortype: 1/2.5 inch, 7.38-megapixel, CCD
  • Format: 1280x720p30 MPEG-4 AVC/H.264 video, 30 frames per second
  • Bitrate: [HD-SHQ] 1280 x 720 (30fps, 9Mbps), [HD-HR] 1280 x 720 (30fps, 6Mbps), [TV-SHQ] 640 x 480 (30fps, 3Mbps ), [TV-HQ] 640 x 480 (30fps, 2Mbps ), [Web-SHQ] 320 x 240 (30fps)
  • Available: end of October 2007
  • Mac OS compatible
  • Sanyo Xacti HD1000
  • Price: $800
  • Format: 60 fields/s for 1080i or 60 frames/s for 720p 12Mbps or lower modes.
  • Sensortype: 4MP 1/2.5" CMOS (!) sensor
  • Video codec: MPEG-4 Part 10 AVC/H.264
  • Audio codec: AAC, Stereo (L R), 48,000 kHz
  • Bitrate: +/- 12Mbps for 1080x720p60
  • Containter format: MPEG-4 system file with .mp4 extension
  • Available: november 2007
  • Sanyo Belgium
  • Panasonic HDC-SD5
  • Price: $900
  • Format: 50 fields for 1920x1080i50, HG: 1.920 x 1.080, HN/HE: 1.440 x 1.080
  • Sensortype: 1/6 inch 3xCCD-beeldsensor
  • Format: 1920x1080
  • Video codec: MPEG-4 Part 10 AVC/H.264 (compatibel with AVCHD-standard)
  • Audio codec: Dolby Digital (Dolby AC3)/ 2-channel
  • Bitrate: HG: ca. 13 Mbps (CBR), HN: ca. 9 Mbps (VBR), HE: ca. 6 Mbps (VBR)
  • Available now
  • Sony HDR-CX7
  • Price: $1200
  • Format: 1920x1080i60, AVCHD, 1280x720p60???
  • Sensortype: 1/2.9 inch ClearVid CMOS
  • Video codec: MPEG-4 Part 10 AVC/H.264 (compatibel with AVCHD-standard)
  • Audio codec: Dolby® Digital 5.1
  • Bitrate: HD XP (15Mbps), HD HQ (9Mbps), HD SP (7Mbps), HD LP (5 Mbps), SD HQ (9Mbps), SD SP (6Mbps), SD LP (3Mbps)
  • can record 3 seconds at 240 frames per second
  • Remark: USB on dock only
  • Available: september 2007
What camera would you buy ?

Technical remark: some camera's deliver a .mp4 file and others deliver AVCHD
. In AVCHD, the compressed audio and video data are encapsulated in a MPEG-2 Transport stream, called BDAV. In that case, the essense (the video and the audio stream) are MPEG-4 but they are encapsulated as payload into a MPEG-2 stream. Some editors/tool handle mp4 files but barf on AVCHD MPEG-2 streams. Conversion from a AVCHD file to a mpeg-4 file is possible but adds another step to the video productionflow.

Friday, August 31, 2007

Embedding MP4 in HTML with Flash 9 beta Moviestar

From Jeroen Wijering I found a way to play MP4 movies in a webpage using the new Flash Version 9 beta, nicknamed Moviestar. It uses SWFObject to embed a Flash file using Javascript and the mediaplayer by Jeroen.
This is the code:


<script type="text/javascript" src="swfobject.js"></script>


<p id="player1">

<a href="http://www.macromedia.com/go/getflashplayer">

Get the Flash Player</a> to see this player.

</p>


<script type="text/javascript">

var s1 = new SWFObject("mediaplayer.swf","single","384","224","7");

s1.addParam("allowfullscreen","true");

s1.addVariable("file","test.mp4");

s1.addVariable("image","preview.jpg");

s1.addVariable("overstretch","none");

s1.addVariable("smoothing","false");

s1.write("player1");

</script>

In the same directory above code is residing, store swfobject.js,test.mp4,preview.jpg and mediaplayer.swf.
The result looks like this:

I don't understand yet when clicking on fullscreen, the video does not resize but that's probably an option of mediaplayer I have to enable. Also, I have the impression the movie is first downloaded before playback starts. I am quite sure the header atoms in test.mp4 are in front of the file. So the movie should faststart. Here is an example where it does work. Any suggestions welcome in the comment.

UPDATE:
leaving out the overstrech variable so that is get the default true value, stretches the movie to fullscreen in fullscreen mode. No problem now with the fast start. So the code becomes:

<script type="text/javascript" src="swfobject.js"></script>


<p id="player1">

<a href="http://www.macromedia.com/go/getflashplayer">

Get the Flash Player</a> to see this player.

</p>


<script type="text/javascript">

var s1 = new SWFObject("mediaplayer.swf","single","384","224","7");

s1.addParam("allowfullscreen","true");

s1.addVariable("file","test.mp4");

s1.addVariable("image","preview.jpg");

s1.write("player1");

</script>

Thursday, August 30, 2007

Drupal + Flex : Adobe becoming good netizen ?

Benevolent dictator of Drupal, Dries Buytaert, announced that he has tipped his tows into Adobe Flex technology. A bit surprising given Drupal's open source approach. It looks like Adobe is tipping their tows into open source because they contributed to Drupal as well. Adobe also announced and released their beta Flash player nicknamed moviestar that supports advanced MPEG-4 audio and video (the systems part (.mp4 files), the High Efficiency AAC and Advanced Video Coding AVC Part 10 to be more precisely). Meaning that within a year more then 90 percent of the browsers will be able to play video content based on a open standard. Something only Quicktime could do. The Quicktime player is ok but the implementation on Windows was always beyond standards with regards to performance. Maybe Adobe's move will force Apple to improve their Windows implementation. Fullscreen functionality that came with version 7.2 is already a step into the good direction. May the best win!

I've made a small test to embed a MPEG-4 file but no succes. The file is loaded but does not play with the beta player installed. For your reference, this is the code I used:


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"

codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0"

id="fullscreen" align="middle" height="224" width="384">

<param name="allowFullScreen" value="true">
<param name="movie" value="test.mp4">

<param name="bgcolor" value="#333333">

<embed src="test.mp4" allowfullscreen="true"

bgcolor="#333333" name="fullscreen" type="application/x-shockwave-flash"

pluginspage="http://www.macromedia.com/go/getflashplayer"

align="middle" height="224" width="384">

</object>

The file test.mp4 is in the same directory as the html page. Maybe the mime type is not ok ?