LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-01-2005, 09:07 PM   #1
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Rep: Reputation: 30
watch your widescreen movies more full screen


I have a computer connected to my tv which I have my media library on. I personally prefer more of my screen being filled then a very widescreen movie shows. If you use mplayer and have avi files. This program will write a config file for each avi file that will tell mplayer how much to crop it

Code:
#!/usr/bin/env python

# authored by shane lindberg

# This script makes configuration files for mplayer. In particular it makes a configuration that crops widescreen 
# avi files so they will better fit your 4:3 aspect tv or computer moniter
# to run this program you need to to be in the directory that contains your avi files. Then just simply run the command
# it will check for the dimensions of the avi file using avitype, I think this is a part of transcode. If avitype is not
# installed the script will not work properly. This does not affect your media it only makes a config file that mplayer 
# will use. At any time you can simply do 'rm *conf' to remove all of the config files this program created
# then you will be back to your old widescreen self

import os
import sys

current_dir = os.getcwd()

# this python function gets the dimensions of a video file and returns them as a tuple (width,height)
# it uses the linux video program avitype (I think this is part of the transcode package)
# getdimensions.py
def getdimensions(video_file):

    import commands
    avitype_command= '/usr/bin/avitype "%s" | grep WxH' % video_file
    dimensions = commands.getoutput(avitype_command)
    width = int(dimensions[-7:-4])
    height = int(dimensions[-3:])
    WxH = (width,height)
    return WxH

# this function finds all media in a given directory by file extention. It then places this media in a list
def movie_find(directory):
    ls_dir = os.listdir(directory)
    dir_list =[]
    for i in ls_dir:
        if i.endswith('.avi'):
            dir_list.append(i)
    return dir_list

# this part checks to make sure the user has root privleges, if not it exits the script
current_user = os.geteuid()


#you may want to remove this if statment. It is needed for me because my movie files are in a write protected space
if current_user != 0:
    print "you need to be root to run this script"
    sys.exit()

# this part checks to make sure you are in the directory of the files you want to make .conf files for
print "is this the directory which contains the files you want to make .confs for"
print current_dir
answer = raw_input("enter 1 to continue")
if answer != '1':
    print "change to the correct directory then restart the script"
    sys.exit()

movie_list = movie_find(current_dir)

for i in movie_list:
    conf_name = "%s.conf" %i
    wxh = getdimensions(i)
    width = wxh[0]
    # you can change the amount of crop by adjusting the number multiplied by width. The lower the number
    # the more of a crop you will get. If the number is at the max 1, it will not be cropped at all
    cropped_width = int(.80 * width)
    print_tuple = (cropped_width,wxh[1])
    conf_file = open(conf_name, "w")
    conf_file.write("vf=crop=%s:%s\n"%print_tuple)
    conf_file.close()
 
Old 08-01-2005, 09:40 PM   #2
Erik_the_Red
Member
 
Registered: Jun 2003
Location: Georgia
Distribution: Arch
Posts: 113

Rep: Reputation: 15
I certainly appalud your Python program, but widescreen is more of a habit than anything else.

If you're really into the movie, then you shouldn't notice the bars at all.
 
Old 08-01-2005, 09:59 PM   #3
shanenin
Member
 
Registered: Aug 2003
Location: Rochester, MN, U.S.A
Distribution: Gentoo
Posts: 987

Original Poster
Rep: Reputation: 30
I know many people prefer widescreen, I am probably in the minority. I think I have trouble following what is going on when it is much smaller. Maybe I should just go out and get a much bigger telivision.
 
Old 08-02-2005, 12:30 AM   #4
guideweb
Member
 
Registered: Mar 2004
Location: /planet/earth
Posts: 110

Rep: Reputation: 15
Quote:
Originally posted by shanenin
I know many people prefer widescreen, I am probably in the minority. I think I have trouble following what is going on when it is much smaller. Maybe I should just go out and get a much bigger telivision.
Your couch is probably to far away from your tv. Move it closer and you will save thousand of precious $$
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can you watch movies on SuSE 9.1? A.D.D. Linux - Newbie 15 10-15-2004 01:43 PM
Can't watch DVD movies FXRS Linux - Hardware 2 08-25-2004 10:21 AM
remove black bars widescreen movies with mencoder TheOneAndOnlySM Linux - Software 1 07-17-2004 05:49 PM
xaw tv problem ,help me to watch my tv prgms in full screen rajeshkgk Linux - Software 1 10-15-2003 04:38 PM
How to watch .rm movies? jimman Linux - Software 3 09-06-2002 02:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:55 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration