Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (38)

  • 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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (4277)

  • Transcoding with custom commands using streamio-ffmpeg

    14 avril 2017, par ACIDSTEALTH

    I’m trying to transcode a video file using streamio-ffmpeg with some custom commands, but nothing I try seems to work. I want to transcode the video with the following options :

    ffmpeg -i input.mp4 -vf
       "format=yuv444p,
        drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max,
        drawtext=font='OpenSans-Regular,Sans':text='CUSTOM TEXT':fontcolor=0xFFFFFF:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th,
        format=yuv420p"
    -c:v libx264 -c:a copy -movflags +faststart output.mp4

    I’ve tried the following code combinations without success :

    1. Tried removing the line breaks and converting the command string to an array, following the instructions in the docs.

      video = FFMPEG::Movie.new('input.mp4')
      opts = %w(ffmpeg -i input.mp4 -vf "format=yuv444p, drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='OpenSans-Regular,Sans':text='CUSTOM TEXT':fontcolor=0xFFFFFF:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, format=yuv420p" -c:v libx264 -c:a copy -movflags +faststart output.mp4)
      video.transcode('output.mp4', opts)

      But this yields the error :

      [NULL @ 0x7f962100e200] Unable to find a suitable output format for 'ffmpeg'
      ffmpeg: Invalid argument
      from /Users/ACIDSTEALTH/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
    2. Tried stripping out the input file name and output file name since the gem seems to handle that for you.

      video = FFMPEG::Movie.new('input.mp4')
      opts = %w(-vf "format=yuv444p, drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='OpenSans-Regular,Sans':text='CUSTOM TEXT':fontcolor=0xFFFFFF:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, format=yuv420p")
      video.transcode('output.mp4', opts)

      Which returns this error :

      [NULL @ 0x7fd0a9008c00] Unable to find a suitable output format for 'drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max,'
      drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max,: Invalid argument
      from /Users/ACIDSTEALTH/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
    3. Tried removing the -vf flag and just running everything within the quotation marks.

      video = FFMPEG::Movie.new('input.mp4')
      opts = %w(format=yuv444p, drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='OpenSans-Regular,Sans':text='CUSTOM TEXT':fontcolor=0xFFFFFF:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, format=yuv420p)
      video.transcode('output.mp4', opts)

      This returns another error :

      [NULL @ 0x7fab8101fe00] Unable to find a suitable output format for 'format=yuv444p,'
      format=yuv444p,: Invalid argument
      from /Users/ACIDSTEALTH/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
    4. Tried removing the format arguments since ffmpeg is clearly complaining about those.

      video = FFMPEG::Movie.new('input.mp4')
      opts = %w("drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max, drawtext=font='OpenSans-Regular,Sans':text='CUSTOM TEXT':fontcolor=0xFFFFFF:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th")
      video.transcode('output.mp4', opts)

      Again another error :

      [NULL @ 0x7fc7f880a800] Unable to find a suitable output format for 'drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max,'
      drawbox=y=ih/PHI:color=0x000000@0.4:width=iw:height=48:t=max,: Invalid argument
      from /Users/ACIDSTEALTH/.gem/ruby/2.3.0/gems/streamio-ffmpeg-3.0.2/lib/ffmpeg/transcoder.rb:112:in `validate_output_file'
    5. Tried building a hash from the command string and feeding that into the transcode method.

      video = FFMPEG::Movie.new('input.mp4')
      opts = {
         '-vf' => {
             format: 'yuv444p',
             drawbox: {
                 y: 'ih/PHI', color: '0x000000@0.4', width: 'iw', height: '48', t: 'max'
             },
             drawtext: {
                 font: 'OpenSans-Regular,Sans', text: snap.title, fontcolor: '0xFFFFFF', fontsize: '24', x: '(w-tw)/2', y: '(h/PHI)+th'
             },
             format: 'yuv420p'
         }
      }
      video.transcode('output.mp4', opts)

      I also tried a variation without the -vf flag :

      video = FFMPEG::Movie.new('input.mp4')
      opts = {
         format: 'yuv444p',
         drawbox: {
             y: 'ih/PHI', color: '0x000000@0.4', width: 'iw', height: '48', t: 'max'
         },
         drawtext: {
             font: 'OpenSans-Regular,Sans', text: snap.title, fontcolor: '0xFFFFFF', fontsize: '24', x: '(w-tw)/2', y: '(h/PHI)+th'
         },
         format: 'yuv420p'
      }
      video.transcode('output.mp4', opts)

    These both produced an output.mp4 video file but the output file was unchanged from the input. There was no text overlay.

    Nothing I try seems to work. What am I doing wrong here ?

  • "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 :

    


    import asyncio
import discord
from discord import FFmpegOpusAudio, Embed
import os

async def handle_help(message):
    embed = discord.Embed(
        title="Danh sách lệnh cho Bé Mèo",
        description="Dưới đây là các lệnh mà chủ nhân có thể bắt Bé Mèo phục vụ:",
        color=discord.Color.blue()
    )
    embed.add_field(name="!play", value="Phát một bài hát từ YouTube.", inline=False)
    embed.add_field(name="!pause", value="Tạm dừng bài hát đang phát.", inline=False)
    embed.add_field(name="!resume", value="Tiếp tục bài hát đang bị tạm dừng.", inline=False)
    embed.add_field(name="!skip", value="Chuyển đến bài hát tiếp theo trong danh sách chờ.", inline=False)
    embed.add_field(name="!stop", value="Dừng phát nhạc và cho phép Bé Mèo đi ngủ tiếp.", inline=False)
    # Thêm các lệnh khác theo cùng mẫu trên
    await message.channel.send(embed=embed)

class Song:
    def __init__(self, title, player):
        self.title = title  # Lưu trữ tiêu đề bài hát ở đây
        self.player = player

# Thêm đối tượng Song vào hàng đợi
def add_song_to_queue(guild_id, queues, song):
    queues.setdefault(guild_id, []).append(song)

async def handle_list(message, queues):
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    if os.path.exists(log_file_path):
        with open(log_file_path, "r", encoding="utf-8") as f:
            song_list = f.readlines()

        if song_list:
            embed = discord.Embed(
                title="Danh sách bài hát",
                description="Danh sách các bài hát đã phát:",
                color=discord.Color.blue()
            )

            for i, song in enumerate(song_list, start=1):
                if i == 1:
                    song = "- Đang phát: " + song.strip()
                embed.add_field(name=f"Bài hát {i}", value=song, inline=False)

            await message.channel.send(embed=embed)
        else:
            await message.channel.send("Hiện không có dữ liệu trong file log.")
    else:
        await message.channel.send("File log không tồn tại.")

async def handle_commands(message, client, queues, voice_clients, yt_dl_options, ytdl, ffmpeg_options=None, guild_id=None, data=None):
    # Nếu không có ffmpeg_options, sử dụng các thiết lập mặc định
    if ffmpeg_options is None:
        ffmpeg_options = {
            'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5',
            'options': '-vn -filter:a "volume=0.25"'
        }
    
    # Khởi tạo voice_client
    if guild_id is None:
        guild_id = message.guild.id

    if guild_id in voice_clients:
        voice_client = voice_clients[guild_id]
    else:
        voice_client = None

    # Xử lý lệnh !play
    if message.content.startswith("!play"):
        try:
            # Kiểm tra xem người gửi tin nhắn có đang ở trong kênh voice không
            voice_channel = message.author.voice.channel
            # Kiểm tra xem bot có đang ở trong kênh voice của guild không
            if voice_client and voice_client.is_connected():
                await voice_client.move_to(voice_channel)
            else:
                voice_client = await voice_channel.connect()
                voice_clients[guild_id] = voice_client
        except Exception as e:
            print(e)

        try:
            query = ' '.join(message.content.split()[1:])
            if query.startswith('http'):
                url = query
            else:
                query = 'ytsearch:' + query
                loop = asyncio.get_event_loop()
                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(query, download=False))
                if not data:
                    raise ValueError("Không có dữ liệu trả về từ YouTube.")
                url = data['entries'][0]['url']

            player = FFmpegOpusAudio(url, **ffmpeg_options)
            # Lấy thông tin của bài hát mới đang được yêu cầu
            title = data['entries'][0]['title']
            duration = data['entries'][0]['duration']
            creator = data['entries'][0]['creator'] if 'creator' in data['entries'][0] else "Unknown"
            requester = message.author.nick if message.author.nick else message.author.name
                    
            # Tạo embed để thông báo thông tin bài hát mới
            embed = discord.Embed(
                title="Thông tin bài hát mới",
                description=f"**Bài hát:** *{title}*\n**Thời lượng:** *{duration}*\n**Tác giả:** *{creator}*\n**Người yêu cầu:** *{requester}*",
                color=discord.Color.green()
            )
            await message.channel.send(embed=embed)
            
            # Sau khi lấy thông tin của bài hát diễn ra, gọi hàm log_song_title với title của bài hát
            # Ví dụ:
            title = data['entries'][0]['title']
            await log_song_title(title)

            # Thêm vào danh sách chờ nếu có bài hát đang phát
            if voice_client.is_playing():
                queues.setdefault(guild_id, []).append(player)
            else:
                voice_client.play(player)
                
        except Exception as e:
            print(e)
            
    if message.content.startswith("!link"):
            try:
                voice_client = await message.author.voice.channel.connect()
                voice_clients[voice_client.guild.id] = voice_client
            except Exception as e:
                print(e)

            try:
                url = message.content.split()[1]

                loop = asyncio.get_event_loop()
                data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=False))

                song = data['url']
                player = discord.FFmpegOpusAudio(song, **ffmpeg_options)

                voice_clients[message.guild.id].play(player)
            except Exception as e:
                print(e)

    # Xử lý lệnh !queue
    elif message.content.startswith("!queue"):
        queue = queues.get(guild_id, [])
        if queue:
            await message.channel.send("Danh sách chờ:")
            for index, item in enumerate(queue, 1):
                await message.channel.send(f"{index}. {item.title}")
        else:
            await message.channel.send("Không có bài hát nào trong danh sách chờ.")

    # Xử lý lệnh !skip
    elif message.content.startswith("!skip"):
        try:
            if voice_client and voice_client.is_playing():
                voice_client.stop()
                await play_next_song(guild_id, queues, voice_client, skip=True)
                await remove_first_line_from_log()
        except Exception as e:
            print(e)

    # Xử lý các lệnh như !pause, !resume, !stop
    elif message.content.startswith("!pause"):
        try:
            if voice_client and voice_client.is_playing():
                voice_client.pause()
        except Exception as e:
            print(e)

    elif message.content.startswith("!resume"):
        try:
            if voice_client and not voice_client.is_playing():
                voice_client.resume()
        except Exception as e:
            print(e)

    elif message.content.startswith("!stop"):
        try:
            if voice_client:
                voice_client.stop()
                await voice_client.disconnect()
                del voice_clients[guild_id]  # Xóa voice_client sau khi dừng
        except Exception as e:
            print(e)

async def log_song_title(title):
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        # Kiểm tra xem tệp tin log đã tồn tại chưa
        if not os.path.exists(log_file_path):
            # Nếu chưa tồn tại, tạo tệp tin mới và ghi title vào tệp tin đó
            with open(log_file_path, 'w', encoding='utf-8') as file:
                file.write(title + '\n')
        else:
            # Nếu tệp tin log đã tồn tại, mở tệp tin và chèn title vào cuối tệp tin
            with open(log_file_path, 'a', encoding='utf-8') as file:
                file.write(title + '\n')
    except Exception as e:
        print(f"Error logging song title: {e}")

async def remove_first_line_from_log():
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        with open(log_file_path, "r", encoding="utf-8") as f:
            lines = f.readlines()
        # Xóa dòng đầu tiên trong list lines
        lines = lines[1:]
        with open(log_file_path, "w", encoding="utf-8") as f:
            for line in lines:
                f.write(line)
    except Exception as e:
        print(f"Error removing first line from log: {e}")
        
async def clear_log_file():
    log_file_path = "C:\\Bot Music 2\\song_log.txt"
    try:
        with open(log_file_path, "w", encoding="utf-8") as f:
            f.truncate(0)
    except Exception as e:
        print(f"Error clearing log file: {e}")


async def play_next_song(guild_id, queues, voice_client, skip=False):
    queue = queues.get(guild_id, [])
    if queue:
        player = queue.pop(0)
        voice_client.play(player, after=lambda e: asyncio.run_coroutine_threadsafe(play_next_song(guild_id, queues, voice_client, skip=False), voice_client.loop))
        if skip:
            return
        else:
            await remove_first_line_from_log()  # Xóa dòng đầu tiên trong file log
    elif skip:
        await remove_first_line_from_log()  # Xóa dòng đầu tiên trong file log
        await voice_client.disconnect()
        del voice_client[guild_id]  # Xóa voice_client sau khi dừng
    else:
        await clear_log_file()  # Xóa dòng đầu tiên trong file log
        await voice_client.disconnect()
        del voice_client[guild_id]  # Xóa voice_client sau khi dừng


    


    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

    


  • Understand your visitors by seeing where they click, hover, type and scroll, and replay their actions in a video

    18 mai 2017, par InnoCraft — Plugins

    Hi, this is Mike from InnoCraft, the company of the makers of Piwik Analytics which is used by over 1 million websites and apps in over 150 countries.

    I’m very proud to introduce you to our Heatmap & Session Recording feature which lets you analyze your visitors’ behaviour on a whole new level that was not possible before.

    With Heatmaps you can see where people think something is clickable but it is not, how far down the page do they scroll, whether they see your important buttons and Call To Actions, or even whether you can re-position your page layout to put the important content in more visible places. Both the mouse movements and all clicks are recorded and viewable on these new beautiful heatmap visualisations.

    With Session Recordings, you get to see a video showing exactly what a visitor did on your pages, including all mouse movements, scrolls, text typed in the keyboard, and more. Using these recordings you can improve the usability on your website, replace costly (and less effective) eye tracking sessions, and you can now see exactly what problems your visitors experience or how they behave on your website. This gives new insights and ability to understand what your users think.

    -> Read the rest of the story on the Heatmaps & Session Recordings Marketplace page.

    What does the new Heatmaps reports look like ?

    Here is below just a little preview of the new Heatmaps reports.

    1) Mouse move and Click Heatmaps

    2) A Scroll Heatmap

    What does the new Session Recording look like ?

    You can replay videos of exactly what your users did on your websites including mouse moves, scrolls, typing in forms, and more.

    1) Listing all recorded video sessions

    2) Playing a recorded video session

    Where do I get Heatmaps & Session Recording for Piwik ?

    The new premium plugin is available on the Piwik Marketplace :

    This is a premium plugin for Piwik and comes with our 14 day money back guarantee and 1-click installation & updates (all product updates come for free).

    You can also signup for a free Piwik Cloud-hosted trial to discover the power of Heatmaps & Session Recordings !