Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (56)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (7137)

  • Texture rendering on iOS using OpenGL ES in Unity project

    30 mars 2016, par Time1ess

    I’m working on a project, part of which is to stream video to my iPhone. I use my laptop to create the video stream to my iPhone with ffmpeg.

    The stream code in shell is below :

    ffmpeg \
       -f avfoundation -i "1" -s 1280*720 -r 29.97 \
       -c:v mpeg2video -q:v 20 -pix_fmt yuv420p -g 1 -threads 4\
       -f mpegts udp://192.168.1.102:6666

    with this, I successfully create my video stream.

    In Unity, I want to decode the video stream to create a texture. After I have gone through some ffmpeg tutorial and Unity tutorial, I created my link library. Some of these codes are below (ask me if more is needed) :

    In my library :

    buffer alloc :

    uint8_t *buffer;
    int buffer_size;
    buffer_size = avpicture_get_size(AV_PIX_FMT_RGBA, VIEW_WIDTH, VIEW_HEIGHT);

    buffer = (uint8_t *) av_malloc(buffer_size*sizeof(uint8_t));

    avpicture_fill((AVPicture *) pFrameRGB, buffer, AV_PIX_FMT_RGBA,
                  VIEW_WIDTH, VIEW_HEIGHT);

    getContext :

       is->sws_ctx = sws_getContext
       (
        is->video_st->codec->width,
        is->video_st->codec->height,
        is->video_st->codec->pix_fmt,
        VIEW_WIDTH,
        VIEW_HEIGHT,
        AV_PIX_FMT_RGBA,
        SWS_BILINEAR,
        NULL,
        NULL,
        NULL
        );

    sws_scale :

    sws_scale(
             is->sws_ctx,
             (uint8_t const * const *)pFrame->data,
             pFrame->linesize,
             0,
             is->video_st->codec->height,
             pFrameRGB->data,
             pFrameRGB->linesize
             );

    texture render :

    static void UNITY_INTERFACE_API OnRenderEvent(int texID)
    {
       GLuint gltex = (GLuint)(size_t)(texID);

       glBindTexture(GL_TEXTURE_2D, gltex);

       glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, VIEW_WIDTH, VIEW_HEIGHT,
                       GL_RGBA, GL_UNSIGNED_BYTE, pFrameRGB->data[0]);

       glGetError();
       return;
    }

    extern "C" UnityRenderingEvent UNITY_INTERFACE_EXPORT UNITY_INTERFACE_API GetRenderEventFunc()
    {
       return OnRenderEvent;
    }

    In Unity :

    texture created :

       private Texture2D texture;
       private int texID;
       texture = new Texture2D (width, height, TextureFormat.RGBA32, false);
       texture.filterMode = FilterMode.Point;
       texture.Apply ();
       GetComponent<renderer> ().material.mainTexture = texture;
       texID = texture.GetNativeTexturePtr ().ToInt32();
    </renderer>

    update func :

       void Update ()
       {
           GL.IssuePluginEvent(GetRenderEventFunc(), texID);
       }

    Video stream info :

    Input #0, mpegts, from 'udp://0.0.0.0:6666':
     Duration: N/A, start: 2.534467, bitrate: N/A
     Program 1
       Metadata:
         service_name    : Service01
         service_provider: FFmpeg
       Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], max. 104857 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc

    Leave other details, my library works fine on the Unity simulator, but when I compiled all my libraries for arm64 and used the xcode project that Unity created to build my app and ran it, I couldn’t get any texture rendered in my iPhone, I checked my network and I’m sure that data had been sent to my iPhone and the Debug log showed me that frame has been successfully decoded also the OnRenderEvent function had been called.

    FYI :

    Unity 5.3.2f1 Personal

    Xcode 7.2.1

    iOS 9.2.1

    ffmpeg 3.0

  • "FFmpeg : Error not transitioning to the next song in Discord Bot's queue."

    1er avril 2024, par noober

    I have 3 modules, but I'm sure the error occurs within this module, and here is the entire code within that module :

    &#xA;

    import asyncio&#xA;import discord&#xA;from discord import FFmpegOpusAudio, Embed&#xA;import os&#xA;&#xA;async def handle_help(message):&#xA;    embed = discord.Embed(&#xA;        title="Danh s&#xE1;ch lệnh cho B&#xE9; M&#xE8;o",&#xA;        description="Dưới đ&#xE2;y l&#xE0; c&#xE1;c lệnh m&#xE0; chủ nh&#xE2;n c&#xF3; thể bắt B&#xE9; M&#xE8;o phục vụ:",&#xA;        color=discord.Color.blue()&#xA;    )&#xA;    embed.add_field(name="!play", value="Ph&#xE1;t một b&#xE0;i h&#xE1;t từ YouTube.", inline=False)&#xA;    embed.add_field(name="!pause", value="Tạm dừng b&#xE0;i h&#xE1;t đang ph&#xE1;t.", inline=False)&#xA;    embed.add_field(name="!resume", value="Tiếp tục b&#xE0;i h&#xE1;t đang bị tạm dừng.", inline=False)&#xA;    embed.add_field(name="!skip", value="Chuyển đến b&#xE0;i h&#xE1;t tiếp theo trong danh s&#xE1;ch chờ.", inline=False)&#xA;    embed.add_field(name="!stop", value="Dừng ph&#xE1;t nhạc v&#xE0; cho ph&#xE9;p B&#xE9; M&#xE8;o đi ngủ tiếp.", inline=False)&#xA;    # Th&#xEA;m c&#xE1;c lệnh kh&#xE1;c theo c&#xF9;ng mẫu tr&#xEA;n&#xA;    await message.channel.send(embed=embed)&#xA;&#xA;class Song:&#xA;    def __init__(self, title, player):&#xA;        self.title = title  # Lưu trữ ti&#xEA;u đề b&#xE0;i h&#xE1;t ở đ&#xE2;y&#xA;        self.player = player&#xA;&#xA;# Th&#xEA;m đối tượng Song v&#xE0;o h&#xE0;ng đợi&#xA;def add_song_to_queue(guild_id, queues, song):&#xA;    queues.setdefault(guild_id, []).append(song)&#xA;&#xA;async def handle_list(message, queues):&#xA;    log_file_path = "C:\\Bot Music 2\\song_log.txt"&#xA;    if os.path.exists(log_file_path):&#xA;        with open(log_file_path, "r", encoding="utf-8") as f:&#xA;            song_list = f.readlines()&#xA;&#xA;        if song_list:&#xA;            embed = discord.Embed(&#xA;                title="Danh s&#xE1;ch b&#xE0;i h&#xE1;t",&#xA;                description="Danh s&#xE1;ch c&#xE1;c b&#xE0;i h&#xE1;t đ&#xE3; ph&#xE1;t:",&#xA;                color=discord.Color.blue()&#xA;            )&#xA;&#xA;            for i, song in enumerate(song_list, start=1):&#xA;                if i == 1:&#xA;                    song = "- Đang ph&#xE1;t: " &#x2B; song.strip()&#xA;                embed.add_field(name=f"B&#xE0;i h&#xE1;t {i}", value=song, inline=False)&#xA;&#xA;            await message.channel.send(embed=embed)&#xA;        else:&#xA;            await message.channel.send("Hiện kh&#xF4;ng c&#xF3; dữ liệu trong file log.")&#xA;    else:&#xA;        await message.channel.send("File log kh&#xF4;ng tồn tại.")&#xA;&#xA;async def handle_commands(message, client, queues, voice_clients, yt_dl_options, ytdl, ffmpeg_options=None, guild_id=None, data=None):&#xA;    # Nếu kh&#xF4;ng c&#xF3; ffmpeg_options, sử dụng c&#xE1;c thiết lập mặc định&#xA;    if ffmpeg_options is None:&#xA;        ffmpeg_options = {&#xA;            &#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;,&#xA;            &#x27;options&#x27;: &#x27;-vn -filter:a "volume=0.25"&#x27;&#xA;        }&#xA;    &#xA;    # Khởi tạo voice_client&#xA;    if guild_id is None:&#xA;        guild_id = message.guild.id&#xA;&#xA;    if guild_id in voice_clients:&#xA;        voice_client = voice_clients[guild_id]&#xA;    else:&#xA;        voice_client = None&#xA;&#xA;    # Xử l&#xFD; lệnh !play&#xA;    if message.content.startswith("!play"):&#xA;        try:&#xA;            # Kiểm tra xem người gửi tin nhắn c&#xF3; đang ở trong k&#xEA;nh voice kh&#xF4;ng&#xA;            voice_channel = message.author.voice.channel&#xA;            # Kiểm tra xem bot c&#xF3; đang ở trong k&#xEA;nh voice của guild kh&#xF4;ng&#xA;            if voice_client and voice_client.is_connected():&#xA;                await voice_client.move_to(voice_channel)&#xA;            else:&#xA;                voice_client = await voice_channel.connect()&#xA;                voice_clients[guild_id] = voice_client&#xA;        except Exception as e:&#xA;            print(e)&#xA;&#xA;        try:&#xA;            query = &#x27; &#x27;.join(message.content.split()[1:])&#xA;            if query.startswith(&#x27;http&#x27;):&#xA;                url = query&#xA;            else:&#xA;                query = &#x27;ytsearch:&#x27; &#x2B; query&#xA;                loop = asyncio.get_event_loop()&#xA;                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(query, download=False))&#xA;                if not data:&#xA;                    raise ValueError("Kh&#xF4;ng c&#xF3; dữ liệu trả về từ YouTube.")&#xA;                url = data[&#x27;entries&#x27;][0][&#x27;url&#x27;]&#xA;&#xA;            player = FFmpegOpusAudio(url, **ffmpeg_options)&#xA;            # Lấy th&#xF4;ng tin của b&#xE0;i h&#xE1;t mới đang được y&#xEA;u cầu&#xA;            title = data[&#x27;entries&#x27;][0][&#x27;title&#x27;]&#xA;            duration = data[&#x27;entries&#x27;][0][&#x27;duration&#x27;]&#xA;            creator = data[&#x27;entries&#x27;][0][&#x27;creator&#x27;] if &#x27;creator&#x27; in data[&#x27;entries&#x27;][0] else "Unknown"&#xA;            requester = message.author.nick if message.author.nick else message.author.name&#xA;                    &#xA;            # Tạo embed để th&#xF4;ng b&#xE1;o th&#xF4;ng tin b&#xE0;i h&#xE1;t mới&#xA;            embed = discord.Embed(&#xA;                title="Th&#xF4;ng tin b&#xE0;i h&#xE1;t mới",&#xA;                description=f"**B&#xE0;i h&#xE1;t:** *{title}*\n**Thời lượng:** *{duration}*\n**T&#xE1;c giả:** *{creator}*\n**Người y&#xEA;u cầu:** *{requester}*",&#xA;                color=discord.Color.green()&#xA;            )&#xA;            await message.channel.send(embed=embed)&#xA;            &#xA;            # Sau khi lấy th&#xF4;ng tin của b&#xE0;i h&#xE1;t diễn ra, gọi h&#xE0;m log_song_title với title của b&#xE0;i h&#xE1;t&#xA;            # V&#xED; dụ:&#xA;            title = data[&#x27;entries&#x27;][0][&#x27;title&#x27;]&#xA;            await log_song_title(title)&#xA;&#xA;            # Th&#xEA;m v&#xE0;o danh s&#xE1;ch chờ nếu c&#xF3; b&#xE0;i h&#xE1;t đang ph&#xE1;t&#xA;            if voice_client.is_playing():&#xA;                queues.setdefault(guild_id, []).append(player)&#xA;            else:&#xA;                voice_client.play(player)&#xA;                &#xA;        except Exception as e:&#xA;            print(e)&#xA;            &#xA;    if message.content.startswith("!link"):&#xA;            try:&#xA;                voice_client = await message.author.voice.channel.connect()&#xA;                voice_clients[voice_client.guild.id] = voice_client&#xA;            except Exception as e:&#xA;                print(e)&#xA;&#xA;            try:&#xA;                url = message.content.split()[1]&#xA;&#xA;                loop = asyncio.get_event_loop()&#xA;                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=False))&#xA;&#xA;                song = data[&#x27;url&#x27;]&#xA;                player = discord.FFmpegOpusAudio(song, **ffmpeg_options)&#xA;&#xA;                voice_clients[message.guild.id].play(player)&#xA;            except Exception as e:&#xA;                print(e)&#xA;&#xA;    # Xử l&#xFD; lệnh !queue&#xA;    elif message.content.startswith("!queue"):&#xA;        queue = queues.get(guild_id, [])&#xA;        if queue:&#xA;            await message.channel.send("Danh s&#xE1;ch chờ:")&#xA;            for index, item in enumerate(queue, 1):&#xA;                await message.channel.send(f"{index}. {item.title}")&#xA;        else:&#xA;            await message.channel.send("Kh&#xF4;ng c&#xF3; b&#xE0;i h&#xE1;t n&#xE0;o trong danh s&#xE1;ch chờ.")&#xA;&#xA;    # Xử l&#xFD; lệnh !skip&#xA;    elif message.content.startswith("!skip"):&#xA;        try:&#xA;            if voice_client and voice_client.is_playing():&#xA;                voice_client.stop()&#xA;                await play_next_song(guild_id, queues, voice_client, skip=True)&#xA;                await remove_first_line_from_log()&#xA;        except Exception as e:&#xA;            print(e)&#xA;&#xA;    # Xử l&#xFD; c&#xE1;c lệnh như !pause, !resume, !stop&#xA;    elif message.content.startswith("!pause"):&#xA;        try:&#xA;            if voice_client and voice_client.is_playing():&#xA;                voice_client.pause()&#xA;        except Exception as e:&#xA;            print(e)&#xA;&#xA;    elif message.content.startswith("!resume"):&#xA;        try:&#xA;            if voice_client and not voice_client.is_playing():&#xA;                voice_client.resume()&#xA;        except Exception as e:&#xA;            print(e)&#xA;&#xA;    elif message.content.startswith("!stop"):&#xA;        try:&#xA;            if voice_client:&#xA;                voice_client.stop()&#xA;                await voice_client.disconnect()&#xA;                del voice_clients[guild_id]  # X&#xF3;a voice_client sau khi dừng&#xA;        except Exception as e:&#xA;            print(e)&#xA;&#xA;async def log_song_title(title):&#xA;    log_file_path = "C:\\Bot Music 2\\song_log.txt"&#xA;    try:&#xA;        # Kiểm tra xem tệp tin log đ&#xE3; tồn tại chưa&#xA;        if not os.path.exists(log_file_path):&#xA;            # Nếu chưa tồn tại, tạo tệp tin mới v&#xE0; ghi title v&#xE0;o tệp tin đ&#xF3;&#xA;            with open(log_file_path, &#x27;w&#x27;, encoding=&#x27;utf-8&#x27;) as file:&#xA;                file.write(title &#x2B; &#x27;\n&#x27;)&#xA;        else:&#xA;            # Nếu tệp tin log đ&#xE3; tồn tại, mở tệp tin v&#xE0; ch&#xE8;n title v&#xE0;o cuối tệp tin&#xA;            with open(log_file_path, &#x27;a&#x27;, encoding=&#x27;utf-8&#x27;) as file:&#xA;                file.write(title &#x2B; &#x27;\n&#x27;)&#xA;    except Exception as e:&#xA;        print(f"Error logging song title: {e}")&#xA;&#xA;async def remove_first_line_from_log():&#xA;    log_file_path = "C:\\Bot Music 2\\song_log.txt"&#xA;    try:&#xA;        with open(log_file_path, "r", encoding="utf-8") as f:&#xA;            lines = f.readlines()&#xA;        # X&#xF3;a d&#xF2;ng đầu ti&#xEA;n trong list lines&#xA;        lines = lines[1:]&#xA;        with open(log_file_path, "w", encoding="utf-8") as f:&#xA;            for line in lines:&#xA;                f.write(line)&#xA;    except Exception as e:&#xA;        print(f"Error removing first line from log: {e}")&#xA;        &#xA;async def clear_log_file():&#xA;    log_file_path = "C:\\Bot Music 2\\song_log.txt"&#xA;    try:&#xA;        with open(log_file_path, "w", encoding="utf-8") as f:&#xA;            f.truncate(0)&#xA;    except Exception as e:&#xA;        print(f"Error clearing log file: {e}")&#xA;&#xA;&#xA;async def play_next_song(guild_id, queues, voice_client, skip=False):&#xA;    queue = queues.get(guild_id, [])&#xA;    if queue:&#xA;        player = queue.pop(0)&#xA;        voice_client.play(player, after=lambda e: asyncio.run_coroutine_threadsafe(play_next_song(guild_id, queues, voice_client, skip=False), voice_client.loop))&#xA;        if skip:&#xA;            return&#xA;        else:&#xA;            await remove_first_line_from_log()  # X&#xF3;a d&#xF2;ng đầu ti&#xEA;n trong file log&#xA;    elif skip:&#xA;        await remove_first_line_from_log()  # X&#xF3;a d&#xF2;ng đầu ti&#xEA;n trong file log&#xA;        await voice_client.disconnect()&#xA;        del voice_client[guild_id]  # X&#xF3;a voice_client sau khi dừng&#xA;    else:&#xA;        await clear_log_file()  # X&#xF3;a d&#xF2;ng đầu ti&#xEA;n trong file log&#xA;        await voice_client.disconnect()&#xA;        del voice_client[guild_id]  # X&#xF3;a voice_client sau khi dừng&#xA;

    &#xA;

    I have tried asking ChatGPT, Gemini, or Bing, and they always lead me into a loop of errors that cannot be resolved. This error only occurs when the song naturally finishes playing due to its duration. If the song is playing and I use the command !skip, the next song in the queue will play and function normally. I noticed that it seems like if a song ends naturally, the song queue is also cleared immediately. I hope someone can help me with this

    &#xA;

  • Revision 33150 : Essayer de suivre les optimisations de la 2.0.10++ SVN

    23 novembre 2009, par real3t@… — Log

    Essayer de suivre les optimisations de la 2.0.10++ SVN