
Recherche avancée
Autres articles (71)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)
Sur d’autres sites (8366)
-
Error : Unable to extract uploader id - Youtube, Discord.py
22 juillet 2024, par nikita goncharovI have a very powerful bot in discord (discord.py, PYTHON) and it can play music in voice channels. It gets the music from youtube (youtube_dl). It worked perfectly before but now it doesn't want to work with any video.
I tried updating youtube_dl but it still doesn't work
I searched everywhere but I still can't find a answer that might help me.


This is the Error :
Error: Unable to extract uploader id


After and before the error log there is no more information.
Can anyone help ?


I will leave some of the code that I use for my bot...
The youtube setup settings :


youtube_dl.utils.bug_reports_message = lambda: ''


ytdl_format_options = {
 'format': 'bestaudio/best',
 'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s',
 'restrictfilenames': True,
 'noplaylist': True,
 'nocheckcertificate': True,
 'ignoreerrors': False,
 'logtostderr': False,
 'quiet': True,
 'no_warnings': True,
 'default_search': 'auto',
 'source_address': '0.0.0.0', # bind to ipv4 since ipv6 addresses cause issues sometimes
}

ffmpeg_options = {
 'options': '-vn',
}

ytdl = youtube_dl.YoutubeDL(ytdl_format_options)


class YTDLSource(discord.PCMVolumeTransformer):
 def __init__(self, source, *, data, volume=0.5):
 super().__init__(source, volume)

 self.data = data

 self.title = data.get('title')
 self.url = data.get('url')
 self.duration = data.get('duration')
 self.image = data.get("thumbnails")[0]["url"]
 @classmethod
 async def from_url(cls, url, *, loop=None, stream=False):
 loop = loop or asyncio.get_event_loop()
 data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
 #print(data)

 if 'entries' in data:
 # take first item from a playlist
 data = data['entries'][0]
 #print(data["thumbnails"][0]["url"])
 #print(data["duration"])
 filename = data['url'] if stream else ytdl.prepare_filename(data)
 return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)




Approximately the command to run the audio (from my bot) :


sessionChanel = message.author.voice.channel
await sessionChannel.connect()
url = matched.group(1)
player = await YTDLSource.from_url(url, loop=client.loop, stream=True)
sessionChannel.guild.voice_client.play(player, after=lambda e: print(
 f'Player error: {e}') if e else None)



-
Why do I get UnknownValueError() speech_recognition.UnknownValueError when trying to run .recognize_google ?
20 juillet 2022, par John SmithFollowing code is meant to transcribe a long audio file to text. It is to do this piece by piece.
trimmed.wav
holds a 15-second-long piece of a longer audio file (whose path is stored infname
) :

#!/usr/bin/env python3

from subprocess import run
from sys import exit

italic = '\33[3m'
end = '\33[m'

try:
 from speech_recognition import AudioFile, Recognizer
except:
 run("pip3 install SpeechRecognition", shell=True)
 from speech_recognition import AudioFile, Recognizer

def transcribe_piece(fname, lang, stime):
 extension = fname[-3:]
 etime = stime + 15
 cmd = f"ffmpeg -ss {stime} -to {etime} -i {fname} -c copy trimmed.{extension} >/dev/null 2>&1"
 run(cmd, shell=True)
 cmd = f"ffmpeg -i trimmed.{extension} -f wav trimmed.wav >/dev/null 2>&1"
 run(cmd, shell=True)
 r = Recognizer() 
 af = AudioFile("trimmed.wav")
 with af as source:
 r.adjust_for_ambient_noise(source)
 audio = r.record(source)
 t = r.recognize_google(audio, language=lang)#UnknownValueError() speech_recognition.UnknownValueError
 print(f"{italic}{t}{end}")
 with open("of", "w") as f:
 f.write(f"{t}\n")
 run(f"rm trimmed.{extension}", shell=True) 
 run(f"rm trimmed.wav", shell=True)
 
 

fname = input("File name? Skip the path if the file is in CWD. The usage of ~ is allowed.\n")

lang = input("""Specify one of the following languages:
fr-BE, fr-CA, fr-FR, fr-CH

en-AU, en-CA, en-GH, en-HK, en-IN, en-IE, en-KE, en-NZ, en-PK, en-PH, en-SG, en-ZA, en-TZ, en-GB, en-US

es-AR, es-BO, es-BO, es-CL, es-CO, es-CR, es-DO, es-EC, es-SV, es-SV, es-GT, es-HN, es-MX, es-NI, es-PA, es-PY, es-PE, es-PR, es-ES, es-US, es-UY, es-VE\n""")


#for stime in range(0, 10000, 15):
# try:
# transcribe_piece(fname, lang, stime)
# except:
# run("shred -u trimmed.wav" , shell=True) 
 #run("shred -u trimmed.wav >/dev/null 2>&1" , shell=True) 
# exit(0)
 
for stime in range(0, 10000, 15):#this loop is only for the sake of debugging, use try/except above
 transcribe_piece(fname, lang, stime)




It gives me the following error :


Traceback (most recent call last):
 File "/home/jim/CS/SoftwareDevelopment/MySoftware/Python/speech-to-text/long-audio-to-text.py", line 61, in <module>
 transcribe_piece(fname, lang, stime)
 File "/home/jim/CS/SoftwareDevelopment/MySoftware/Python/speech-to-text/long-audio-to-text.py", line 31, in transcribe_piece
 t = r.recognize_google(audio, language=lang)
 File "/home/jim/.local/lib/python3.10/site-packages/speech_recognition/__init__.py", line 858, in recognize_google
 if not isinstance(actual_result, dict) or len(actual_result.get("alternative", [])) == 0: raise UnknownValueError()
speech_recognition.UnknownValueError

</module>


The said error refers to line 31, that is
t = r.recognize_google(audio, language=lang)
.
Why do I get this error ? How might I rewrite this code so that such error does not appear ?

-
PiCamera stream to youtube with ffmpeg and capture image every second
9 octobre 2020, par MisterGrayI'm sending a livestream with a Python script on a Raspberry Pi 4 to Youtube with ffmpeg.


Additionally I want to check the stream for movements. Therefore I want to compare two frames with each other. Since this is relatively computationally intensive, I wanted to limit myself to "only" compare single frames every second.


The camera.capture() command, however, seems to take very long, so the stream hangs again and again.


What is the best way to get a raw frame during the stream ?


Is there a better alternative to detect movements while creating a stream with ffmpeg ?


#!/usr/bin/env python3
import subprocess
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
import numpy as np

YOUTUBE = 'rtmp://a.rtmp.youtube.com/live2/'
KEY = 'MyYoutubeKey'
stream_cmd = 'ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv ' + YOUTUBE + KEY

avg = None
stream_pipe = subprocess.Popen(stream_cmd, shell=True, stdin=subprocess.PIPE)
resolution = (1280,720)
with PiCamera(resolution = resolution) as camera:

 rawCapture = PiRGBArray(camera, size = resolution)

 camera.framerate = 25
 camera.vflip = True
 camera.hflip = True
 camera.start_recording(stream_pipe.stdin, format='h264', bitrate = 6000000)
 while True:
 camera.wait_recording(1)

 # this command takes a long time to finish
 frame = camera.capture(stream_pipe.stdin, 'rgb')

 """
 further calculations
 """

 rawCapture.truncate(0)

 camera.stop_recording()
 stream_pipe.stdin.close()
 stream_pipe.wait()