Recherche avancée

Médias (91)

Autres articles (39)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

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

  • Discord music bot doesn't play songs

    9 octobre 2023, par Gam3rsCZ

    I have made myself a discord bot that also plays music(it's only for my server so strings with messages are in Czech, but code is in English).
Bot worked a while ago but now it stopped, and I don't know where the problem is

    


    I'm getting these errors : HTTP error 403 Forbidden Server returned 403 Forbidden (access denied) and
C :\Users\Me\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\player.py:711 : RuntimeWarning : coroutine 'music_cog.play_next' was never awaited
self.after(error)
RuntimeWarning : Enable tracemalloc to get the object allocation traceback
[2023-10-09 16:23:47] [INFO ] discord.player : ffmpeg process 17496 successfully terminated with return code of 1.
INFO : ffmpeg process 17496 successfully terminated with return code of 1.

    


    My code is :

    


    import discord
from discord.ext import commands
from yt_dlp import YoutubeDL

class music_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        self.is_playing = False
        self.is_paused = False
        self.current = ""

        self.music_queue = []
        self.YDL_OPTIONS = {"format": "m4a/bestaudio/best", "noplaylist": "True"}
        self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

        self.vc = None

    def search_yt(self, item):
        with YoutubeDL(self.YDL_OPTIONS) as ydl:
            try:
                info = ydl.extract_info("ytsearch:%s" % item, download=False)["entries"][0]
            except Exception:
                return False
        info = ydl.sanitize_info(info)
        url = info['url']
        title = info['title']
        return {'title': title, 'source': url}

    async def play_next(self):
        if len(self.music_queue) > 0:
            self.is_playing = True
            self.current = self.music_queue[0][0]["title"]
            m_url = self.music_queue[0][0]["source"]

            self.music_queue.pop(0)

            await self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e:  self.play_next())
        else:
            self.is_playing = False

    async def play_music(self, ctx):
        try:
            if len(self.music_queue) > 0:
                self.is_playing = True
                m_url = self.music_queue[0][0]["source"]

                if self.vc == None or not self.vc.is_connected():
                    self.vc =  await self.music_queue[0][1].connect()

                    if self.vc == None:
                        await ctx.send("Nepodařilo se připojit do hlasového kanálu.")
                        return
                else:
                    await self.vc.move_to(self.music_queue[0][1])

                self.current = self.music_queue[0][0]["title"]
                self.music_queue.pop(0)

                self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
            else:
                self.is_playing = False

        except:
            print("Something went wrong")
            await ctx.send(content="Něco se pokazilo")

    @commands.command(name="play", help="Plays selected song from YouTube")
    async def play(self, ctx, *args):
        query = " ".join(args)

        voice_channel = ctx.author.voice.channel
        if voice_channel is None:
            await ctx.send("Připojte se do hlasového kanálu!")
        elif self.is_paused:
            self.vc.resume()
        else:
            song = self.search_yt(query)
            if type(song) == type(True):
                await ctx.send("Písničku se nepodařilo stáhnout. Špatný formát, možná jste se pokusili zadat playlist nebo livestream.")
            else:
                await ctx.send("Písnička přidána do řady.")
                self.music_queue.append([song, voice_channel])

                if self.is_playing == False:
                    await self.play_music(ctx)
                    self.is_playing = True

    @commands.command(name="pause", aliases=["p"], help="Pauses the BOT")
    async def pause(self, ctx, *args):
        if self.is_playing:
            self.is_playing = False
            self.is_paused = True
            self.vc.pause()
            await ctx.send(content="Písnička byla pozastavena.")
            
        elif self.is_paused:
            self.is_playing = True
            self.is_paused = False
            self.vc.resume()
            await ctx.send(content="Písnička byla obnovena.")

    @commands.command(name="resume", aliases=["r"], help="Resumes playing")
    async def resume(self, ctx, *args):
        if self.is_paused:
            self.is_paused = False
            self.is_playing = True
            self.vc.resume()
            await ctx.send(content="Písnička byla obnovena.")

    @commands.command(name="skip", aliases=["s"], help="Skips current song")
    async def skip(self, ctx, *args):
        if self.vc != None and self.vc:
            self.vc.stop()
        await self.play_next()
        await ctx.send(content="Písnička byla přeskočena.")

    @commands.command(name="queue", aliases=["q"], help="Displays song queue")
    async def queue(self, ctx, songs=5):
        retval = ""

        for i in range(0, len(self.music_queue)):
            if i > songs: break
            retval += "    " + self.music_queue[i][0]["title"] + "\n"

        if retval != "":
            retval += "```"
            await ctx.send(content=("```Aktuální fronta:\n" + retval))
        else:
            await ctx.send("Řada je prázdná.")

    @commands.command(name="clear", help="Clears the queue")
    async def clear(self, ctx):
        if self.vc != None and self.is_playing:
            self.vc.stop()
        self.music_queue = []
        await ctx.send("Řada byla vymazána.")

    @commands.command(name="leave", aliases=["dc", "disconnect"], help="Disconnects the BOT")
    async def leave(self, ctx):
        self.is_playing = False
        self.is_paused = False

        if self.vc != None:
            return await self.vc.disconnect(), await ctx.send(content="BOT byl odpojen.")

        else:
            return await ctx.send("BOT není nikde připojen.")
   
    @commands.command(name="current", help="Displays the current song")
    async def current(self, ctx):
        current = self.current
        retval = f"```Právě hraje:\n    {current}```"
        if current != "":
            await ctx.send(retval)
        else:
            await ctx.send("Aktuálně nic nehraje.")


    


    I already tried everything I can think of(which isn't a lot because I suck at programming), and also tried searching for some solution on the internet, but nothing worked.

    


  • FFMPEG concat 2 files of different resolution hangs

    6 octobre 2023, par knagode

    I am trying to concat 2 videos of different size and resize it to 426x240 :

    


    ffmpeg -y -i video_1.mp4 -i video_2.mp4 -filter_complex '[0]scale=426:240:force_original_aspect_ratio=decrease,pad=426:240:(ow-iw)/2:(oh-ih)/2,setsar=1[v0];[1]scale=426:240:force_original_aspect_ratio=decrease,pad=426:240:(ow-iw)/2:(oh-ih)/2,setsar=1[v1];[v0][0:a:0][v1][1:a:0]concat=n=2:v=1:a=1[v][a]' -map '[v]' -map '[a]' concatenated_video.mp4


    


    In the output I see :

    


    ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/6.0_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Duration: 00:00:05.76, start: 0.000000, bitrate: 1582 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 640x360 [SAR 1:1 DAR 16:9], 1473 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc. Created on: 08/17/2020.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.3.100 libx264
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 112 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc. Created on: 08/17/2020.
      vendor_id       : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'video_2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Duration: 00:00:16.40, start: 0.000000, bitrate: 383 kb/s
  Stream #1:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 426x240 [SAR 640:639 DAR 16:9], 245 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.3.100 libx264
  Stream #1:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 (h264) -> scale:default
  Stream #0:1 (aac) -> concat
  Stream #1:0 (h264) -> scale:default
  Stream #1:1 (aac) -> concat
  concat -> Stream #0:0 (libx264)
  concat -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[vost#0:0/libx264 @ 0x7fc777006280] Frame rate very high for a muxer not efficiently supporting it.
Please consider specifying a lower framerate, a different muxer or setting vsync/fps_mode to vfr
[libx264 @ 0x7fc777006580] using SAR=1/1
[libx264 @ 0x7fc777006580] MB rate (405000000) > level limit (16711680)
[libx264 @ 0x7fc777006580] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7fc777006580] profile High, level 6.2, 4:2:0, 8-bit
[libx264 @ 0x7fc777006580] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=7 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'concatenated_video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 426x240 [SAR 1:1 DAR 71:40], q=2-31, 1000k tbn
    Metadata:
      encoder         : Lavc60.3.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc60.3.100 aac
[vost#0:0/libx264 @ 0x7fc777006280] More than 1000 frames duplicated  1.1kbits/s speed=4.94x


    


    Process hangs and I see that ffmpeg uses 500% of the CPU. Any idea how to fix (deal with) this ?

    


    I can open both videos on my computer and play them.

    


  • FFmpeg does not encode chapter titles [closed]

    15 octobre 2023, par Shironats

    I am trying to add chapters to a .mp4 file.
When I tried extracting the metadata using the following command :

    


    ffmpeg -i INPUT.mp4 -f ffmetadata FFMETADATAFILE.txt

    


    I got an output file as follows :

    


    ;FFMETADATA1
major_brand=mp42
minor_version=0
compatible_brands=isommp42
encoder=Lavf60.15.100


    


    So now I try to add some chapters as such

    


    [CHAPTER]
TIMEBASE=1/1000
START=0
END=424510
title=mytitle1

[CHAPTER]
TIMEBASE=1/1000
START=424511
END=941600
title=mytitle2

[CHAPTER]
TIMEBASE=1/1000
START=941601
END=1227260
title=mytitle3


    


    I use the ffmpeg -i INPUT.mp4 -i FFMETADATAFILE.txt -map_metadata 1 -codec copy OUTPUT.mp4 command to encode the metadata to my video file, and for some reason I only ever get 'Chapter 0', 'Chapter 1', and 'Chapter 2'.

    


    I tried using the -map_chapters 1 argument as well but results have been unchanged.

    


    I am using the Latest Auto-Build (2023-10-14 13:02) Windows build by BtbN. Thanks in advance for the help.