Recherche avancée

Médias (0)

Mot : - Tags -/flash

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (71)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 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, par

    MediaSPIP 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, par

    Une 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 goncharov

    I 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 Smith

    Following 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 in fname) :

    


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

    &#xA;

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

    &#xA;

  • PiCamera stream to youtube with ffmpeg and capture image every second

    9 octobre 2020, par MisterGray

    I'm sending a livestream with a Python script on a Raspberry Pi 4 to Youtube with ffmpeg.

    &#xA;

    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.

    &#xA;

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

    &#xA;

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

    &#xA;

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

    &#xA;

    #!/usr/bin/env python3&#xA;import subprocess&#xA;from picamera.array import PiRGBArray&#xA;from picamera import PiCamera&#xA;import time&#xA;import cv2&#xA;import numpy as np&#xA;&#xA;YOUTUBE = &#x27;rtmp://a.rtmp.youtube.com/live2/&#x27;&#xA;KEY = &#x27;MyYoutubeKey&#x27;&#xA;stream_cmd = &#x27;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 &#x27; &#x2B; YOUTUBE &#x2B; KEY&#xA;&#xA;avg = None&#xA;stream_pipe = subprocess.Popen(stream_cmd, shell=True, stdin=subprocess.PIPE)&#xA;resolution = (1280,720)&#xA;with PiCamera(resolution = resolution) as camera:&#xA;&#xA;    rawCapture = PiRGBArray(camera, size = resolution)&#xA;&#xA;    camera.framerate = 25&#xA;    camera.vflip = True&#xA;    camera.hflip = True&#xA;    camera.start_recording(stream_pipe.stdin, format=&#x27;h264&#x27;, bitrate = 6000000)&#xA;    while True:&#xA;        camera.wait_recording(1)&#xA;&#xA;        # this command takes a long time to finish&#xA;        frame = camera.capture(stream_pipe.stdin, &#x27;rgb&#x27;)&#xA;&#xA;        """&#xA;        further calculations&#xA;        """&#xA;&#xA;        rawCapture.truncate(0)&#xA;&#xA;    camera.stop_recording()&#xA;    stream_pipe.stdin.close()&#xA;    stream_pipe.wait()&#xA;

    &#xA;