Hello,
I use mencoder to generate a video file from a set ot jpeg images. Image dimensions are 704x280, but the resolution is 1200x600 dpi... The generated avi has frame width 704 and frame height 280...
The problem is that whenever I play this video in a player it visualizes with aspect ratio 2 (1200x600) but should be 704x280.
I pass the following parameters to mencoder:
mencoder "mf://*.jpg" -mf type=jpg:fps=1 -o output.avi -ovc lavc -lavcopts vcodec=mpeg4 -nosound
Thanks in advance
+ Reply to Thread
Results 1 to 10 of 10
-
-
If your source images are 704x280 with 1200x600 dpi, the correct display aspect ratio is about 1.26:1.
-
Sure, but I want to make mencoder to get the aspect ratio from the image size, regardless the resolution.. Any ideas?
-
Just set the MPEG4 PAR or DAR. "-aspect 5:4". If mencoder won't let you do that use Mpeg4Modifier on the output AVI file.
-
Excuse me for the silly question, but what is PAR or DAR? My problem is more complicated, than I actually described it... I am extracting the images from a database and I don't really know what is their width, height and resolution... So my question should be something like that:
I want to make mencoder to get the aspect ratio from the image size (whatever it is), regardless the resolution...
Thanks in advance -
MPEG4 has settings for Pixel Aspect Ratio (PAR, the relative width/height of individual pixels) and Display Aspect Ratio (DAR, the relative width/height of the final displayed image). These are related to the Storage Aspect Ratio (SAR, the frame size of the digital video) thus:
DAR = SAR * PAR
I've never used it, but from what I've read, mencoder lets you set the DAR (the final shape of the picture) using the -aspect argument.
I'm not sure I understand your problem. Are you saying you don't know what the resolution of your source JPG images will be before hand? That they will vary from run to run? Doesn't mencoder just assume square pixels and encode with the same frame size as the source by default? What are you playing the resulting files with? Maybe your player is just set to "stretch to fit" rather than display at 1x and source DAR. -
Thanks for the explanation. I am writing an application, which extracts blobs from a database and saves them in a directory. After that I use mencoder to create an output avi file from the set of images. The width, height and resolution might be different at runtime. I play resulting files with BSPlayer and Windows Media Player and the movie appears to be widescreen, although the size of the images are for example 704x280 px with 1200x600 resolution. Perhaps it would be better to see a sample of some images and generated video yourself. You could downlad one from here http://prophex.com/tmp/images+video.rar
Thanks again -
Mencoder took the 704x280 JPG images and created a 704x280 video with square pixels (it ignored the pixel aspect ratio in the JPG files). As far as I can tell, mencoder doesn't have a pixel aspect ratio setting. If it did you could just set it to 0.5.
You can set the PAR after making the AVI with Mpeg4Modifier. Windows' quartz.dll doesn't pay attention to the PAR flags but Xvid, Divx, ffdshow, MPC, VLC, etc. do. Here's a sample where I set the PAR to 1:2
par.avi
Or you can resize the frame to the correct square pixel display aspect ratio before encoding. If you detect the JPG images are 1200x600 dpi then the pixels are half as wide as they are tall. So double the image height or halve the image with. A 704x280 source would become 704x560 or 352x280. I don't know if mencoder has this ability. -
Most programs will ignore the par values in the pictures. Even just viewing them (.e.g windows picture viewer, ifranview, snagit etc....) I only know of photoshop that has the option to view with the par value correction.
Will your source pictures always be that format? or will they be variable dimensions and pixel resolutions? You can scale an exact numerical dimension in mencoder, but I don't know if you can use an input variable (e.g. 2xheight as jagabo suggested)
-vf scale=w:h -
No - picture's width, height and resolution will vary. I didn't want to pass the aspect ratio parameter to mencoder at runtime, because this will cost one more query to the database for getting the dimensions.
I could not use Mpeg4Modifier for it is not a console application. Anyway - thanks for all your help, guys
Similar Threads
-
MPEG Streamclip MPEG-TS to MPEG4/H264 (file size & aspect ratio query)
By Heathy65 in forum Video ConversionReplies: 5Last Post: 4th Apr 2012, 11:31 -
How do I change the aspect ratio in an MPEG file without........
By Canon GL-2 Guy in forum Newbie / General discussionsReplies: 13Last Post: 27th Oct 2011, 16:24 -
How can I change the aspect ratio of an MPEG-2 video into 2.35:1?
By ryanfever in forum Authoring (DVD)Replies: 21Last Post: 29th Mar 2011, 14:10 -
FLV to mpeg - what pixel aspect ratio?
By gsh in forum Video ConversionReplies: 9Last Post: 8th Apr 2009, 08:19 -
How to fix MPEG encoded with wrong aspect ratio?
By Talayero in forum Video ConversionReplies: 2Last Post: 21st Oct 2008, 09:29