
Recherche avancée
Autres articles (35)
-
Modifier la date de publication
21 juin 2013, parComment changer la date de publication d’un média ?
Il faut au préalable rajouter un champ "Date de publication" dans le masque de formulaire adéquat :
Administrer > Configuration des masques de formulaires > Sélectionner "Un média"
Dans la rubrique "Champs à ajouter, cocher "Date de publication "
Cliquer en bas de la page sur Enregistrer -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Formulaire personnalisable
21 juin 2013, parCette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire. (...)
Sur d’autres sites (5324)
-
AttributeError : 'FilterableStream' object has no attribute 'input' - ffmpeg-python
26 septembre 2024, par KarolekI am a fresh programmer and I am learning the Python language.
I have been trying to design a graphical application (using tkinter and ffmpeg-python libraries) that converts an image file along with audio into a video of audio length displaying the image. Unfortunately whenever I try run program I keep encountering errors


At first it was due to installing the ffmpeg library in pip package manager instead of ffmpeg-python. I uninstalled the previous one, installing the correct one making sure no other package causes problems. Using a short script like this, the library functioned smoothly :


'''
The Error causing Statement
import ffmpeg 
(
 ffmpeg.input("something.mp3")
 .output("output.wav")
 .run()
)
'''
# When I tried to use the ffmpeg library in a graphics program within a function, unfortunately I was not able to get it to work

import tkinter as tk
from tkinter import filedialog
from tkinter import ttk

def select_image():
 file_path = filedialog.askopenfilename(title="Select a file", filetypes=[("image files","*.jpg;*.png;*.gif;*.jfif;")])
 print("Selected file:", file_path)

def select_audio():
 file_path = filedialog.askopenfilename(title="Select a file", filetypes=[("audio files","*.mp3;*.wav;*.ogg;*.flac;*.m4a;*.acc;")])
 print("Selected file:", file_path)

def create_video(image_file, audio_file, output_format):
 import ffmpeg
 (
 ffmpeg.input(image_file, loop=1)
 .input(audio_file)
 .output("output" + output_format)
 .run()
 ) 

def choose_directory():
 directory_path = filedialog.askdirectory(title="Select directory")
 print("Selected directory:", directory_path)


root = tk.Tk()

root.title("Audio To Video Converter")
root.geometry("500x700")

title = tk.Label(root, text="Audio To Video Converter", font=('Arial', 28))
title.pack(padx=20, pady=20)

selectImage_button = tk.Button(root, text="Select image", command=select_image, height=3, width=50)
selectImage_button.pack(pady=10, padx=20)
selectAudio_button = tk.Button(root, text="Select audio", command=select_audio, height=3, width=50)
selectAudio_button.pack(pady=10, padx=20)

label1 = tk.Label(root, text="Output video format", font=('Arial', 16))
label1.pack(padx=20, pady=10)

outputFormat = ttk.Combobox(root, width=55)
outputFormat['values'] = ('.avi', '.mkv', '.mp4', '.webm')
outputFormat['state'] = 'readonly'
outputFormat.pack(pady=5, padx=20)

label2 = tk.Label(root, text="Output directory", font=('Arial', 16))
label2.pack(padx=20, pady=10)

outputDirectory_button = tk.Button(root, text="Select directory", command=choose_directory, height=3, width=50)
outputDirectory_button.pack(pady=5, padx=60)


convert_button = tk.Button(root, text="Convert", height=3, width=50, command=create_video(selectImage_button, selectAudio_button, outputFormat['values'] ))

root.mainloop()



This is the only thing the console displayed after attempting to run


Traceback (most recent call last):
 File "c:\Users\Admin\Documents\konwerter\konwerter.py", line 56, in <module>
 convert_button = tk.Button(root, text="Convert", height=3, width=50, command=create_video(selectImage_button, selectAudio_button, outputFormat['values'] ))
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "c:\Users\Admin\Documents\konwerter\konwerter.py", line 17, in create_video
 .input(audio_file)
 ^^^^^
AttributeError: 'FilterableStream' object has no attribute 'input'
</module>


I did some research and did not find any information about this error except that it may be due to installing the wrong libraries. This is my list of installed libraries in pip package manager :


colored 2.2.4 customtkinter 5.2.2 darkdetect 0.8.0 ffmpeg-python 0.2.0 future 1.0.0 Gooey 1.0.8.1 packaging 24.1 pillow 10.4.0 pip 24.2 psutil 6.0.0 pyee 12.0.0 pygtrie 2.5.0 six 1.16.0 tkinterdnd2 0.4.2 typing_extensions 4.12.2 wxPython 4.2.2



Perhaps the solution to the problem is simple, but I am new and don't understand many things. I will be very grateful for your answer !


-
PHP script works when called from command line, does not when called as background via web server
6 juin 2014, par fNekI am facing a problem with a certain PHP script (CLI mode) I wrote. It should take certain arguments to convert a video with FFMPEG. When I call it from the command prompt, it works fine. However, I have to call it from a web server.
The PHP script that handles the request calls the PHP script in the background via code I found here at SE :
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}
else {
exec("nohup " . $cmd . " > /dev/null &");
}When run this way, however, the PHP script does not create the files, even after a much longer time than it took via the command prompt.
The script runs, I have checked that by letting it insert dummy entries into the database. It also has the permission to create files, which I verified by letting it create a text file.
What could be the difference that prevents my script from working properly ? I develop and test this code with XAMPP on Windows 7.
//EDIT : I forgot to give you this link to the background PHP script : http://pastebin.com/pfTZMfwi
//EDIT2 : I found out that the PHP process runs for a very short time (only until next refresh of the Windows task manager). Could it be that PHP kills its children when it exits ?
//EDIT3 : No, that seems not to be the problem. I cannot execute programs via exec() when the script is called as background from the web server. What could the problem be, and what would be a solution/workaround ?
//EDIT4 : The command that seems to cause the trouble is not exec()/etc. but the echo command I did before the exec(). I am going to remove it, but why does it cause a problem ?
-
ffmpeg won't start until java exits
9 août 2014, par user3925332I am trying to make a java program that automatically converts wtv files in an input folder to mpg files in output folder. The twist is that I make it run periodically, so it acts as a synchronizer.
The following code works for converting the .wtv to a .dvr-ms, which is required by ffmpeg since it cannot convert .wtv files directly.
Process p = Runtime.getRuntime().exec("C:\\Windows\\ehome\\WTVConverter C:\\Users\\Andrew\\Desktop\\test\\input\\input.wtv C:\\Users\\Andrew\\Desktop\\test\\output\\input.dvr-ms");
p.waitFor();WTVConverter has no problems running from a java application. ffmpeg is a different story. Once the above line runs, I then run this...
Process p = Runtime.getRuntime().exec("ffmpeg\\bin\\ffmpeg -y -i \"C:\\Users\\Andrew\\Desktop\\test\\output\\input.dvr-ms'" -vcodec copy -acodec copy -f dvd \"C:\Users\Andrew\Desktop\test\output\input.mpg\"");
p.waitFor();Suddenly, there is a problem... The application ffmpeg shows up in the task manager, but it’s cpu usage is 0, and no mpeg files is being generated. If I force the java application to close, though, suddenly it starts working ! Huh ?
What reason would there be for a command line application to wait for its calling application to quit before it executes ? I’m not incredibly command line savvy, so I don’t really know how to diagnose this problem.