Direkt zum Hauptbereich

Video aus Bild und Audiodatei erstellen

Bei YouTube und Sevenload sind ab und an Videos zu sehen, die nur ein Bild und Audiodaten enthalten Keine große Sache, wenn man weiß, wie es geht. Beim Suchen nach einer einfachen Möglichkeit bin ich in den internationalen Ubuntu-Foren auf ein Python-Script gestoßen, das genau diese Aufgabe erledigt: man benötigt ein Bild, eine MP3-Datei, die Sekundenanzahl und aus diesen Komponenten formt das Python-Script eine Avi-Datei, die man dann leicht hochladen kann. Hierzu wird jedoch das Programm „mencoder“ benötigt.

Da ich nicht weiß, wie lange das Script online sein wird, habe ich es hier noch einmal veröffentlicht:

#!/usr/bin/env python

# makevid.py - Make videos from a single image plus a sound file
# Copyright (C) 2007 Sam Peterson

# This program 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 of the License, or
# (at your option) any later version.
#
# This program 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.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

"""
makevid.py by Sam Peterson

Latest version of script should be available at:
http://peabody.weeman.org/makevid.py

Requirements: mencoder

This script creates an avi divx video for uploading to YouTube given
only an mp3 and an image file. I use it to create video reponses to
people on YouTube. I have a microphone, but I currently don't have a
working video device. Plus, if I did, I wouldn't use it anyway, as I
don't like to place my face in public Internet forums. The script
requires a working mencoder in your PATH.

This script takes three command line arguments: a path to an image
file, a path to an audio file, and a number of seconds. If everything
goes smoothly, a video file named output.avi will be written to the
current directory. The file should play roughly as long as the number
of seconds specified.

Example:

makevid.py lebowski.jpg audio.mp3 20

Please email any bugs to peabodyenator@gmail.com. The videos seems to
work well once uploaded, but seeking seems a little strange. I'm open
to all suggestions.

Advice:
* You should pre-scale your image file to 320x240, which is the YouTube
video resolution.

* To my knowledge, the audiofile doesn't have to be an mp3, but that's
the recommended format on YouTube's website.

TODO: I think it should be possible to determine how long the video
needs to be from the audio file, but I'm not sure of the best way to
do this. If it could be done it would eliminate the requirement of
manually passing the number of seconds to the script.
"""

import os, sys

fps = 30

if len(sys.argv) != 4:
print "Usage: makevid.py audiofile imagefile seconds"
sys.exit(1)

secs = int(sys.argv[3])
if secs < secs =" 1" filesexist =" True" filesexist =" False" mencoder_cmd =" ('mencoder" fps="%f" vbitrate="100">


Anleitung für das Skript unter Ubuntu:
  1. In die Konsole wechseln und mit sudo apt-get install mencoder „mencoder“ installieren.
  2. Skript kopieren, in eine Textdatei einfügen und unter „makevid.py" speichern.
  3. In das Verzeichnis, in dem das Skript liegt, mit cd wechseln.
  4. Diese Textdatei mit chmod +x ausführbar machen.
  5. Ein Video mit makevid.py Bild.jpg Audio.mp3 Sekunden erstellen.
Das Ergebnis sollte eine Datei namens „output.avi“ sein.

Beliebte Posts aus diesem Blog

Präsident Obama umarmt Gabrielle Giffords

Quelle

Schöffen leben gefährlich

Der Artikel ist zwar noch etwas älter vom 13.3., aber so skurril, dass ich geradezu darauf verweisen muss : Seit rund fünf Jahren arbeitet der Pensionär Peter Wenske-Wallner als ehrenamtlicher Schöffe am Amtsgericht Mainz. Zu Beginn jeden Jahres, so auch in 2007, erhielt er seine Liste mit den möglichen Terminen. Diesen folgen dann konkrete Einladungen, jeweils zweifach per Post und per Bote. So erreichte ihn auch die Einladung zum Gerichtstermin am 23. Oktober 2007. Und dann passierte Wenske-Wallner ein Versehen: Er trug diesen Termin in seinem persönlichen Kalender auf den 24. Oktober ein. [...] Nach nicht weniger als gut 15 Monaten, datiert vom 5. Februar 2009, traf an Wenske-Wallners Privatadresse ein Brief mit der Mitteilung eines “Kostenbeschlusses“ ein, ein paar Tage später der Kostenbescheid über genau 803,50 Euro. Per E-Mail teilte er unverzüglich mit, dass er lieber in das Gefängnis geht. Denn die Geldstrafe liegt höher als seine monatliche Nettorente. Nachdem er dies auch no

Der leere Stuhl

Großartig. Ich mag das sehr, wie Eastwood ein Gespräch mit dem Präsidenten darstellt und dabei so tut, als würde er den Faden verlieren bzw. die Themen wie bei einem echten Gespräch wechseln. Man darf sich dabei sicher sein, dass keine Pause zufällig und kein Stocken ein Versehen ist. Es ist eine große Show.