Recherche avancée

Médias (0)

Mot : - Tags -/api

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (51)

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

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (7661)

  • Fluent-ffmpeg randomly doesn't add the text I want to the video, even though it's in the filters

    15 décembre 2022, par ToborWinner

    I am making a simple script to add some text to a 4 seconds video, it all works fine, but sometimes it randomly doesn't add some of the text.
You can find here the relevant parts of my code :

    


    
const video = ffmpeg('path/to/video.mp4')

let index = 0
let left = true

const filters = [{
  filter: 'drawtext',
  options: {
    //fontfile:'font.ttf',
    text: title,
    fontsize: 30,
    fontcolor: 'white',
    x: '(main_w/2-text_w/2)',
    y: 130,
    shadowcolor: 'black',
    shadowx: 2,
    shadowy: 2
  }
}]

for (let thought of thoughts) {
    if (thought.length == 0) {
      continue
    }
    thought = wrap(thought, {width: 35})
    const strings = thought.split("\n")
    let line = 0
    for (const string of strings
      .filter(string => string.length > 0)
      .map(string => string.trim())
      ) {
      let yoffset = 130+(130*(index+1))+(line*20)
      if (yoffset < 0) {
        yoffset = 0
      }
      console.log(string, yoffset)
      filters.push({
        filter: 'drawtext',
        options: {
          //fontfile:'font.ttf',
          text: string,
          fontsize: 18,
          fontcolor: 'white',
          x: `(main_w${left ? "*0.3" : "*0.7"}-text_w/2)`,
          y: yoffset,
          shadowcolor: 'black',
          shadowx: 2,
          shadowy: 2
        }
      })
      line++;
    }
    index++;
    left = !left
  }


video.videoFilters(filters)
video.noAudio()


video.save('path/to/output.mp4');



    


    The wrap function comes from the package word-wrap (const wrap = require('word-wrap');)
Thoughts is a list of strings that aren't too long (with the wrap function they end up being like 2-4 lines).

    


    This is inside an async function.

    


    For some reason only a few lines appear on the output video.
Sometimes, when it doesn't do that, it also throws an error saying that one of the inputs is invalid (while processing filters).
The wrap function seems to work, and also the yoffset, I have printed them.

    


    If someone has an idea why, please help me solve this.

    


    I tried chasing the text in thoughts, and for example, this works with no problems (shows the title, and the texts right, left, right, left, ...).

    


    const thoughts = ["Nothing is on fire, fire is on things","Nothing is on fire, fire is on things","Nothing is on fire, fire is on things","Nothing is on fire, fire is on things","Nothing is on fire, fire is on things"]


    


  • Small discord bot with a set of working music commands, about 6 days ago the play function completely stopped functioning (more below)

    24 février 2021, par TheColoradoKid

    It is a small discord python bot for my server with various features, which had included music commands until they stopped out of the blue without showing any error for the problem.
It uses FFMpeg, and youtubeDl along with pytube to gather the song and store it locally to play it, I have pip updated all of these and they are definitely on the current versions as I have made sure of this online.
Any help or insight anyone could provide would be greatly appreciated. I'm sorry if the code is convoluted in the way it's written I'm still pretty new to coding and this is one of my first proper larger projects.

    


    If you need any information I'm happy to give what I can to help.

    


    Here is the code for the play command :

    


    @client.command()
async def play(ctx, *args):
    global queu
    #global autom
    if not args:
        voice = get(client.voice_clients, guild=ctx.guild)
        if not voice.is_playing():
            server = ctx.message.guild
            voice_channel = server.voice_client
            if queu:
                async with ctx.typing():
                    player = await YTDLSource.from_url(queu[0], loop=client.loop)
                    voice_channel.play(player, after=lambda e: print('Player error: %s' % e) if e else None)

                await ctx.send('**Now playing:** {}'.format(player.title))
                del(queu[0])
                # while autom == True:
                #     try:
                #         a = client.get_command('auto')
                #         await ctx.invoke(a)
                #     except:
                #         print('')
            elif not queu:
                await ctx.send("You can't play if there isn't anything in the queue\nIf auto mode was on it has now been disabled, to use it gain please add to the queue and run ``;auto on``")
                autom = False
    if args:
        global gueu
        search_keywords = ""
        print(args)
        for word in args:
            search_keywords += word
            search_keywords += '+'
        link = "https://www.youtube.com/results?search_query="
        link += search_keywords
        #print(link)
        html = urllib.request.urlopen(link)
        video_ids = re.findall(r"watch\?v=(\S{11})", html.read().decode())
        url = ("https://www.youtube.com/watch?v=" + video_ids[0])
        #print(url)
        queu.append(url)
        #print(queu)
        await ctx.send("``{}`` added to queue!\n If the song doesn't start please either let the current song end and run ``;play``/``;next`` again or run ``;next`` to play now".format(url))
        try:
            p = client.get_command('play')
            await ctx.invoke(p)
        except:
            print('failed')


    


  • Error in Splitting Educational Videos into Segments Using Python (ffmpeg issue) [closed]

    28 décembre 2024, par Yahia Mohamed Hanbal

    I created a Python project to split long educational videos into smaller segments, each focused on a single question. The program uses OCR to detect text on video frames, identifies the word "Question," extracts the number following it, and splits the video whenever the number increases.

    


    here is the video i am tring to split ((video))

    


    Here’s an example of the program’s output :

    


    Video loaded: 14071 frames at 60 FPS, duration: 234.52s  
Frame 480, Time 8.00s, Question: 6  
...  
Frame 12360, Time 206.00s, Question: 7  
Creating segment 1: 8.00s to 206.00s  
Error: module 'ffmpeg' has no attribute 'Error'


    


    I’ve shared the full code in a GitHub repository for reference : Automated Video Scene Cutting.

    


    What the Program Does

    


      

    • Input : A long educational video.
    • 


    • Processing :

        

      • Detects text in each frame using OCR.
      • 


      • Searches for the word "Question" followed by a number.
      • 


      • Monitors when the number increases to identify segment boundaries.
      • 


      


    • 


    • Output : Creates video segments corresponding to individual questions.
    • 


    


    The Problem

    


    The program detects the questions and timestamps correctly, but when it tries to create the segments, I encounter the following error :

    


    Error: module 'ffmpeg' has no attribute 'Error'


    


    What I’ve Tried

    


      

    • Verified the ffmpeg-python library is installed (pip show ffmpeg-python confirms the installation).
    • 


    • Ensured the ffmpeg binary is accessible from the command line.
    • 


    • Reviewed the library documentation to ensure the correct usage of ffmpeg.
    • 


    • Tested with different video files to rule out input-specific issues.
    • 


    


    Environment Details

    


      

    • OS : Windows 11
    • 


    • Python Version : 3.9.13
    • 


    • Key Libraries : ffmpeg-python
    • 


    


    If anyone has insights into resolving this issue or suggestions for alternative approaches to handle this use case, I’d greatly appreciate your help.

    


    Thank you !