Click to See Complete Forum and Search --> : Incorrect aspect ratio in Quicktime SMIL file for H.264 encoded movie
arosendaal
03-10-2009, 10:52 AM
Hi,
I use the following metafiles to play quicktime files from our video server:
SMILtext
<smil xmlns:qt="http://www.apple.com/quicktime/resources/smilextensions" qt:time-slider="true" qt:chapter-mode="all" qt:autoplay="true">
<body>
<seq>
<video src = "rtsp://qtvideo.service.rug.nl/sample.mov" qt:immediate-instantiation="true" qt:chapter="Untitled"/>
</seq>
</body>
</smil>
The metafiles are saved as .mov or .qtl files.
[note: this sample does not point to an existing movie on the server]
When I created a similar metafile for an H.264 encoded movie, it displayed at the wrong aspect ration. When the URL of the movie was entered directly in the QT payer, the Movie Inspector indicated a size of 720 x 406 pixels (roughly 1.77 : 1). When the metafile as opened, the indicated format size was 320 x 240 pixels (4 : 3) and the image was distorted.
What can I do within the SMIL file to display the movie in the correct aspect ratio?
Thanks,
André
Eye for Video
03-10-2009, 04:25 PM
Not exactly sure if this will work but the QuickTime attribute that controls the aspect ratio is "scale".
SCALE is either TOFIT, ASPECT or a number. By default the value of SCALE is 1. If set to TOFIT, the movie is scaled to fit the embedded box as specified by the HEIGHT and WIDTH attributes. If this is set to ASPECT, the movie will scale to fit the embedded box while maintaining the aspect ratio. If this is set with a number, the movie will be scaled by that number (e.g. 1.5). Note: Using the number scale attribute with a QTVR Panorama movie can degrade the performance of the movie even on high-end systemsfrom
http://www.apple.com/quicktime/tutorials/embed2.html
So try adding
qt:scale="aspect"
after the autoplay... perhaps it will recognize the correct aspect ratio(16:9).
Good luck,
EfV
arosendaal
03-10-2009, 05:23 PM
EfV,
Thanks, I tried your suggestion but it didn't work. There is no reference to qt:scale in the Apple documentation at http://developer.apple.com/DOCUMENTATION/quicktime/IQ_InteractiveMovies/quicktimeandsmil/chapter_10_section_7.html either, so it may not be an existing attribute....
Eye for Video
03-10-2009, 06:43 PM
Dang, sorry to hear that. But the video does play at the correct aspect ratio when opened directly in a QuickTime player? So the translation to the SMIL file is the problem?
Here's a few more details from
http://developer.apple.com/DOCUMENTATION/quicktime/IQ_InteractiveMovies/quicktimeandsmil/chapter_10_section_8.html#//apple_ref/doc/uid/TP40000883-CH213-BBCJJACC
kMovieMediaRegionAtom
kMovieMediaFitMeet
The media is proportionally scaled so that it is entirely visible in the track box and fills the largest area possible without changing the aspect ratio.
I don't see any dimensions in your <layout> area so is the video just taking the default size of the player w/wo controls?
Best wishes,
EfV
arosendaal
03-11-2009, 05:47 AM
Your suggestion will take me some time, as I have no idea how I should use an atom in a smil file :(. I'll try and find that out...
Yes, the file does scale correctly when opened directly in Quicktime. I have not added dimensions in the smil file, because it is actually generated by a tool I wrote, the Virtual Cutter (http://video.surfnet.nl/virtualcutter/select_file.php?lang=en), that allows creating clips from streaming files. Thus, I do not know the dimensions beforehand (not sure if I can use javascript to get it from the embedded player).
Actually, just before sending this replay, I tried adding a layout to the smil file:
<head>
<layout>
<root-layout id="slideshow" width="720" height="406" background-color="black"/>
<region id="r1" width="100%" height="100%" fit="meet" />
</layout>
</head>
Copied from the Apple documentation. This works! As I explained, I now have to find out how to retrieve the actual dimensions from the source file after it is opened in the Virtual Cutter. I could not find a javascript function to do that.... and I stilll think QT should be able to play the file in the correct ratio, no matter what size I define.
Cheers,
Andre