All pastes #544959 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-06 17:31 UTC
rendered paste body
# Author Paco Garcia Rodriguez
#
#
# Copyright 2001,2007 Free Software Foundation, Inc.
#
#
# This is free software; you can redistribute it and/or modify
#
# it under the terms of the GNU General Public License as published by
#
# the Free Software Foundation; either version 2, or (at your option)
#
# any later version.
#
#
#
# This is distributed in the hope that it will be useful,
#
# but WITHOUT ANY WARRANTY; without even the implied warranty of
#
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#
# GNU General Public License for more details.

import glob, os, time
from os.path import join, getsize


vlc_ps3 = "ffmpeg.exe" + ' -y -i ' + '"FILENAME_SRC"' + ' -f mp4 -vcodec xvid -r 24000/1001 -b 1536k -bufsize 2500k -maxrate 2500k -g 250 -acodec aac -ac 2 -ab 128k ' + '"FILENAME_DST"'
vlc_n95 = "ffmpeg.exe" + ' -y -i ' + '"FILENAME_SRC"' + ' -s 320x240 ' + '"FILENAME_DST"'

#vlc_ps32 = "ffmpeg.exe" + ' -y -i ' + '"FILENAME_SRC"' + ' -f mp4 -vcodec xvid -r 24000/1001 -b 1536k -bufsize 2500k -maxrate 2500k -g 250 -acodec aac -ac 2 -ab 128k ' + '"FILENAME_DST"'
#print vlc_ps32

#vlc_ps33 = "\"C:\Program Files\Red Kawa\Video Converter\Tools\FFmpeg\\ffmpeg.exe\""
#print vlc_ps33

#asd = os.system(vlc_ps32)
#print asd.read()
#time.sleep(100000)



raiz = "d:\\output"
filelist = []

def is_file_increasing(filename):
    size1 = os.path.getsize(filename)
    time.sleep(1)    
    size2 = os.path.getsize(filename)
    print size1, size2
    if(size1==size2):
        return False
    return True


while(1):
           
    for root, dirs, files in os.walk(raiz):
        for item in files:
            item = item.lower()
            if (item.rfind('.mp4') == -1 and item.rfind('.avi') != -1):
                filelist.append(root + "\\" + item)
     
    print filelist
    
    for file in filelist:
        print file
        if is_file_increasing(file):
            print "File is being copied to the filesystem, skip!"
        else :
            vlc_ps3 = vlc_ps3.replace("FILENAME_SRC", file)
            vlc_ps3 = vlc_ps3.replace("FILENAME_DST", file.replace(".avi", ".mp4"))
            print vlc_ps3
            os.system(vlc_ps3)
    
            vlc_n95 = vlc_n95.replace("FILENAME_SRC", file.replace(".avi", ".mp4"))
            vlc_n95 = vlc_n95.replace("FILENAME_DST", file.replace(".avi", ".N95.mp4"))
            print vlc_n95
            os.system(vlc_n95)    
            
            os.remove(file)
            print "FILE", file, " HAS BEEN ENCODED !!"
    time.sleep(60)
    filelist = []