Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (112)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • 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 ;

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

Sur d’autres sites (5106)

  • Use Static Library Build Shared Library Undefined Reference

    26 mai 2020, par Leo

    I want to use AndroidStudio ndk-build to build Shared Library on Window with ffmpeg lib but i got Undefined Reference Error,Please tell me what I do wrong

    



    ndkVersion = 21.0.6113669
compileSdkVersion 29

    



    I also try to build By GCC , the same error happen
I also try to build By CMake with ffmpeg SourceCode , the same error happen

    



    I try to build .a file with some simple C Code on gcc and use another C Code to use it,it work,but not with ffmpeg .a file i dont know why

    



    this is my Android.mk

    



    `LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 LOCAL_MODULE := avcodec
 LOCAL_SRC_FILES := lib/libavcodec.dll.a
 include $(PREBUILT_STATIC_LIBRARY)

 include $(CLEAR_VARS)
 LOCAL_MODULE := avformat
 LOCAL_SRC_FILES := lib/libavformat.dll.a
 include $(PREBUILT_STATIC_LIBRARY)

 ...

 include $(CLEAR_VARS)
 LOCAL_MODULE := avutil
 LOCAL_SRC_FILES := lib/libavutil.dll.a
 include $(PREBUILT_STATIC_LIBRARY)

 include $(CLEAR_VARS)
 LOCAL_MODULE := libTestDll
 LOCAL_SRC_FILES := TestDll.cpp
 LOCAL_C_MODULE := avcodec avformat swscale avutil avfilter avdevice

 include $(BUILD_SHARED_LIBRARY)`


    



    this is my main cpp

    



    #include &#xA;#include &#xA;&#xA;#define __STDC_CONSTANT_MACROS&#xA;&#xA;#include <string>&#xA;&#xA;extern"C"&#xA;{&#xA;#include "libavformat/avformat.h"&#xA;#include "libavutil/mathematics.h"&#xA;#include "libavutil/time.h"&#xA;#include "libavutil/pixfmt.h"&#xA;#include "libavcodec/avcodec.h"&#xA;#include "libavformat/avformat.h"&#xA;#include "libswscale/swscale.h"&#xA;#include "libavutil/imgutils.h"&#xA;}&#xA;&#xA;using namespace std;&#xA;&#xA;char output[99999];&#xA;int frameCount = 0;&#xA;uint8_t* buf;&#xA;int bufLength;&#xA;uint8_t* p_global_bgr_buffer;&#xA;int num_bytes;&#xA;int wrap;&#xA;bool EndReceFrame = false;&#xA;SwsContext* swsContext;&#xA;AVFrame* pFrame = av_frame_alloc();&#xA;AVCodecContext* pCodecContext;&#xA;AVPixelFormat dstFmt = AV_PIX_FMT_RGB24;&#xA;&#xA;static void BGRpgm_save(AVFrame* frame)&#xA;{&#xA;    int linesize[8] = { frame->linesize[0] * 3 };&#xA;&#xA;    uint8_t* bgr_buffer[8] = { p_global_bgr_buffer };&#xA;&#xA;    sws_scale(swsContext, frame->data, frame->linesize, 0, frame->height, bgr_buffer, linesize);&#xA;&#xA;    memcpy(buf, bgr_buffer[0], linesize[0] * frame->height);&#xA;&#xA;    bufLength = linesize[0] * frame->height;&#xA;&#xA;    frameCount&#x2B;&#x2B;;&#xA;&#xA;}&#xA;...&#xA;&#xA;</string>

    &#xA;&#xA;

    Error Message

    &#xA;&#xA;

    [x86] SharedLibrary  : libTestDll.so&#xA;jni/TestDll.cpp:123: error: undefined reference to &#x27;avformat_open_input&#x27;&#xA;jni/TestDll.cpp:127: error: undefined reference to &#x27;avformat_find_stream_info&#x27;&#xA;jni/TestDll.cpp:138: error: undefined reference to &#x27;av_dump_format&#x27;&#xA;jni/TestDll.cpp:144: error: undefined reference to &#x27;avcodec_find_decoder&#x27;&#xA;jni/TestDll.cpp:146: error: undefined reference to &#x27;avcodec_alloc_context3&#x27;&#xA;

    &#xA;

  • discord.py music bot slowing down for longer audio queries

    1er janvier 2023, par Bobluge

    So I'm trying to make a music bot with discord.py. Shown below is a minimum working example of the bot with the problematic functions :

    &#xA;

    import os&#xA;&#xA;import discord&#xA;from discord.ext import commands&#xA;from discord import player as p&#xA;&#xA;import yt_dlp as youtube_dl&#xA;&#xA;intents = discord.Intents.default()&#xA;intents.members = True&#xA;&#xA;bot = commands.Bot(command_prefix=&#x27;;&#x27;)&#xA;&#xA;class Music(commands.Cog):&#xA;    def __init__(self, bot):&#xA;        self.bot = bot&#xA;        self.yt-dlp_opts = {&#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;playlistend&#x27;: 1,&#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;, # bind to ipv4 since ipv6 addresses cause issues sometimes&#xA;        }&#xA;        self.ffmpeg_opts = {&#xA;            &#x27;options&#x27;: &#x27;-vn&#x27;,&#xA;            # Source: https://stackoverflow.com/questions/66070749/&#xA;            "before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5",&#xA;        }&#xA;        self.cur_stream = None&#xA;        self.cur_link = None&#xA;&#xA;    @commands.command(aliases=["p"])&#xA;    async def play(self, ctx, url):&#xA;        yt-dlp = youtube_dl.YoutubeDL(self.ytdl_opts)&#xA;        data = yt-dlp.extract_info(url, download=False)&#xA;        filename = data[&#x27;url&#x27;]  # So far only works with links&#xA;        print(filename)&#xA;        audio = p.FFmpegPCMAudio(filename, **self.ffmpeg_opts)&#xA;        self.cur_stream = audio&#xA;        self.cur_link = filename&#xA;&#xA;        # You must be connected to a voice channel first&#xA;        await ctx.author.voice.channel.connect()&#xA;        ctx.voice_client.play(audio)&#xA;        await ctx.send(f"now playing")&#xA;&#xA;    @commands.command(aliases=["ff"])&#xA;    async def seek(self, ctx):&#xA;        """&#xA;        Fast forwards 10 seconds&#xA;        """&#xA;        ctx.voice_client.pause()&#xA;        for _ in range(500):&#xA;            self.cur_stream.read()  # 500*20ms of audio = 10000ms = 10s&#xA;        ctx.voice_client.resume()&#xA;&#xA;        await ctx.send(f"fast forwarded 10 seconds")&#xA;&#xA;    @commands.command(aliases=["j"])&#xA;    async def jump(self, ctx, time):&#xA;        """&#xA;        Jumps to a time in the song, input in the format of HH:MM:SS&#xA;        """&#xA;        ctx.voice_client.stop()&#xA;        temp_ffempg = {&#xA;            &#x27;options&#x27;: &#x27;-vn&#x27;,&#xA;            # Keyframe skipping when passed as an input option (fast)&#xA;            "before_options": f"-ss {time} -reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5",&#xA;        }&#xA;        new_audio = p.FFmpegPCMAudio(self.cur_link, **temp_ffempg)&#xA;        self.cur_stream = new_audio&#xA;        ctx.voice_client.play(new_audio)&#xA;        await ctx.send(f"skipped to {time}")&#xA;&#xA;&#xA;bot.add_cog(Music(bot))&#xA;bot.run(os.environ["BOT_TOKEN"])&#xA;

    &#xA;

    My requirements.txt file :

    &#xA;

    discord.py[voice]==1.7.3&#xA;yt-dlp==2021.9.2&#xA;

    &#xA;

    To play a song in Discord the following format is used :

    &#xA;

    ;p &#xA;

    &#xA;

    Where is any link that yt-dlp supports. Under normal circumstances, the ;p command is used with songs that are relatively short, to which seek() and jump() work extremely quickly to do what they are supposed to do. For example if I execute these sequence of commands in Discord :

    &#xA;

    ;p https://www.youtube.com/watch?v=n8X9_MgEdCg  &lt;- 4 min song&#xA;

    &#xA;

    And when the bot starts playing, spam the following :

    &#xA;

    ;ff&#xA;;ff&#xA;;ff&#xA;;ff&#xA;;ff&#xA;

    &#xA;

    The bot is able to almost instantly seek five 10-second increments of the song. Additionally, I can jump to the three minute mark very quickly with :

    &#xA;

    ;j 00:03:00&#xA;

    &#xA;

    From some experimentation, the seek() and jump() functions seem to work quickly for songs that are under 10 minutes. If I try the exact same sequence of commands but with a 15 minute song like https://www.youtube.com/watch?v=Ks9Ck5LfGWE or longer https://www.youtube.com/watch?v=VThrx5MRJXA (10 hours classical music), there is an evident slowdown when running the ;ff command. However, when I include a few seconds of delay between firings of the ;ff command, the seeking is just as fast as previously mentioned. I'm not exactly sure what is going on with yt-dlp/FFmpeg behind the scenes when streaming, but I speculate that there is some sort of internal buffer, and songs that pass a certain length threshold are processed differently.

    &#xA;

    For longer songs, the seek() command takes longer to get to the desired position, which makes sense since this site specifies that -ss used as an input option loops through keyframes (as there must be more keyframes in longer songs). However, if the following commands are run in Discord :

    &#xA;

    ;p https://www.youtube.com/watch?v=VThrx5MRJXA  &lt;- 10 hour classical music&#xA;;j 09:00:00                                     &lt;- jump to 9 hour mark&#xA;;j 00:03:00                                     &lt;- jump to 3 minute mark&#xA;

    &#xA;

    The first seek command takes around 5 to 10 seconds to perform a successful seek, which isn't bad, but it could be better. The second seek command takes around the same time as the first command, which doesn't make sense to me, because I thought less keyframes were skipped in order to reach the 3 minute mark.

    &#xA;

    So I'm wondering what's going on, and how to potentially solve the following :

    &#xA;

      &#xA;
    • What is actually going on with the seek() command ? My implementation of seek() uses discord.py's discord.player.FFmpegPCMAudio.read() method, which apparently runs slower if the song's length is longer ? Why ?
    • &#xA;

    • Why does input seeking for long YouTube videos take almost the same time no matter where I seek to ?
    • &#xA;

    • How the yt-dlp and FFmpeg commands work behind the scenes to stream a video from YouTube (or any other website that YTDL supports). Does yt-dlp and FFmpeg behave differently for audio streams above a certain length threshold ?
    • &#xA;

    • Potential ways to speed up seek() and jump() for long songs. I recall some well-known discord music bots were able to do this very quickly.
    • &#xA;

    &#xA;

  • FFMPEG Combining images to video and streaming in one command line

    12 juillet 2017, par Brindha Kanniah

    Currently, using ffmpeg, I am using two commands on my Terminal to :

    1) create a video from a bunch of images :

    ffmpeg -r 60 -f image2 -s 1920x1080 -i rotated-pano_frame%05d_color_corrected_gradblend.jpg -vcodec libx264 -crf 25 -pix_fmt yuv420p test.mp4

    2) stream the video to a udp address :

    ffmpeg -re -i test.mp4 -c copy -f flv udp://127.0.0.1:48550

    How can I combine these two commands, into one single ffmpeg command ?

    A concern I have is that it takes a couple of minutes to generate the video from the images. Therefore, these commands have to happen serially, whereby the second command waits a few minutes for the first command to be completed, before it ensues.