VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. Member
    Join Date
    Feb 2009
    Location
    Germany
    Search Comp PM
    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
    Quote Quote  
  2. If your source images are 704x280 with 1200x600 dpi, the correct display aspect ratio is about 1.26:1.
    Quote Quote  
  3. Member
    Join Date
    Feb 2009
    Location
    Germany
    Search Comp PM
    Sure, but I want to make mencoder to get the aspect ratio from the image size, regardless the resolution.. Any ideas?
    Quote Quote  
  4. 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.
    Quote Quote  
  5. Member
    Join Date
    Feb 2009
    Location
    Germany
    Search Comp PM
    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
    Quote Quote  
  6. 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.
    Quote Quote  
  7. Member
    Join Date
    Feb 2009
    Location
    Germany
    Search Comp PM
    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
    Quote Quote  
  8. 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.
    Quote Quote  
  9. 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
    Quote Quote  
  10. Member
    Join Date
    Feb 2009
    Location
    Germany
    Search Comp PM
    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
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!