Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (69)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

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

  • google function : TypeError : Cannot read property 'name' of undefined

    9 décembre 2019, par Juggernaught

    I’m trying to use Google cloud function to transcode videos from a storage bucket and outputs into another bucket using code posted online but with a few adjustments.

    but I get the following error :

    TypeError : Cannot read property ’name’ of undefined at transcodeVideo
    (/srv/index.js:17:56) at /worker/worker.js:825:24 at at
    process._tickDomainCallback (internal/process/next_tick.js:229:7)

    Index.js

    const {Storage} = require('@google-cloud/storage');
    const projectId = 'cc18-223318';
    const storage = new Storage({
       projectId: projectId,
    });
    const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
    const ffmpeg = require('fluent-ffmpeg');

    const transcodedBucket = storage.bucket('2400p');
    const uploadBucket = storage.bucket('inpuut');
    ffmpeg.setFfmpegPath(ffmpegPath);

    exports.transcodeVideo = function transcodeVideo(event, callback) {
     const file = event.data;
     // Ensure that you only proceed if the file is newly created, and exists.
     if (file.metageneration !== '1' || file.resourceState !== 'exists') {
       callback();
       return;
     }

     // Open write stream to new bucket, modify the filename as needed.
     const remoteWriteStream = transcodedBucket.file(file.name.replace('.webm', '.mp4'))
       .createWriteStream({
         metadata: {
           metadata: file.metadata, // You may not need this, my uploads have associated metadata
           contentType: 'video/mp4', // This could be whatever else you are transcoding to
         },
       });

     // Open read stream to our uploaded file
     const remoteReadStream = uploadBucket.file(file.name).createReadStream();

     // Transcode
     ffmpeg()
       .input(remoteReadStream)
       .outputOptions('-c:v libx264') // Change these options to whatever suits your needs
       .outputOptions('-c:a copy')
       .outputOptions('-vf "scale=4800:2400"')
       .outputOptions('-b:a 160k')
       .outputOptions('-b:a 160k')
       .outputOptions('-x264-params mvrange=511')
       .outputOptions('-f mp4')
       .outputOptions('-preset slow')
       .outputOptions('-movflags frag_keyframe+empty_moov')
       .outputOptions('-crf 18')
       // https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/346#issuecomment-67299526
       .on('start', (cmdLine) => {
         console.log('Started ffmpeg with command:', cmdLine);
       })
       .on('end', () => {
         console.log('Successfully re-encoded video.');
         callback();
       })
       .on('error', (err, stdout, stderr) => {
         console.error('An error occured during encoding', err.message);
         console.error('stdout:', stdout);
         console.error('stderr:', stderr);
         callback(err);
       })
       .pipe(remoteWriteStream, { end: true }); // end: true, emit end event when readable stream ends
    };
  • Anomalie #3981 : Menu "Écrire une nouvelle traduction" non présent pour rédacteurs

    12 août 2017, par Franck D

    Bon alors, j’ai pas fait les tests correctement...
    En faite, le lien pour traduire un article n’est présent concernant les "rédacteurs" que concernant leur propre articles !
    Ce qui fait qu’il ne peuvent traduire les articles des autres rédacteurs !

    Par contre, une personne avec le statut d’admi peux traduire les articles des autres (logique)

    Donc,logiquement, il faudrait que les personnes ayant le statut de rédacteur puissent traduire et proposé leur traduction à la publication concernant les articles des autres.

  • Python script fails execution on subprocess.run() call only when called from context menu

    10 mars 2019, par Jesse McDonald

    I have a python script that I want to call from the windows file browser context menu (https://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/)

    I am currently debugging calling it from the non-specific context (HKEY_CLASSES_ROOT\Directory\Background\shell) with the command "python "D :\toolbox\mineAudio.py" 0"
    (note python3 is on the path as python and the script is at D :\toolbox\mineAudio.py)

    When I call the script from cmd it works as expected with that command, and when I make debug modifications to the script (adding os.system("pause") to random lines) I can verify it is running correctly up to the point it hits the line meta=cmd(['ffmpeg','-i',target]) (line 46) where it instantly and silently fails (note ffmpeg is also on the path)

    EDIT : it actually gets as far as line 15

    result = subprocess.run(command, stdout=subprocess.PIPE,stderr=subprocess.PIPE,startupinfo=startupinfo)

    I cant figure out why the program is failing there as that line works fine everywhere else I have tested the script from other than the context menu.

    Here is the full script if you want to brows through it

    import subprocess
    import os
    import sys
    from sys import argv
    from tree import tree
    #for command line use:
    #mineAudo.py [prompt=1] [dir=cwd]
    #first arg prompt will prompt user for dir if 1, otherwise it wont
    #second arg is the directory to use, if specified this will override prompt, if not and prompt=0, current working dir is used
    def cmd(command):
       startupinfo = subprocess.STARTUPINFO()
       startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
       startupinfo.wShowWindow = subprocess.SW_HIDE
       result = subprocess.run(command, stdout=subprocess.PIPE,stderr=subprocess.PIPE,startupinfo=startupinfo)
       return result.stderr.decode("utf-8")
    def stripStreams(meta):
       i=1;
       lines=[]
       while i>0 :
           i=meta.find("Stream",i+1)
           lineEnd=meta.find("\n",i)
           lines.append(meta[i:lineEnd])

       return lines
    def mineAudio(streams):
       ret=[]
       for stream in streams:
           if "Audio:" in stream:
               start =stream.find("#")+1
               end=stream.find("(",start)
               ret.append(stream[start:end])
       return ret
    def convDir(dirTarget):
       targets=tree(dirTarget)
       convList(targets,dirTarget)

    def convList(targets,dirTarget):
           print(targets)
           #target="2018-05-31 06-16-39.mp4"
           i=0
           for target in targets:
               i+=1

               if(target[target.rfind("."):]==".mp4"):
                   print("("+str(i)+"/"+str(len(targets))+") starting file "+target)
                   meta=cmd(['ffmpeg','-i',target])
                   streams=stripStreams(meta)
                   streams=mineAudio(streams)
                   count=0
                   output=target[target.rfind("/")+1:target.rfind(".")]
                   file=target[target.rfind("/")+1:]
                   #print (output)
                   try:
                       os.mkdir(dirTarget+"\\"+output)
                   except:
                       pass
                   for s in streams:
                       print("converting track "+str(count+1)+" of "+str(len(streams)));
                       count+=1
                       cmd("ffmpeg -i \""+target+"\" -vn -sn -c:a mp3 -ab 192k -map "+s+" \""+dirTarget+"\\"+output+"\\"+output+" Track "+str(count)+".mp3\"")
                   print("moving "+target+" to "+dirTarget+"\\"+output+"\\"+file)
                   os.rename(target,dirTarget+"\\"+output+"\\"+file)
                   print("Finished file "+target)
               else:
                   print("("+str(i)+"/"+str(len(targets))+") skiping non mp4 file "+target)

    def prompt():
       while True:
           dirTarget=input("input target dir: ")
           convDir(dirTarget)



    if __name__ == "__main__":
           sys.setrecursionlimit(2000)    
           if len(argv)>2:
                   if os.path.isdir(argv[2]):
                       convDir(argv[2])
                   else:
                       convList([argv[2]],os.path.dirname(argv[2]))
           elif(len(argv)>1):
                   if int(argv[1])==1:
                       prompt()
                   else:
                       convDir(os.getcwd())
           else:
               prompt()


           os.system("pause")

    Note that I am not married to this particular implementation, any implementation with the same effect (extracting the .mp3 tracks from an .mp4 file automatically) would be fine too

    also, here is the file Tree

    #Returns the paths of all files in a directory and all sub directories relative to start directory
    import os
    def tree(directory,target="f"):
       paths=[]
       for currentDir,dirs,files in os.walk(directory):
           if target=="f":
               for file in files:
                   paths.append(currentDir+"/"+file)
           if target=="d":
               #paths.append(currentDir)
               for dir in dirs:
                   paths.append(currentDir+"/"+dir)
       for i in range(len(paths)):
           paths[i]=paths[i].replace("\\","/")
       return paths

    Can anyone help me get this working ?

    Edit :
    here is a shorter example code that crashes in the same way (still uses ffmpeg though)

    import subprocess
    import os
    def cmd(command):
       startupinfo = subprocess.STARTUPINFO()
       startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
       startupinfo.wShowWindow = subprocess.SW_HIDE

       result = subprocess.run(command,stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,stderr=subprocess.PIPE,startupinfo=startupinfo)

       return result.stderr.decode("utf-8")


    os.system("pause")

    out=cmd(['ffmpeg','-i','D:\\ffmpeg test\\test\\2018-05-31 06-16-39\\2018-05-31 06-16-39.mp4'])
    print(out)
    os.system("pause")

    (note the file is hard coded, program output should be
    enter image description here )