Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (100)

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

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

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

Sur d’autres sites (8284)

  • Catching ffmpeg errors in Tensorflow

    12 avril 2018, par lollercoaster

    Currently I make extensive use of tensorflow’s ffmpeg interface :

    from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
    from tensorflow.python.ops import io_ops
    from tensorflow.contrib import ffmpeg

    def load(mp3_path):
       with tf.name_scope("loading") as scope:
           audio_binary = tf.read_file(mp3_path)
           waveform = tf.reshape(ffmpeg.decode_audio(
               audio_binary, file_format='mp3',
               samples_per_second=44100, channel_count=1), [-1])
           return waveform

    This is wonderful, but sometimes (well, a lot) I get errors like this when looping through a bunch of files to create TFRecord files :

    [mp3 @ 0xdd4400] Header missing
    Error while decoding stream #0:0: Invalid data found when processing input
    [mp3 @ 0xf2e440] Header missing
    Error while decoding stream #0:0: Invalid data found when processing input
    [mp3 @ 0x202bf40] invalid new backstep -1
    [mp3 @ 0x15c5440] Header missing
    Error while decoding stream #0:0: Invalid data found when processing input
    [mp3 @ 0x1752460] Header missing
    Error while decoding stream #0:0: Invalid data found when processing input
    [mp3 @ 0x1f10160] Header missing
    Error while decoding stream #0:0: Invalid data found when processing input
    [mp3 @ 0x1a16dc0] Header missing
    Error while decoding stream #0:0: Invalid data found when processing input
    [mp3 @ 0x9f2c80] Header missing
    Error while decoding stream #0:0: Invalid data found when processing input

    which shows up in stdout while running this Python script.

    I’d like to catch these somehow ! And prevent the rest of my loop from continuing if the data I’m reading is invalid.

    Currently, these errors just happen and the script happily keeps running, which is probably not the way it should work.

    I’m not making use of the Dataset API for this, so these direct session.run(waveform_op) calls should throw and Exception or something when parsing fails !

    Anyone know how I can do this ?

  • Async Javascript function returns undefined

    14 avril 2018, par Leon Wright

    I am trying to run this function but the it keeps returning undefined when I explicitly hardcode the return value.

    const splitVideo = async (sid, video, part) => {
       let framesLocation =`${process.cwd()}/${dirs.videoFrames}/${sid}_${part}`;

       console.log(fs.existsSync(framesLocation));

       if(!fs.existsSync(framesLocation)) {
           console.log("making dir");
           f.s.mkdirSync(framesLocation);
       }

       ffmpeg(video)
           .on('end', () => {
                return "done";
            })
            .on('error', (err) => {
                throw err;
            })
            .screenshots({
                 timestamps: [1,2],
                 filename: `${sid}_${part}/frame-%s.png`,
                 folder: `${process.cwd()}/${dirs.videoFrames}`
            });
    };

    Please help this is very frustrating.

  • How to fetch both live video frame and timestamp from ffmpeg to python on Windows

    8 mai 2018, par vijiboy

    Searching for an alternative as OpenCV would not provide timestamps for live camera stream (on Windows), which are required in my computer vision algorithm, I found ffmpeg and this excellent article https://zulko.github.io/blog/2013/09/27/read-and-write-video-frames-in-python-using-ffmpeg/
    The solution uses ffmpeg, accessing its standard output (stdout) stream. I extended it to read the standard error (stderr) stream as well.

    Working up the python code on windows, while I received the video frames from ffmpeg stdout, but the stderr freezes after delivering the showinfo videofilter details (timestamp) for first frame.

    I recollected seeing on ffmpeg forum somewhere that the video filters like showinfo are bypassed when redirected. Is this why the following code does not work as expected ?

    Expected : It should write video frames to disk as well as print timestamp details.
    Actual : It writes video files but does not get the timestamp (showinfo) details.

    Here’s the code I tried :

    import subprocess as sp
    import numpy
    import cv2

    command = [ 'ffmpeg',
               '-i', 'e:\sample.wmv',
               '-pix_fmt', 'rgb24',
               '-vcodec', 'rawvideo',
               '-vf', 'showinfo', # video filter - showinfo will provide frame timestamps
               '-an','-sn', #-an, -sn disables audio and sub-title processing respectively
               '-f', 'image2pipe', '-'] # we need to output to a pipe

    pipe = sp.Popen(command, stdout = sp.PIPE, stderr = sp.PIPE) # TODO someone on ffmpeg forum said video filters (e.g. showinfo) are bypassed when stdout is redirected to pipes???

    for i in range(10):
       raw_image = pipe.stdout.read(1280*720*3)
       img_info = pipe.stderr.read(244) # 244 characters is the current output of showinfo video filter
       print "showinfo output", img_info
       image1 =  numpy.fromstring(raw_image, dtype='uint8')
       image2 = image1.reshape((720,1280,3))  

       # write video frame to file just to verify
       videoFrameName = 'Video_Frame{0}.png'.format(i)
       cv2.imwrite(videoFrameName,image2)

       # throw away the data in the pipe's buffer.
       pipe.stdout.flush()
       pipe.stderr.flush()

    So how to still get the frame timestamps from ffmpeg into python code so that it can be used in my computer vision algorithm...