Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (84)

  • Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur

    8 février 2011, par

    La visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
    Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
    Configuration de la boite multimédia
    Dès (...)

  • 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

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

Sur d’autres sites (5013)

  • ffmpeg error on decode

    25 octobre 2013, par ademar111190

    I'm developing an android app with the libav and I'm trying decode a 3gp with code below :

    #define simbiLog(...) __android_log_print(ANDROID_LOG_DEBUG, "simbiose", __VA_ARGS__)

    ...

    AVCodec *codec;
    AVCodecContext *c = NULL;
    int len;
    FILE *infile, *outfile;
    uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
    AVPacket avpkt;
    AVFrame *decoded_frame = NULL;

    simbiLog("inbuf size: %d", sizeof(inbuf) / sizeof(inbuf[0]));

    av_register_all();
    av_init_packet(&avpkt);

    codec = avcodec_find_decoder(AV_CODEC_ID_AMR_NB);
    if (!codec) {
       simbiLog("codec not found");
       return ERROR;
    }

    c = avcodec_alloc_context3(codec);
    if (!c) {
       simbiLog("Could not allocate audio codec context");
       return ERROR;
    }

    int open = avcodec_open2(c, codec, NULL);
    if (open < 0) {
       simbiLog("could not open codec %d", open);
       return ERROR;
    }

    infile = fopen(inputPath, "rb");
    if (!infile) {
       simbiLog("could not open %s", inputPath);
       return ERROR;
    }

    outfile = fopen(outputPath, "wb");
    if (!outfile) {
       simbiLog("could not open %s", outputPath);
       return ERROR;
    }

    avpkt.data = inbuf;
    avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, infile);
    int iterations = 0;

    while (avpkt.size > 0) {
       simbiLog("iteration %d", (++iterations));
       simbiLog("avpkt.size %d avpkt.data %X", avpkt.size, avpkt.data);
       int got_frame = 0;

       if (!decoded_frame) {
           if (!(decoded_frame = avcodec_alloc_frame())) {
               simbiLog("out of memory");
               return ERROR;
           }
       } else {
           avcodec_get_frame_defaults(decoded_frame);
       }

       //below the error, but it isn't occur on first time, only in 4th loop interation
       len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt);
       if (len < 0) {
           simbiLog("Error while decoding error %d frame %d duration %d", len, got_frame, avpkt.duration);
           return ERROR;
       } else {
           simbiLog("Decoding length %d frame %d duration %d", len, got_frame, avpkt.duration);
       }

       if (got_frame) {
           int data_size = av_samples_get_buffer_size(NULL, c->channels, decoded_frame->nb_samples, c->sample_fmt, 1);
           size_t* fwrite_size = fwrite(decoded_frame->data[0], 1, data_size, outfile);
           simbiLog("fwrite returned %d", fwrite_size);
       }
       avpkt.size -= len;
       avpkt.data += len;
       if (avpkt.size < AUDIO_REFILL_THRESH) {
           memmove(inbuf, avpkt.data, avpkt.size);
           avpkt.data = inbuf;
           len = fread(avpkt.data + avpkt.size, 1, AUDIO_INBUF_SIZE - avpkt.size, infile);
           if (len > 0)
               avpkt.size += len;
           simbiLog("fread returned %d", len);
       }
    }

    fclose(outfile);
    fclose(infile);

    avcodec_close(c);
    av_free(c);
    av_free(decoded_frame);

    but I'm getting the follow log and error :

    inbuf size: 20488
    iteration 1
    avpkt.size 3305 avpkt.data BEEED40C
    Decoding length 13 frame 1 duration 0
    fwrite returned 640
    fread returned 0
    iteration 2
    avpkt.size 3292 avpkt.data BEEED40C
    Decoding length 13 frame 1 duration 0
    fwrite returned 640
    fread returned 0
    iteration 3
    avpkt.size 3279 avpkt.data BEEED40C
    Decoding length 14 frame 1 duration 0
    fwrite returned 640
    fread returned 0
    iteration 4
    avpkt.size 3265 avpkt.data BEEED40C
    Error while decoding error -1052488119 frame 0 duration 0

    the audio file I'm trying decode :

    $ avprobe blue.3gp
    avprobe version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2007-2013 the Libav developers
     built on Mar 30 2013 22:23:21 with gcc 4.7.2
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'blue.3gp':
     Metadata:
       major_brand     : 3gp4
       minor_version   : 0
       compatible_brands: isom3gp4
       creation_time   : 2013-09-19 18:53:38
     Duration: 00:00:01.52, start: 0.000000, bitrate: 17 kb/s
       Stream #0.0(eng): Audio: amrnb, 8000 Hz, 1 channels, flt, 12 kb/s
       Metadata:
         creation_time   : 2013-09-19 18:53:38

    thanks a lot !


    EDITED

    I read on ffmper documentation about the method avcodec_decode_audio4 the follow :

    @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end.
    @note You might have to align the input buffer. The alignment requirements depend on the CPU and the decoder.

    and I see here a solution using posix_memalign, to android i founded a similar method called memalign, so i did the change :

    removed :

    uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];

    inserted :

    int inbufSize = sizeof(uint8_t) * (AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
    uint8_t *inbuf = memalign(FF_INPUT_BUFFER_PADDING_SIZE, inbufSize);
    simbiLog("inbuf size: %d", inbufSize);
    for (; inbufSize >= 0; inbufSize--)
       simbiLog("inbuf position: %d index: %p", inbufSize, &inbuf[inbufSize]);

    I'm getting the correct memory sequence position, but the error not changed.

    A piece of outpout :

    inbuf position: 37 index: 0x4e43d745
    inbuf position: 36 index: 0x4e43d744
    inbuf position: 35 index: 0x4e43d743
    inbuf position: 34 index: 0x4e43d742
    inbuf position: 33 index: 0x4e43d741
    inbuf position: 32 index: 0x4e43d740
    inbuf position: 31 index: 0x4e43d73f
    inbuf position: 30 index: 0x4e43d73e
    inbuf position: 29 index: 0x4e43d73d
    inbuf position: 28 index: 0x4e43d73c
    inbuf position: 27 index: 0x4e43d73b
    inbuf position: 26 index: 0x4e43d73a
    inbuf position: 25 index: 0x4e43d739
    inbuf position: 24 index: 0x4e43d738
    inbuf position: 23 index: 0x4e43d737
    inbuf position: 22 index: 0x4e43d736
    inbuf position: 21 index: 0x4e43d735
    inbuf position: 20 index: 0x4e43d734
    inbuf position: 19 index: 0x4e43d733
  • avformat/movenc : Fix flush fragment

    22 mai, par Zhao Zhili
    avformat/movenc : Fix flush fragment
    

    The follow cmd output corrupted file before the patch :

    ffmpeg -f lavfi -i color=blue,trim=duration=0.04 \
    -f lavfi -i anullsrc,atrim=duration=2 \
    -movflags +empty_moov+hybrid_fragmented \
    -frag_duration 1000000 \
    -frag_interleave 1 \
    output.mp4

    1. first_track is the first track with track->entry != 0. As in the
    command above, video track (track index 0) has a single frame. When
    flush the second fragment, first_track is 1, the audio track.

    2. write_moof = i == first_track, so write_moof is false for i = 0.

    3. When mov->frag_interleave != 0, mov->mdat_buf != NULL, because
    it contains audio data. So avio_write is called before write_moof,
    that is, the data write before moof, and mov_finish_fragment
    executed with wrong mdat_start.

    4. With normal fmp4 output, the error isn't obvious. With
    hybrid_fragmented, ffplay output.mp4 shows a lot of error messages.

    Signed-off-by : Zhao Zhili <zhilizhao@tencent.com>

    • [DH] libavformat/movenc.c
    • [DH] tests/fate/mov.mak
  • Hello ! I have a little problem with my discord.py music bot

    5 mars 2021, par Luca M. Schmidt

    i'm rather new/unexpierience with youtube-dl and python. The thing i'm triying to do is to add a queue system to my music cog. When possible it should be able to add songs and start the next song after the first one ended as well. You dont need to provide the complete code for it, tryingt to explain how it should work and giving some tipps should be enought. If more information is needed, feel free to ask. Thx for helping.

    &#xA;

    My Code (Stripped down a bit) :

    &#xA;

    # IMPORT&#xA;&#xA;&#xA;import discord&#xA;from discord.ext import commands&#xA;import json&#xA;import asyncio&#xA;import youtube_dl&#xA;&#xA;&#xA;&#xA;# LOKALE_VARIABLEN&#xA;&#xA;&#xA;ytdl_format_options = {&#xA;    &#x27;format&#x27;: &#x27;bestaudio/best&#x27;,&#xA;    &#x27;outtmpl&#x27;: &#x27;%(extractor)s-%(id)s-%(title)s.%(ext)s&#x27;,&#xA;    &#x27;restrictfilenames&#x27;: True,&#xA;    &#x27;noplaylist&#x27;: True,&#xA;    &#x27;nocheckcertificate&#x27;: True,&#xA;    &#x27;ignoreerrors&#x27;: False,&#xA;    &#x27;logtostderr&#x27;: False,&#xA;    &#x27;quiet&#x27;: True,&#xA;    &#x27;no_warnings&#x27;: True,&#xA;    &#x27;default_search&#x27;: &#x27;auto&#x27;,&#xA;    &#x27;source_address&#x27;: &#x27;0.0.0.0&#x27;&#xA;}&#xA;&#xA;ffmpeg_options = {&#xA;    &#x27;options&#x27;: &#x27;-vn&#x27;&#xA;}&#xA;&#xA;ytdl = youtube_dl.YoutubeDL(ytdl_format_options)&#xA;&#xA;songs = asyncio.Queue()&#xA;play_next_song = asyncio.Event()&#xA;&#xA;&#xA;# ----&#xA;&#xA;class YTDLSource(discord.PCMVolumeTransformer):&#xA;    def __init__(self, source, *, data, volume=0.5):&#xA;        super().__init__(source, volume)&#xA;&#xA;        self.data = data&#xA;&#xA;        self.title = data.get(&#x27;title&#x27;)&#xA;        self.url = data.get(&#x27;url&#x27;)&#xA;        self.thumbnail = data.get(&#x27;thumbnail&#x27;)&#xA;&#xA;&#xA;    @classmethod&#xA;    async def from_url(cls, url, *, loop=None, stream=False):&#xA;        loop = loop or asyncio.get_event_loop()&#xA;        data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))&#xA;&#xA;        if &#x27;entries&#x27; in data:&#xA;            data = data[&#x27;entries&#x27;][0]&#xA;&#xA;        filename = data[&#x27;url&#x27;] if stream else ytdl.prepare_filename(data)&#xA;        return cls(discord.FFmpegPCMAudio(filename, **ffmpeg_options), data=data)&#xA;&#xA;&#xA;# COG_SETUP(START)&#xA;&#xA;&#xA;class Music(commands.Cog):&#xA;&#xA;    def __init__(self, client):&#xA;        self.client = client&#xA;&#xA;&#xA;    @commands.command()&#xA;    async def join(self, ctx, *, channel: discord.VoiceChannel):&#xA;&#xA;        if ctx.voice_client is not None:&#xA;            return await ctx.voice_client.move_to(channel)&#xA;&#xA;        await channel.connect()&#xA;&#xA;    @commands.command()&#xA;    @commands.cooldown(1, 10, commands.BucketType.user)&#xA;    async def play(self, ctx, *, url):&#xA;&#xA;        try:&#xA;&#xA;            async with ctx.typing():&#xA;                player = await YTDLSource.from_url(url, loop=self.client.loop, stream=True)&#xA;            ctx.voice_client.play(player, after=lambda e: print(&#x27;Player error: %s&#x27; % e) if e else None)&#xA;&#xA;        except:&#xA;            embed = discord.Embed(&#xA;                title=&#x27;Fehler!&#x27;,&#xA;                colour=discord.Colour.red(),&#xA;                description=&#x27;Dies ist eine nicht Unterst&#xFC;tzte URL!&#x27;&#xA;            )&#xA;&#xA;            return await ctx.send(embed=embed)&#xA;&#xA;        embed = discord.Embed(&#xA;            title=&#x27;&#x27;,&#xA;            colour=discord.Colour.blue(),&#xA;            description=f&#x27;[{format(player.title)}]({player.url})&#x27;&#xA;        )&#xA;        embed.set_author(name=&#x27;Spielt gerade:&#x27;)&#xA;        embed.set_image(url=player.thumbnail)&#xA;        embed.set_footer(text=f&#x27;Hinzugef&#xFC;gt von: {ctx.author.name}&#x27;, icon_url=ctx.author.avatar_url)&#xA;&#xA;&#xA;        await ctx.send(embed=embed)&#xA;&#xA;&#xA;&#xA;&#xA;    @commands.command()&#xA;    async def volume(self, ctx, volume: int):&#xA;&#xA;        if ctx.voice_client is None:&#xA;&#xA;            embed = discord.Embed(&#xA;                title=&#x27;Fehler!&#x27;,&#xA;                colour=discord.Colour.red(),&#xA;                description=&#x27;Ich bin mit keinem Sprachkanal verbunden!&#x27;&#xA;            )&#xA;&#xA;            return await ctx.send(embed=embed)&#xA;&#xA;        elif ctx.voice_client is not None:&#xA;&#xA;            if volume in range(0, 201):&#xA;                try:&#xA;                    ctx.voice_client.source.volume = volume / 100&#xA;&#xA;                    embed = discord.Embed(&#xA;                        title=&#x27;Lautst&#xE4;rke&#x27;,&#xA;                        colour=discord.Colour.blue(),&#xA;                        description=f&#x27;Lautst&#xE4;rke auf **{format(volume)}**% gestellt.&#x27;&#xA;                    )&#xA;                    embed.set_footer(text=f"Angepasst von: {ctx.author.name}", icon_url=ctx.author.avatar_url)&#xA;&#xA;                    return await ctx.send(embed=embed)&#xA;                except:&#xA;                    pass&#xA;&#xA;            else:&#xA;&#xA;                embed = discord.Embed(&#xA;                    title=&#x27;Fehler!&#x27;,&#xA;                    colour=discord.Colour.red(),&#xA;                    description=&#x27;Das ist Lauter, als die Musik geht!&#x27;&#xA;                )&#xA;&#xA;                return await ctx.send(embed=embed)&#xA;&#xA;    @commands.command()&#xA;    async def stop(self, ctx):&#xA;        try:&#xA;&#xA;            await ctx.voice_client.disconnect()&#xA;            await ctx.message.delete()&#xA;&#xA;        except:&#xA;            pass&#xA;&#xA;    @commands.command()&#xA;    async def pause(self, ctx):&#xA;&#xA;        if ctx.voice_client.is_playing():&#xA;&#xA;            ctx.voice_client.pause()&#xA;            await ctx.message.delete()&#xA;            return&#xA;&#xA;        else:&#xA;&#xA;            embed = discord.Embed(&#xA;                title=&#x27;Fehler!&#x27;,&#xA;                colour=discord.Colour.red(),&#xA;                description=&#x27;Es spielt keine Musik!&#x27;&#xA;            )&#xA;&#xA;            return await ctx.send(embed=embed)&#xA;&#xA;    @commands.command()&#xA;    async def resume(self, ctx):&#xA;&#xA;        if ctx.voice_client.is_paused():&#xA;&#xA;            ctx.voice_client.resume()&#xA;            await ctx.message.delete()&#xA;            return&#xA;&#xA;        else:&#xA;&#xA;            embed = discord.Embed(&#xA;                title=&#x27;Fehler!&#x27;,&#xA;                colour=discord.Colour.red(),&#xA;                description=&#x27;Es wurde keine Musik pausiert, darum kann ich auch nichts fortsetzen!&#x27;&#xA;            )&#xA;&#xA;            return await ctx.send(embed=embed)&#xA;&#xA;    @resume.before_invoke&#xA;    @play.before_invoke&#xA;    async def ensure_voice(self, ctx):&#xA;        if ctx.voice_client is None:&#xA;            if ctx.author.voice:&#xA;                try:&#xA;&#xA;                    await ctx.author.voice.channel.connect()&#xA;&#xA;                except commands.CommandError:&#xA;                    embed = discord.Embed(&#xA;                        title=&#x27;Fehler!&#x27;,&#xA;                        colour=discord.Colour.red(),&#xA;                        description=&#x27;Du bist nicht mit einem Sprachkanal verbunden!&#x27;&#xA;                    )&#xA;&#xA;                    await ctx.send(embed=embed)&#xA;&#xA;        elif ctx.voice_client.is_playing():&#xA;            ctx.voice_client.stop()&#xA;&#xA;&#xA;# COG_SETUP(END)&#xA;&#xA;&#xA;def setup(client):&#xA;    client.add_cog(Music(client))&#xA;&#xA;

    &#xA;