Recherche avancée

Médias (91)

Autres articles (112)

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

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

Sur d’autres sites (11355)

  • Show progress bar of a ffmpeg video convertion

    13 juin 2022, par stackexchange.com-upvm25mz

    I'm trying to print a progress bar while executing ffmpeg but I'm having trouble getting the total number of frames and the current frame being processed. The error I get is AttributeError: 'NoneType' object has no attribute 'groups'. I've copied the function from this program and for some reason it works there but not here, even though I haven't changed that part.

    


    main.py

    


    pattern_duration = re.compile(
    'duration[ \t\r]?:[ \t\r]?(.+?),[ \t\r]?start', re.IGNORECASE)
pattern_progress = re.compile('time=(.+?)[ \t\r]?bitrate', re.IGNORECASE)

def execute_ffmpeg(self, manager, cmd):
    proc = expect.spawn(cmd, encoding='utf-8')
    self.update_progress_bar(proc, manager)
    self.raise_ffmpeg_error(proc)

def update_progress_bar(self, proc, manager):
    total = self.get_total_frames(proc)
    cont = 0
    pbar = self.initialize_progress_bar(manager)
    try:
        proc.expect(pattern_duration)
        while True:
            progress = self.get_current_frame(proc)
            percent = progress / total * 100
            pbar.update(percent - cont)
            cont = percent
    except expect.EOF:
        pass
    finally:
        if pbar is not None:
            pbar.close()

def raise_ffmpeg_error(self, proc):
    proc.expect(expect.EOF)
    res = proc.before
    res += proc.read()
    exitstatus = proc.wait()
    if exitstatus:
        raise ffmpeg.Error('ffmpeg', '', res)

def initialize_progress_bar(self, manager):
    pbar = None
    pbar = manager.counter(
        total=100,
        desc=self.path.rsplit(os.path.sep, 1)[-1],
        unit='%',
        bar_format=BAR_FMT,
        counter_format=COUNTER_FMT,
        leave=False
    )
    return pbar

def get_total_frames(self, proc):
    return sum(map(lambda x: float(
        x[1])*60**x[0], enumerate(reversed(proc.match.groups()[0].strip().split(':')))))

def get_current_frame(self, proc):
    proc.expect(pattern_progress)
    return sum(map(lambda x: float(
                x[1])*60**x[0], enumerate(reversed(proc.match.groups()[0].strip().split(':')))))


    


  • Modify video with FFMPEG before uploading to S3

    12 juillet 2017, par user774615

    When a user uploads a video, I want to remove its audio. So in my Laravel code, I have something like this :

    // The video from the HTML form
    $video = $request->file('video');

    // Strip the audio
    exec('ffmpeg -y -i ' . <path to="to" file="file"> . ' -an -c copy ' . <new file="file" path="path">);
    </new></path>

    The problem is, I want to upload the final video (without audio) to Amazon’s S3 without saving any part of the video on my local server.

    Is there a way to use $video as the input for the ffmpeg command and then output the result directly to S3 ? How ?

  • Using subprocess on Popen option

    26 septembre 2015, par yumyumyum

    I use python 2.7 and ffmpeg on Mac OS 10.10.
    When use some command from python, coded like below

    p = subprocess.Popen(cmd.strip().split(" "))

    This goes well all the time, but not in ffmpeg filter_complex case.
    Below code can run on the terminal with directly input.

    ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex " nullsrc=size=1920x1440 [base]; [0:v] setpts=PTS-STARTPTS, scale=1920x1440 [frame0];[1:v] setpts=PTS-STARTPTS, scale=640x480 [frame1]; [base] [frame0] overlay=shortest=1:x=1920:y=1440 [tmp1]; [tmp1] [frame1] overlay=shortest=1:x=640:y=480  output.mp4

    But cannot run with python Popen script like below.

    cmd = "ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex " nullsrc=size=1920x1440 [base]; [0:v] setpts=PTS-STARTPTS, scale=1920x1440 [frame0];[1:v] setpts=PTS-STARTPTS, scale=640x480 [frame1]; [base] [frame0] overlay=shortest=1:x=1920:y=1440 [tmp1]; [tmp1] [frame1] overlay=shortest=1:x=640:y=480  output.mp4"
    p = subprocess.Popen(cmd.strip().split(" "))

    This has problem at split(" ") works unexpected subdivision.
    So I prepare the split command directly like

    split_cmd = [ffmpeg_exe,'-i','input1.mp4','-i','input2.mp4','-filter_complex','\" nullsrc=size=1920x1440 [base]; [0:v] setpts=PTS-STARTPTS, scale=1920x1440 [frame0];[1:v] setpts=PTS-STARTPTS, scale=640x480 [frame1]; [base] [frame0] overlay=shortest=1:x=1920:y=1440 [tmp1]; [tmp1] [frame1] overlay=shortest=1:x=640:y=480\"','output.mp4'];
    p = subprocess.Popen(split_cmd)

    Even in this case, system return

    [AVFilterGraph @ 0x7fb1c9f000c0] No such filter: '" nullsrc'
    Error configuring filters.

    this could be system confused the -filter_complex option as ffmpeg option.
    Anyone can help this, please.