Recherche avancée

Médias (91)

Autres articles (60)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, 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 (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • 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 (...)

Sur d’autres sites (6512)

  • Discord FFMPEG audio wont play from yt-dlp

    19 mars 2023, par user21236822

    My question is this : Why isn't my bot playing audio ?

    


    I want the bot to join, play audio from queue, then disconnect without downloading an mp3 file.

    


    I tried using youtube-dl, but I switched to the yt-dlp library after getting errors I couldn't fix.
I am running on Windows 10 locally. All my libraries are up to date.

    


    Here are my ydl_opts and FFMPEG_OPTS :

    


    ydl_opts = {
    'format': 'bestaudio/best',
    'postprocessors': [{
        'key': 'FFmpegExtractAudio',
        'preferredcodec': 'mp3',
        'preferredquality': '192',
    }],
}

FFMPEG_OPTIONS = {
    'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
    'options': '-vn'
} 


    


    Here is where I believe the problem is.

    


    async def play():
    print("Play Called")
    musicPlay()
    # Get message object from initial request
    message = ytLinkQue.get()
    print(f"Message object recieved: {message}")
    voiceChannel = message.author.voice.channel
    vc = await voiceChannel.connect()
    songsPlayed = 0
    
    while not ytLinkQue.empty():
        # Get current song
        currentSong = ytLinkQue.get()[0]
        print(f"Current song: {currentSong}")

        # Get song from Youtube
        with yt_dlp.YoutubeDL(ydl_opts) as ydl:
            # song = ydl.download(currentSong)
            info = ydl.extract_info(currentSong, download=False)
            song = info['formats'][0]['url']

        # Play Song
        vc.play(discord.FFmpegPCMAudio(song, **FFMPEG_OPTIONS), after=lambda e: print('Song done'))

        # Wait until the song has finished playing
        while vc.is_playing():
            print("playing rn")
            await asyncio.sleep(1)
    
    await vc.disconnect()
    musicStop()


    


    When play() is called, here is the output in terminal with my annotations as **** text **** :

    


    >python main.py&#xA;2023-02-17 15:21:09 INFO     discord.client logging in using static token&#xA;2023-02-17 15:21:10 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: 60b9fce14faa5daa4aed9eb6db01a74d).&#xA;Max que: 50&#xA;Text Channel: 828698708123451434&#xA;Testing Bot#4591 is ready.&#xA;Passing message object&#xA;**** play() funciton is called ****&#xA;Play Called&#xA;Message object recieved: <message channel="<TextChannel" position="7" nsfw="False" news="False"> type= author=<member discriminator="&#x27;0199&#x27;" bot="False" nick="&#x27;Fragnk7?&#x27;" guild="<Guild" chunked="True">> flags=<messageflags value="0">>&#xA;2023-02-17 15:21:16 INFO     discord.voice_client Connecting to voice...&#xA;2023-02-17 15:21:16 INFO     discord.voice_client Starting voice handshake... (connection attempt 1)&#xA;2023-02-17 15:21:17 INFO     discord.voice_client Voice handshake complete. Endpoint found seattle2004.discord.media&#xA;Current song: https://www.youtube.com/watch?v=vcAp4nmTZCA&#xA;[youtube] Extracting URL: https://www.youtube.com/watch?v=vcAp4nmTZCA &#xA;[youtube] vcAp4nmTZCA: Downloading webpage &#xA;[youtube] vcAp4nmTZCA: Downloading android player API JSON &#xA;**** Does not play any audio ****&#xA;Playing rn&#xA;Song done&#xA;2023-02-17 15:21:18 INFO     discord.player ffmpeg process 20700 successfully terminated with return code of 1.&#xA;2023-02-17 15:21:19 INFO     discord.voice_client The voice handshake is being terminated for Channel ID 400178308467392513 (Guild ID 261601676941721602)&#xA;2023-02-17 15:21:19 INFO     discord.voice_client Disconnecting from voice normally, close code 1000.&#xA;</messageflags></member></message>

    &#xA;

    On Discord's end, the bot successfully connects then disconnects after 2 second.

    &#xA;

    Note : I've only included code I think is relevant. Please let me know if I should add anything else to the post, otherwise, here is the github for the project. Code is in main.py.&#xA;https://github.com/LukeLeimbach/wallMomentMusic

    &#xA;

    Thank you in advance !

    &#xA;

    I've applied the advice from these posts but it still will not play audio :

    &#xA;

    -https://stackoverflow.com/questions/45770016/how-do-i-make-my-discord-bot-play-audio-from-youtube

    &#xA;

    -https://stackoverflow.com/questions/66070749/how-to-fix-discord-music-bot-that-stops-playing-before-the-song-is-actually-over?newreg=c70dd786cf5844e490045494223c0381

    &#xA;

    -https://stackoverflow.com/questions/57688808/playing-music-with-a-bot-from-youtube-without-downloading-the-file

    &#xA;

  • How to get video pixel location from screen pixel location ?

    22 février 2024, par AmLearning

    Wall of Text so I tried breaking it up into sections to make it better sorry in advance

    &#xA;

    The problem

    &#xA;

    I have some video files that I am reading with ffmpeg to get the colors at specific pixels, and all seems well, but I just ran into a problem with finding the right pixel to input. I realized (or mistakingly believe) that the pixel location (x,y) on the screen will be different than the local pixel location so to speak of the video (ie. If I want to get pixel 50,0 of the video that will be different than my screen's pixel 50,0 because the resolutions don't match). I was trying to think of a way to convert my screen's pixel location into the "local pixel location", and I have two ideas but I am not sure if any of them is any good. Note I am currently using cmd+shift+4 on macos to get the screen coordinates and the video is playing fullscreen like in the screenshot below.

    &#xA;

    Ideas

    &#xA;

      &#xA;
    1. enter image description here If I manually measure and account for this vertical offset, would it effectively convert the screen coordinate into the "local" one ?

      &#xA;

    2. &#xA;

    3. If I instead adjust my SwsContext to put the destination height and width as that of my screen, will it effectively replace the need to convert screen coordinates to the video coordinates ?

      &#xA;

    4. &#xA;

    &#xA;

    Problems with the Ideas

    &#xA;

    The problems I see with the first solution are that I am assuming there is no hidden horizontal offset (or conversely that all of the width of the video is actually renderable on the screen). Additionally, this solution would only get an approximate result as I would need to manually measure the offsets, screen width, and screen height using the method I currently am using to get the screen coordinates.

    &#xA;

    With the second solution, aside from the question of if it will even work, the problem becomes that I can no longer measure what the screen coordinates I want are because I can't seem to get rid of those black bars in VLC.

    &#xA;

    Some Testing I did

    &#xA;

    Given that if the black bars are part of the video itself, my entire problem would be fixed (maybe ?) I tried seeing if the black bars were part of the video, and when I looked at the frame data's first pixel, it was black. The problem then is that if the black bars are entirely part of the video, then why are the colors I get for some pixels slightly off (I am checking with ColorSync Utility). These colors aren't just slightly off as in wrong but it seems more that they belong to a slightly offset region of the video.

    &#xA;

    However, this may be somewhat explained if ffmpeg reads right to left. When I put the top left corner of the video into the program and looked again at the pixel data in the frame for that location (location again was calculated by assuming the video location would be the same as the screen location) instead of getting white, I got a bluish color much like the glove in the top right corner.

    &#xA;

    The Watered Down Code

    &#xA;

        struct SwsContext *rescaler = NULL;&#xA;    rescaler = sws_getContext(codec_context->width, codec_context->height, codec_context->pix_fmt, codec_context->width, codec_context->height, AV_PIX_FMT_RGB0, SWS_FAST_BILINEAR, NULL, NULL, 0);&#xA;&#xA;// Get Packets (containers for frames but not guaranteed to have a full frame) and Frames&#xA;    while (av_read_frame(avformatcontext, packet) >= 0)&#xA;    {&#xA;        &#xA;        // determine if packet is video packet&#xA;        if (packet->stream_index != video_index)&#xA;        {&#xA;            continue;&#xA;        }&#xA;        &#xA;        // send packet to decoder&#xA;        if (avcodec_send_packet(codec_context, packet) &lt; 0)&#xA;        {&#xA;            perror("Failed to decode packet");&#xA;        }&#xA;        &#xA;        // get frame from decoder&#xA;        int response = avcodec_receive_frame(codec_context, frame);&#xA;        if (response == AVERROR(EAGAIN))&#xA;        {&#xA;            continue;&#xA;        }&#xA;        else if (response &lt; 0)&#xA;        {&#xA;            perror("Failed to get frame");&#xA;        }&#xA;        &#xA;        // convert frame to RGB0 colorspace 4 bytes per pixel 1 per channel&#xA;        response = sws_scale_frame(rescaler, scaled_frame, frame);&#xA;        if(response &lt; 0){&#xA;            perror("Failed to change colorspace");&#xA;        }&#xA;        // get data and write it&#xA;        int pixel_number = y*(scaled_frame->linesize[0]/4)&#x2B;x; // divide by four gets pixel linesize (4 byte per pixel)&#xA;        int byte_number = 4*(pixel_number-1); // position of pixel in array&#xA;        // start of debugging things&#xA;        int temp = scaled_frame->data[0][byte_number]; // R&#xA;        int one_after = scaled_frame->data[0][byte_number&#x2B;1]; // G&#xA;        int two_after = scaled_frame->data[0][byte_number&#x2B;2]; // B&#xA;        int als; // where i put the breakpoint&#xA;        // end of debugging things&#xA;    }&#xA;

    &#xA;

    In Summary

    &#xA;

    I have no idea what is happening.

    &#xA;

    I take the data for a pixel and compare it to what colorsync utility says should be there, but it is always slightly off as though the pixel I was actually reading was offset from what I thought I was reading. Therefore, I want to find a way to get the pixel location in a video given a screen coordinate when the video is in fullscreen, but I have no idea how to (aside from a few ideas that are probably bad at best).

    &#xA;

    Also does FFMPEG put the frame data right to left ?

    &#xA;

    A Video Better Showing My Problem

    &#xA;

    https://www.youtube.com/watch?v=NSEErs2lC3A

    &#xA;

  • Best ffmpeg options for creating TikTok-like app ? [closed]

    27 août 2022, par nickcoding

    My app is essentially vertical videos, so I'd like the videos to more or less be cropped to that dimension (especially in the case they are 'landscape mode' videos. In the below picture, if the video is that horizontal black rectangle, we should just crop the video to that dimension of the phone (the red vertical rectangle). I've tried messing around with aspect ratios, but can't seem to get it to work right (where the video is essentially cropped to the correct aspect ratio), but not necessarily hard-coding the dimensions (this would look bad on different size devices).

    &#xA;

    I'm using this module : https://www.npmjs.com/package/fluent-ffmpeg

    &#xA;

    How should I do this ?

    &#xA;

    https://i.stack.imgur.com/bb8qR.png

    &#xA;

    var ffmpeg = require(&#x27;fluent-ffmpeg&#x27;);&#xA;&#xA;  ffmpeg(&#x27;./original.mp4&#x27;)&#xA;    .fps(25)&#xA;    .videoCodec(&#x27;libx264&#x27;)&#xA;    // here, I&#x27;ve tried .withAspectRatio(&#x27;16:9&#x27;) and playing around with .size(), but that seems to do nothing.&#xA;    .save(&#x27;./new.mp4&#x27;);&#xA;

    &#xA;