LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-29-2007, 02:54 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
how does pixel aspect relate to frame size in mplayer/how do you find vid frame size?


I have a video (lots of videos, actually) that does not have square pixels.

if I "ffmpeg -i vid" it shows:
Code:
  Duration: 00:00:06.0, start: 0.000000, bitrate: 9594 kb/s
  Stream #0.0(eng): Video: mpeg4, yuv420p, 640x486, 24.00 fps(r)
  Stream #0.1(eng): Data: rtp  / 0x20707472
if I "tcprobe -i vid" it shows:
Code:
import frame size: -g 720x480 [720x576] (*)
     aspect ratio: 4:3 (*)
       frame rate: -f 29.970 [25.000] frc=4 (*)
if I "mplayer -identify vid" it shows:
Code:
VIDEO:  [mp4v]  640x486  24bpp  24.000 fps    0.0 kbps ( 0.0 kbyte/s)
ID_FILENAME=/path/vid.mp4
ID_DEMUXER=mov
ID_VIDEO_FORMAT=mp4v
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=640
ID_VIDEO_HEIGHT=486
ID_VIDEO_FPS=24.000
ID_VIDEO_ASPECT=0.0000
ID_LENGTH=6.04
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
ID_VIDEO_CODEC=ffodivx
Audio: no sound
Starting playback...
VDec: vo config request - 640 x 486 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.32:1 - prescaling to correct movie aspect.
ID_VIDEO_ASPECT=1.3169
VO: [xv] 640x486 => 640x486 Planar YV12
V:   1.2  29/ 29  8%  1%  0.0% 0 0
... but if I play the file with mplayer & screen grab, I see the window (not including title bar or border) is about 767x486.

How do I find the actual size of what should be played back without doing a screen grab?

Last edited by BrianK; 10-29-2007 at 02:55 PM. Reason: update title
 
Old 10-31-2007, 01:41 AM   #2
Freemor
Member
 
Registered: Aug 2005
Location: New Brunswick
Distribution: Trisquel
Posts: 70
Blog Entries: 8

Rep: Reputation: 15
the size that mplayer reports is the actual size (pixels) of the video. this however is not necessarily the size it will play it at (for various reasons)

I think I should clear up some of the terminology

Aspect Ratio is the relative size of the W/H that the video should be.. a standard monitor has an aspect ratio of 4:3 (so does regular TV). This means for every 4 units across there will be three units down. The tricky bit with Aspect ration is the "units" can be anything pixels, inches, cm, etc.. (this is one of the reasons mplayer may be playing at a different size.. it may be adjusting the image to the correct aspect ratio). Aspect ratio is often represented as a single number (derived by dividing the second number into the first so 4:3 = 1.33, 16:9 = 1.77)

for a video to look "Correct" it in more important these days that the aspect ratio be correct rather then the pixels a good example of this is 16:9 content on standard DVD. DVD's are recorded at 720x480 which is a ratio of 1.5 so it is up to the player to scale the image to the correct 16/9 (1.77) Aspect ratio. This is how some DVD's pull off "anamorphic" video which looks OK at either 16/9 or 4/3. (the origional video is recoreded in a 1.5 aspect so it's not too warped in either 1.33 or 1.77)

I'm pretty sure, if you absolutely need the size of an mplayer window to be a certian WxH pixel wise (to fit in in a view window or such) you can use the -geometry option you may also want to look into the -vf dsize= option for more versatile resizing.

Hope this helps
Freemor
 
Old 10-31-2007, 12:52 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Quote:
Originally Posted by Freemor View Post
the size that mplayer reports is the actual size (pixels) of the video. this however is not necessarily the size it will play it at (for various reasons)...
Thanks for the answer, but I'm not interested in the size of the mplayer window, I'm interested in getting the size the movie is supposed to play... a tool that can be run on the command line that report back something like

"This movie will play at 720x486"

or something of the sort... It's for a cataloging system that goes through a file system, finds movies, makes thumbnails, displays info about each movie, stores a bunch of stuff in a database, etc. etc. etc. It's all built already, I'm just not getting correct frame sizes from ffmpeg, so I'm looking for an alternative to ffmpeg that gives better info.

Currently, I'm using tcprobe which appears to be the closest, though still not perfect.
 
Old 10-31-2007, 02:08 PM   #4
Freemor
Member
 
Registered: Aug 2005
Location: New Brunswick
Distribution: Trisquel
Posts: 70
Blog Entries: 8

Rep: Reputation: 15
Ah.. I misunderstood the nature of your problem a slight bit. You have a bit of a tricky problem there as if a player is adjusting to correct for aspect ratio the size will be different. To make it even more complicated the size that it gets adjusted to will probably also depend on the aspect ratio and resolution of the screen it is being displayed on (unless all forseeable screens are of the same configuration).

mplayer does produce textual output which talks about what it's doing scaling wise and you could use that to get the actual play size

Quote:
Starting playback...
VDec: vo config request - 544 x 368 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 544x368 => 654x368 Planar YV12
in the above the last line shows the from => to of the scaling that was done.

of course if I had chosen to play the video "full screen" the resulting output resolution would be different.

Hope that helps
Freemor


ooops just re-read your origional post to make sure I wasn't missing anything and I'm Glad I did. it looks like you may have some extra layer of adjusting/scaling going on (possibly in the Video output driver?) as from what you said the output size that Mplayer scaled to (in your case the origional size of the video) and the acutal size on the screen were different... Hmmm.. you may need someone with more experience then I.

Last edited by Freemor; 10-31-2007 at 02:23 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MPlayer 16:10 Aspect Ratio Linkhiei Linux - Software 9 01-18-2012 06:26 PM
mplayer for Windows - aspect ratio problem neutron68 General 4 05-06-2007 09:19 PM
mplayer is changing aspect ratio shanenin Linux - Software 1 10-20-2004 01:40 PM
Mplayer Aspect Ratio Glock Shooter Linux - Software 6 11-22-2003 07:19 PM
Mplayer & Ogle aspect ratio Johng Linux - Software 0 09-21-2002 06:24 AM


All times are GMT -5. The time now is 06:16 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration