Recherche avancée

Médias (91)

Autres articles (51)

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

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, 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 (...)

Sur d’autres sites (7074)

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

  • Google Analytics Now Illegal in Austria ; Other EU Member States Expected to Follow

    18 janvier 2022, par Erin — Privacy

    Breaking news : The Austrian Data Protection Authority (“Datenschutzbehörde” or “DSB” or “DPA”) has ruled that Austrian website providers using Google Analytics are in violation of the GDPR. 

    This ruling stems from a decision made in 2020 by the Court of Justice of the European Union (CJEU) that stated that cloud services hosted in the US are incapable of complying with the GDPR and EU privacy laws. The decision was made because of the US surveillance laws requiring US providers (like Google or Facebook) to provide personal data to US authorities. 

    The 2020 ruling, known as “Schrems II”, marked the ending of the Privacy Shield, a framework that allowed for EU data to be transferred to US companies that became certified. 

    The tech industry was sent into a frenzy following this decision, but many US and EU companies decided to ignore the case. The choice to ignore is what landed one Austrian business in the DPA’s line of fire, damaging the brand’s reputation and possibly resulting in a hefty fine of up to €20 million or 4% of the organisation’s global turnover. 

    About the Austrian DPA’s Model Case 

    In this specific case, noyb (the European Center for Digital Rights) found that IP addresses (which are classified as personal data by the GDPR) and other identifiers were sent to the US in cookie data as a result of the organisation using Google Analytics. 

    This model case led to the DPA’s decision to rule that Austrian website providers using Google Analytics are in violation of GDPR. It is believed that other EU Member States will soon follow in this decision as well.

    "We expect similar decisions to now drop gradually in most EU member states. We have filed 101 complaints in almost all Member States and the authorities coordinated the response. A similar decision was also issued by the European Data Protection Supervisor last week."

    Max Schrems, honorary chair of noyb.eu

    What does this mean if you are using Google Analytics ?

    If there is one thing to learn from this case, it is that ignoring these court rulings and continuing to use Google Analytics is not a viable option. 

    If you are operating a website in Austria, or your website services Austrian citizens, you should remove Google Analytics from your website immediately. 

    For businesses in other EU Member States, it is also highly recommended that you take action before noyb and local data protection authorities start targeting more businesses. 

    "Instead of actually adapting services to be GDPR compliant, US companies have tried to simply add some text to their privacy policies and ignore the Court of Justice. Many EU companies have followed the lead instead of switching to legal options."

    Max Schrems

    Removing Google Analytics from your site doesn’t mean that you need to give up website analytics altogether though. There are a variety of Google Analytics alternatives available today. Matomo in particular is a powerful open-source web analytics platform that gives you 100% data ownership and GDPR compliance

    Tweet - Using Google Analytics is illegal in Europe
    Glenn F. Henriksen via Twitter

    Matomo is one of the best Google Analytics alternatives offering privacy by design on our Cloud, On-Premise and Matomo for WordPress. So you can get the insights you need while remaining compliant. As the GDPR continues to evolve, you can rest assured that Matomo will be at the forefront of these changes. 

    In addition, all Google Analytics data can be imported into Matomo so no historical data is lost. To make your migration as seamless as possible, we’ve put together a guide to migrating from Google Analytics to Matomo

    Ready to begin your journey to GDPR compliance ? Check out our live demo and start your 21-day free trial now – no credit card required.

    If you are interested in learning more about GDPR compliance and Matomo, check out our GDPR resources below :    

    What does this mean if you are using Matomo ? 

    Our users can rest assured that Matomo remains in compliance with GDPR as all data is stored in the EU (Matomo Cloud) or in any country of your choice (Matomo On-Premise). With Matomo you’re able to continue analysing your website and not worry about GDPR.

    Final thoughts

    For EU businesses operating websites, now is the time to act. While Google pushes out false narratives to try and convince users that it is safe to continue using Google Analytics, it’s clear from these court rulings that the data protection authorities across the EU disagree with Google’s narrative.

    The fines, reputational damage and stresses mounting from using Google Analytics are imminent. Find an alternative to Google Analytics as this problem is not going away. 

    Getting started with Matomo is easy. Make the switch today and start your free 21-day trial – no credit card required. 

  • avcodec_find_encoder_by_name() returns NULL

    27 décembre 2019, par GiuTor

    I’m trying to compile the following example I found on ffmpeg documentation :

    /*
    * Copyright (c) 2001 Fabrice Bellard
    *
    * Permission is hereby granted, free of charge, to any person obtaining a copy
    * of this software and associated documentation files (the "Software"), to deal
    * in the Software without restriction, including without limitation the rights
    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    * copies of the Software, and to permit persons to whom the Software is
    * furnished to do so, subject to the following conditions:
    *
    * The above copyright notice and this permission notice shall be included in
    * all copies or substantial portions of the Software.
    *
    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    * THE SOFTWARE.
    */

    // compile with gcc -o encode_video encode_video.c -lavutil -lavcodec -lz -lm

    /**
    * @file
    * video encoding with libavcodec API example
    *
    * @example encode_video.c
    */

    #include
    #include
    #include

    #include <libavcodec></libavcodec>avcodec.h>

    #include <libavutil></libavutil>opt.h>
    #include <libavutil></libavutil>imgutils.h>

    static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
                      FILE *outfile)
    {
       int ret;

       /* send the frame to the encoder */
       if (frame)
           printf("Send frame %3"PRId64"\n", frame->pts);

       ret = avcodec_send_frame(enc_ctx, frame);
       if (ret &lt; 0) {
           fprintf(stderr, "Error sending a frame for encoding\n");
           exit(1);
       }

       while (ret >= 0) {
           ret = avcodec_receive_packet(enc_ctx, pkt);
           if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
               return;
           else if (ret &lt; 0) {
               fprintf(stderr, "Error during encoding\n");
               exit(1);
           }

           printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
           fwrite(pkt->data, 1, pkt->size, outfile);
           av_packet_unref(pkt);
       }
    }

    int main(int argc, char **argv)
    {
       const char *filename, *codec_name;
       const AVCodec *codec;
       AVCodecContext *c= NULL;
       int i, ret, x, y;
       FILE *f;
       AVFrame *frame;
       AVPacket *pkt;
       uint8_t endcode[] = { 0, 0, 1, 0xb7 };

       if (argc &lt;= 2) {
           fprintf(stderr, "Usage: %s <output file="file"> <codec>\n", argv[0]);
           exit(0);
       }
       filename = argv[1];
       codec_name = argv[2];

       /* find the mpeg1video encoder */
       codec = avcodec_find_encoder_by_name(codec_name);
       if (!codec) {
           fprintf(stderr, "Codec '%s' not found\n", codec_name);
           exit(1);
       }

       c = avcodec_alloc_context3(codec);
       if (!c) {
           fprintf(stderr, "Could not allocate video codec context\n");
           exit(1);
       }

       pkt = av_packet_alloc();
       if (!pkt)
           exit(1);

       /* put sample parameters */
       c->bit_rate = 400000;
       /* resolution must be a multiple of two */
       c->width = 352;
       c->height = 288;
       /* frames per second */
       c->time_base = (AVRational){1, 25};
       c->framerate = (AVRational){25, 1};

       /* emit one intra frame every ten frames
        * check frame pict_type before passing frame
        * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
        * then gop_size is ignored and the output of encoder
        * will always be I frame irrespective to gop_size
        */
       c->gop_size = 10;
       c->max_b_frames = 1;
       c->pix_fmt = AV_PIX_FMT_YUV420P;

       if (codec->id == AV_CODEC_ID_H264)
           av_opt_set(c->priv_data, "preset", "slow", 0);

       /* open it */
       ret = avcodec_open2(c, codec, NULL);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret));
           exit(1);
       }

       f = fopen(filename, "wb");
       if (!f) {
           fprintf(stderr, "Could not open %s\n", filename);
           exit(1);
       }

       frame = av_frame_alloc();
       if (!frame) {
           fprintf(stderr, "Could not allocate video frame\n");
           exit(1);
       }
       frame->format = c->pix_fmt;
       frame->width  = c->width;
       frame->height = c->height;

       ret = av_frame_get_buffer(frame, 32);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not allocate the video frame data\n");
           exit(1);
       }

       /* encode 1 second of video */
       for (i = 0; i &lt; 25; i++) {
           fflush(stdout);

           /* make sure the frame data is writable */
           ret = av_frame_make_writable(frame);
           if (ret &lt; 0)
               exit(1);

           /* prepare a dummy image */
           /* Y */
           for (y = 0; y &lt; c->height; y++) {
               for (x = 0; x &lt; c->width; x++) {
                   frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
               }
           }

           /* Cb and Cr */
           for (y = 0; y &lt; c->height/2; y++) {
               for (x = 0; x &lt; c->width/2; x++) {
                   frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
                   frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
               }
           }

           frame->pts = i;

           /* encode the image */
           encode(c, frame, pkt, f);
       }

       /* flush the encoder */
       encode(c, NULL, pkt, f);

       /* add sequence end code to have a real MPEG file */
       if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO)
           fwrite(endcode, 1, sizeof(endcode), f);
       fclose(f);

       avcodec_free_context(&amp;c);
       av_frame_free(&amp;frame);
       av_packet_free(&amp;pkt);

       return 0;
    }
    </codec></output>

    ffmpeg -codecs return a bunch of codecs among which libx264 and libx265. When I run the above code I get NULL from avcodec_find_encoder_by_name() :

    gt@gt-Aspire-E1-570 : /libav$ ./encode_video pippo libx264
    Codec ’libx264’ not found
    gt@gt-Aspire-E1-570 : /libav$ ./encode_video pippo x264
    Codec ’x264’ not found
    gt@gt-Aspire-E1-570 : /libav$ ./encode_video pippo H264
    Codec ’H264’ not found
    gt@gt-Aspire-E1-570 : /libav$

    Can someone help please ?

    Thanks