Código de Python - Combinador de archivos de video y audio.

Imágen de perfil
Val: 712
Bronce
Ha aumentado 1 puesto en Python (en relación al último mes)
Gráfica de Python

Combinador de archivos de video y audio.gráfica de visualizaciones


Python

Actualizado el 27 de Noviembre del 2020 por Antonio (75 códigos) (Publicado el 26 de Octubre del 2020)
3.699 visualizaciones desde el 26 de Octubre del 2020
Sencilla interfaz con la que se puede crear un archivo combinando la información de uno de video y otro de audio.
USO: Con los botones "SELECCIONAR ARCHIVO DE AUDIO" y "SELECCIONAR ARCHIVO DE VIDEO" seleccionamos los archivos de audio y vídeo, respectivamente que queremos unir y con el botón "COMBINAR AUDIO Y VIDEO" ubicamos y damos nombre al nuevo archivo que contendrá la información de los dos archivos cargados.

ng

Requerimientos

Lenguaje: Python
Librerías y recursos: tkinter, mhmovie, os
Se necesita tener instalado "ffmpeg".

1.1

Actualizado el 30 de Noviembre del 2020 (Publicado el 26 de Octubre del 2020)gráfica de visualizaciones de la versión: 1.1
3.700 visualizaciones desde el 26 de Octubre del 2020
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tkinter import *
from tkinter import messagebox, filedialog
from mhmovie.code import *
import os
 
class app:
    def __init__(self):
        self.window = Tk()
        self.window.title("Audio & Video Mixer")
        self.window.configure(background="ivory3")
        self.window.geometry("750x290")
        self.vid = ""
        self.aud = ""
 
        self.label = Label(self.window, text="NINGÚN ELEMENTO SELECCIONADO", font=('Arial',10), bg="black", fg="green", width=87, height = 2)#99
        self.label.place(x=25,y=30)
        self.btnAudio = Button(self.window, text="SELECCIONAR ARCHIVO DE AUDIO", bg="dark orange",activebackground="black",activeforeground="dark orange",
                               width=45, height=2, command=self.get_audio)
        self.labelT = Label(self.window, bg = "ivory3", width = 99, height = 2)
        self.labelT.place(x=25,y=70)
        self.btnAudio.place(x=25,y=115)
        self.btnVideo = Button(self.window, text="SELECCIONAR ARCHIVO DE VIDEO", bg="dark orange",activebackground="black",activeforeground="dark orange",
                               width=45, height=2,command=self.get_video)
        self.btnVideo.place(x=398,y=115)
        self.btnMix = Button(self.window, text="COMBINAR AUDIO Y VIDEO", bg="blue", fg="white",activebackground="white",activeforeground="blue",
                             width=98, height=2,command=self.merge)
        self.btnMix.place(x=26,y=200)
        self.labelR = Label(self.window,bg="ivory3",width = 106, height = 2)
        self.labelR.place(x=1,y=250)
 
        self.window.mainloop()
 
    def get_audio(self):
        self.labelR.configure(text = "")
        self.labelT.configure(text = "")
        ruta = self.check_route(filedialog.askopenfilename(initialdir="/",title="SELECCIONAR AUDIO",filetypes =(("wav files","*.wav"),("mp3 files","*.mp3"),("all files","*"))))
        if ruta is not None:
            try:
                self.aud = (((ruta).split("/"))[-1])
                if self.vid == "":
                    self.label.configure(text=self.aud)
                else:
                    self.label.configure(text=self.vid+" + "+self.aud)
                self.selected_audio = music(ruta)
            except Exception as e:
                messagebox.showwarning("ERROR",str(e))
 
    def get_video(self):
        self.labelR.configure(text = "")
        self.labelT.configure(text = "")
        ruta = self.check_route(filedialog.askopenfilename(initialdir="/",title="SELECCIONAR VIDEO",filetypes =(("avi files","*.avi"),("mp4 files","*.mp4"),("all files","*"))))
        if ruta is not None:
            try:
                self.vid = (((ruta).split("/"))[-1])
                if self.aud == "":
                    self.label.configure(text=self.vid)
                else:
                    self.label.configure(text=self.aud+" + "+self.vid)
                name, self.vid_ex = os.path.splitext(self.vid)
                self.selected_video = movie(ruta)
            except Exception as e:
                messagebox.showwarning("ERROR",str(e))
 
    def check_route(self,route):
        if route != "":
            if not " " in route:
                return route
            else:
                messagebox.showwarning("FORMATO DE RUTA INCORRECTO","La ruta o archivo no debe contener espacios en blanco.\nPruebe a usar '_' en su lugar.")
 
 
    def merge(self):
        if self.vid != "" and self.aud != "":
            new_file=self.check_route(filedialog.asksaveasfilename(initialdir="/",title="Guardar en",defaultextension=self.vid_ex))
            if new_file is not None:
                try:
                    video_title = (((new_file).split("/"))[-1])
                    result = self.selected_video + self.selected_audio
                    result.save(new_file)
                    self.labelT.configure(text = "PROCESO FINALIZADO\n ARCHIVO CREADO: "+video_title)
                    self.labelR.configure(text = "RUTA VIDEO: {}".format(str(new_file)))
                    print("DONE")
                except:
                    messagebox.showwarning("ERROR","Hubo un error al efectuar la operación.")
 
if __name__=="__main__":
    app()



Comentarios sobre la versión: 1.1 (0)


No hay comentarios
 

Comentar la versión: 1.1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s6681