User:OsvaldoGago/wiztheora
Wiztheora is a script to help make it easier to convert video from other file formats to ogg theora, the video format used in Wikimedia projects.
The script uses the comand line program ffmpeg2theora to make the conversion to ogg, but it's easier to use than ffmpeg2theora, because it acts as an interactive wizzard, asking questions to the user.
It works both for Linux, Mac OS X (Universal Binary) and Microsoft Windows, and it's text-based (for now).
Features
edit- define source and target filenames,
- define video and audio quality,
- add metadata (optional),
- Director
- Title
- Date
- Location
- Copyright
- License
- resize your movie (optional),
- you can see your converted ogg file in mplayer (optional).
Install wiztheora
editNote: If you want security on your computer, always check the source code before installing. This script comes with no warranty at all. By downloading and using it you agree you won't make anyone responsible for the results of its use or misuse.
Requirementsedit
Download and installedit1.- Download the tar file wiztheora0.02.tar.gz to the Desktop 2.- Open a Shell and go to the desktop folder by typing:
3.- Extract the tar with the command (you must be an administrator in your computer to do this):
4.- Check if the script is working by typing:
Optional featureseditWiztheora can display the converted .ogg file, but it needs mplayer installed. To install mplayer:
|
Requirementsedit
Download and installedit1.- Download the tar file wiztheora0.02.tar.gz to the Desktop 2.- Open a Terminal and go to the desktop folder by typing:
3.- Extract the tar with the command (you must be an administrator in your computer to do this):
4.- Check if the script is working by typing:
Optional featureseditWiztheora can display the converted .ogg file, but it needs mplayer installed. To install mplayer:
Note: A (bug?) on mplayer aplication does not allow you to view (but you can listen) some ogg movies on the Mac OS X. The problem doesn't exist in mplayer for Linux.
|
Using wiztheora
editAfter installing wiztheora you can begin using it:
1.- Download the files you want to convert to ogg-theora do the desktop
2 - Open a console (Linux) or a terminal (Mac OS X) and go to the desktop.
$ cd ~/Destop
3 - Type wiztheora
$ wiztheora
4 - Read and answer all the questions.
Developing the script
editObjectives
editI would like to continue to develop this script with the help from the community. First priority is to support as many video file formats as possible.
License
editThe script licensed under the GPL, the GFDL and Creative Commons Share-A-Like.
Bugs
editIf you find any bugs please report them on the Talk page
Source code
edit#!/usr/bin/python # -*- coding: utf-8 -*- # Licensed under the GPL: # http://www.gnu.org/copyleft/gpl.html # Licensed under the GFDL: # http://www.gnu.org/copyleft/fdl.html # Programing by Osvaldo Gago # http://ginga.fotografar.net # https://gna.org/projects/ginga # requires the ffmpeg2theora aplication # http://www.v2v.cc/~j/ffmpeg2theora/ import os # Procedures --------------- def linha(a): print ' ' print '-' * a print ' ' # Main wizzard --------------- linha(60) print 'Wiztheora is a script to make it easier to convert video files to ogg theora file format and codec.\n' print 'It works with some types of video formats...' linha(60) filename = raw_input('What\'s the name of the file ? (eg: example.mpg) = ') targetname = raw_input('What\'s the name of the target file ? (eg: final) = ') videoquality = raw_input('Videoquality ? (from 1 to 10, default 5) = ') audioquality = raw_input('Audioquality ? (from -2 to 10, default 1) = ') # Metadata wizzard linha(60) print 'Wiztheora will allow you to add embed metadata in the file.\n' print 'Metadata that can be embed:' print '- Director' print '- Title' print '- Date' print '- Location' print '- Copyright' print '- License\n' metadata = raw_input('Would you like to add metadata ? (y or n) = ') if metadata == 'y' or metadata == 'Y': print ' ' metadirector = raw_input('Director = ') metatitle = raw_input('Title = ') metadate = raw_input('Date (eg:12/06/2006) = ') metalocation = raw_input('Location = ') metacopyright = raw_input('Copyight owner = ') metalicense = raw_input('License = ') # Resize movie wizzard, width and heigh must be multiple of 8 linha(60) print 'Wiztheora will allow you to resize your movie.' resize = raw_input('Would you like to resize your movie ? (y or n) = ') if resize == 'y' or resize == 'Y': print 'You may want to keep the orginal width/heigh ratio, calculate width and heigh carefully...' resizewidth = raw_input('Resize with (px) = ') resizewidth = int(resizewidth) wcalc = resizewidth / 8 resizewidth = wcalc * 8 resizewidth = str(resizewidth) resizeheigh = raw_input('Resize heigh (px) = ') resizeheigh = int(resizeheigh) hcalc = resizeheigh / 8 resizeheigh = hcalc * 8 resizeheigh = str(resizeheigh) # ANALISIS OF DATA # Starting: comando = 'ffmpeg2theora' # Source and target files: comando = comando + ' ' + filename + ' -o ' + targetname + '.ogg' # Video quality and audioquality comando = comando + ' -v ' + videoquality + ' -a ' + audioquality # Resize if resize == 'y' or resize == 'Y': comando = comando + ' -x ' + resizewidth comando = comando + ' -y ' + resizeheigh if metadata == 'y' or metadata == 'Y': comando = comando + ' --artist "'+ metadirector + '" --title "'+ metatitle + '"' comando = comando + ' --date "'+ metadate + '" --location "' + metalocation + '"' comando = comando + ' --copyright "' + metacopyright + '" --license "' + metalicense + '"' # Output comand linha(60) print 'The command is:\n' print comando print ' ' executar = raw_input('Would you like to execute it? (y or n) = ') print ' ' if executar == 'y' or executar == 'Y': print 'Executing conversion...\n' os.system(comando) print '\nWiztheora has finished converting %s to %s.ogg\n' %(filename,targetname) print 'Would you like to view and test %s.ogg with mplayer ?' %(targetname), vermplayer = raw_input('(y or n) = ') if vermplayer == 'y' or vermplayer == 'Y': comando2 = 'mplayer ' + targetname + '.ogg' os.system(comando2)