
Recherche avancée
Autres articles (65)
-
Les images
15 mai 2013 -
Taille des images et des logos définissables
9 février 2011, parDans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...) -
Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur
8 février 2011, parLa visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
Configuration de la boite multimédia
Dès (...)
Sur d’autres sites (7195)
-
Saving H.264 RTP stream without re-encoding ?
13 avril 2012, par Gene VincentMy C++ application receives a H.264 RTP video stream.
Right now it decodes the stream, saves it into a YUV file and later I use ffmpeg to re-ecode the file into something suitable to watch on a Windows PC (eg. Mpeg4 AVI).
Shouldn't it be possible to save the H.264 stream into a AVI (or similar) container without having to decode and re-encode it ? That would require some H.264 decoder on the PC to watch, but it should be much more efficient.
How could that be done ? Are there any libraries supporting that ?
-
I'm having an issue with my discord bot playing audio from a youtube url
19 avril 2022, par Alex Graecasync def hog():
channel = bot.get_channel(964971002289356893)
url = 'https://www.youtube.com/watch?v=GyRmkAfpCOM'
await asyncio.sleep(1)
voice_channel = bot.get_channel(int(964971002289356893))
vc = await voice_channel.connect()
#vc.play(discord.FFmpegPCMAudio('C:/Users/alexa/Downloads/hogrider.mp3'))
vc.play(discord.FFmpegPCMAudio(source='https://www.youtube.com/watch?v=GyRmkAfpCOM', executable='ffmpeg.exe'))
while vc.is_playing():
 await asyncio.sleep(5)
await vc.disconnect()



It works fine with the audio file from my laptop, but I want to play it from a youtube link.
It gives me an error :
https://www.youtube.com/watch?v=GyRmkAfpCOM : Invalid data found when processing input


Thank you in advance


-
Pydub FFMPEG issue [closed]
14 janvier, par Nikolai van den HovenI am attempting to use FFMPEG with Pydub to create a program that chops .mp3 files into different words, each contained in their own .mp3 file, but when I run the script I am getting the following error :


PS C:\Users\nik> & C:/Users/nik/AppData/Local/Microsoft/WindowsApps/python3.12.exe "d:/Python/Word Splitter.py"
C:\Users\nik\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pydub\utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
 warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)



This is the code I am using.


import os
from pydub import AudioSegment
from pydub.silence import split_on_silence
import speech_recognition as sr
AudioSegment.ffmpeg = r"D:\Python\ffmpeg\bin\ffmpeg.exe"
def mp3_to_words(mp3_file, output_folder):
 # Ensure output folder exists
 os.makedirs(output_folder, exist_ok=True)

 # Load MP3 file
 print("Loading audio file...")
 audio = AudioSegment.from_mp3(mp3_file)

 # Split audio into chunks using silence detection
 print("Splitting audio into chunks...")
 chunks = split_on_silence(
 audio,
 min_silence_len=200, # Minimum silence duration in ms to consider as a split point
 silence_thresh=audio.dBFS - 14, # Silence threshold relative to average loudness
 keep_silence=100 # Retain some silence in chunks
 )

 recognizer = sr.Recognizer()

 for i, chunk in enumerate(chunks):
 print(f"Processing chunk {i + 1}/{len(chunks)}...")

 # Save the chunk temporarily
 temp_file = os.path.join(output_folder, f"chunk_{i}.wav")
 chunk.export(temp_file, format="wav")

 # Recognize words in the chunk
 with sr.AudioFile(temp_file) as source:
 audio_data = recognizer.record(source)
 try:
 text = recognizer.recognize_google(audio_data)
 words = text.split()

 # Export each word as its own MP3
 word_start = 0
 for j, word in enumerate(words):
 word_duration = len(chunk) // len(words) # Approximate duration per word
 word_audio = chunk[word_start:word_start + word_duration]
 word_file = os.path.join(output_folder, f"word_{i}_{j}.mp3")
 word_audio.export(word_file, format="mp3")
 word_start += word_duration

 except sr.UnknownValueError:
 print(f"Could not understand chunk {i + 1}.")
 except sr.RequestError as e:
 print(f"Could not request results; {e}")

 # Clean up temporary file
 os.remove(temp_file)

 print(f"Processed {len(chunks)} chunks. Word MP3s saved in {output_folder}.")

if __name__ == "__main__":
 input_file = input("Enter the path to the MP3 file: ").strip()
 output_dir = input("Enter the output folder path: ").strip()

 mp3_to_words(input_file, output_dir)



I have added the Base FFMPEG folder and the bin folder within it to Windows PATH
My PATH variable on Windows 11,
But it does not show up in the variable when I typed PATH into cmd