Recherche avancée

Médias (0)

Mot : - Tags -/organisation

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

Autres articles (77)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (7718)

  • ffmpeg progess bar not giving percent

    3 décembre 2014, par Brett

    Hi im trying to create a java program that shows the percent of a ffmpeg command , Im not sure where i am going wrong.

    Its keeps giving me these results

    run :
    Total duration : 857.44 seconds.
    Progress : 0.85%
    Progress : 1.76%
    Progress : 2.79%
    Progress : 3.93%
    Progress : 5.04%
    Progress : 6.21%
    Progress : 6000.27%
    Progress : 6001.29%
    Progress : 6002.46%
    Progress : 6003.58%
    Progress : 6004.59%
    Progress : 6005.70%
    Progress : 6006.77%
    Progress : 12000.86%
    Progress : 12001.97%
    Progress : 12002.97%
    Progress : 12004.03%
    Progress : 12005.15%
    Progress : 12006.27%
    Progress : 18000.34%
    Progress : 18001.46%
    Progress : 18002.29%
    Progress : 18003.41%
    Progress : 18004.41%
    Progress : 18005.50%
    Progress : 18006.55%
    Progress : 24000.52%
    Progress : 24001.62%
    Progress : 24002.74%
    Progress : 24003.69%
    Progress : 24004.76%
    Progress : 24005.88%
    Progress : 24006.94%
    Progress : 30001.01%
    Progress : 30002.16%
    Progress : 30003.24%
    Progress : 30004.25%
    Progress : 30005.37%
    Progress : 30006.44%
    Progress : 36000.56%
    Progress : 36001.60%
    Progress : 36002.69%
    Progress : 36003.73%
    Progress : 36004.81%
    Progress : 36005.93%
    Progress : 42000.05%
    Progress : 42001.18%
    Progress : 42002.30%
    Progress : 42003.41%
    Progress : 42004.50%
    Progress : 42005.60%
    Progress : 42006.72%
    Progress : 48000.84%
    Progress : 48001.96%
    Progress : 48003.08%
    Progress : 48004.18%
    Progress : 48005.09%
    Progress : 48006.16%
    Progress : 54000.22%
    Progress : 54001.15%
    Progress : 54002.20%
    Progress : 54003.30%
    Progress : 54004.42%
    Progress : 54005.49%
    Progress : 54006.38%
    Progress : 60000.45%
    Progress : 60001.57%
    Progress : 60002.55%
    Progress : 60003.64%
    Progress : 60004.66%
    Progress : 60005.62%
    Progress : 60006.72%
    Progress : 66000.67%
    Progress : 66001.73%
    Progress : 66002.75%
    Progress : 66003.61%
    Progress : 66004.71%
    Progress : 66005.82%
    Progress : 66006.81%
    Progress : 72000.67%
    Progress : 72001.73%
    Progress : 72002.80%
    Progress : 72003.87%
    Progress : 72004.81%
    Progress : 72005.71%
    Progress : 72006.69%
    Progress : 78000.73%
    Progress : 78001.82%
    Progress : 78002.91%
    Progress : 78003.91%
    Progress : 78004.98%
    Progress : 78005.88%
    Progress : 78006.49%
    Progress : 84000.37%
    Progress : 84001.12%
    Progress : 84002.04%
    BUILD SUCCESSFUL (total time : 49 seconds)

    But the file is created , i don’t know why im getting 0.00% any help would be awsome
    ..
    It also complains some imports a not being used here are the imports.

    here is my code

    import java.io.IOException;
    import java.util.Scanner;
    import static java.util.logging.Level.parse;
    import java.util.regex.Pattern;
    import javafx.util.Duration;
    import static javax.management.Query.lt;
    /**
    *
    * @author brett
    */

    public class MashMeUp {

       public static void main(String[] args) throws IOException {
           ProcessBuilder pb = new ProcessBuilder("ffmpeg", "-i", "C:\\Users\\brett\\Documents\\Telegraph_Road.mp4", "C:\\Users\\brett\\Documents\\out.mp4");

           // ProcessBuilder pb = new ProcessBuilder(args);  
           final Process p = pb.start();

       // create a new thread to get progress from ffmpeg command , override  
           // it's run method, and start it!  
           new Thread() {
               public void run() {

                   Scanner sc = new Scanner(p.getErrorStream());

                   // Find duration  
                   Pattern durPattern = Pattern.compile("(?<=Duration: )[^,]*");
                   String dur = sc.findWithinHorizon(durPattern, 0);
                   if (dur == null) {
                       throw new RuntimeException("Could not parse duration.");
                   }
                   String[] hms = dur.split(":");
                   double totalSecs = Integer.parseInt(hms[0]) * 3600
                           + Integer.parseInt(hms[1]) * 60
                           + Double.parseDouble(hms[2]);
                   System.out.println("Total duration: " + totalSecs + " seconds.");

                   // Find time as long as possible.  
                   Pattern timePattern = Pattern.compile("(?<=time=)[\\d:.]*");
                   // TODO make regex that works with ffmpeg static build  
                   String match;
                   String[] matchSplit;
    while (null != (match = sc.findWithinHorizon(timePattern, 0))) {
       matchSplit = match.split(":");
       double progress = Double.parseDouble(matchSplit[2]) / totalSecs +  Integer.parseInt(matchSplit[0]) * 3600 + Integer.parseInt(matchSplit[1]) * 60;
                       System.out.printf("Progress: %.2f%%%n", progress * 100);
                   }
               }
           }.start();
       }
    }
  • lavc/options : add test for avcodec_copy_context

    4 décembre 2014, par Lukasz Marek
    lavc/options : add test for avcodec_copy_context
    

    This test doesn’t cover every possible issue with this function.
    It covers options management only.

    Signed-off-by : Lukasz Marek <lukasz.m.luki2@gmail.com>

    • [DH] libavcodec/Makefile
    • [DH] libavcodec/options.c
  • Corrupt AVFrame returned by libavcodec

    2 janvier 2015, par informer2000

    As part of a bigger project, I’m trying to decode a number of HD (1920x1080) video streams simultaneously. Each video stream is stored in raw yuv420p format within an AVI container. I have a Decoder class from which I create a number of objects within different threads (one object per thread). The two main methods in Decoder are decode() and getNextFrame(), which I provide the implementation for below.

    When I separate the decoding logic and use it to decode a single stream, everything works fine. However, when I use the multi-threaded code, I get a segmentation fault and the program crashes within the processing code in the decoding loop. After some investigation, I realized that the data array of the AVFrame filled in getNextFrame() contains addresses which are out of range (according to gdb).

    I’m really lost here ! I’m not doing anything that would change the contents of the AVFrame in my code. The only place where I attempt to access the AVFrame is when I call sws_scale() to convert the color format and that’s where the segmentation fault occurs in the second case because of the corrupt AVFrame. Any suggestion as to why this is happening is greatly appreciated. Thanks in advance.

    The decode() method :

    void decode() {

       QString filename("video.avi");

       AVFormatContext* container = 0;

       if (avformat_open_input(&amp;container, filename.toStdString().c_str(), NULL, NULL) &lt; 0) {
           fprintf(stderr, "Could not open %s\n", filename.toStdString().c_str());
           exit(1);
       }

       if (avformat_find_stream_info(container, NULL) &lt; 0) {
           fprintf(stderr, "Could not find file info..\n");
       }

       // find a video stream
       int stream_id = -1;
       for (unsigned int i = 0; i &lt; container->nb_streams; i++) {
           if (container->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
               stream_id = i;
               break;
           }
       }

       if (stream_id == -1) {
           fprintf(stderr, "Could not find a video stream..\n");
       }

       av_dump_format(container, stream_id, filename.toStdString().c_str(), false);

       // find the appropriate codec and open it
       AVCodecContext* codec_context = container->streams[stream_id]->codec;   // Get a pointer to the codec context for the video stream

       AVCodec* codec = avcodec_find_decoder(codec_context->codec_id);  // Find the decoder for the video stream

       if (codec == NULL) {
           fprintf(stderr, "Could not find a suitable codec..\n");
           return -1; // Codec not found
       }


       // Inform the codec that we can handle truncated bitstreams -- i.e.,
       // bitstreams where frame boundaries can fall in the middle of packets
       if (codec->capabilities &amp; CODEC_CAP_TRUNCATED)
           codec_context->flags |= CODEC_FLAG_TRUNCATED;

       fprintf(stderr, "Codec: %s\n", codec->name);

       // open the codec
       int ret = avcodec_open2(codec_context, codec, NULL);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not open the needed codec.. Error: %d\n", ret);
           return -1;
       }


       // allocate video frame
       AVFrame *frame = avcodec_alloc_frame();  // deprecated, should use av_frame_alloc() instead

       if (!frame) {
           fprintf(stderr, "Could not allocate video frame..\n");
           return -1;
       }

       int frameNumber = 0;

       // as long as there are remaining frames in the stream
       while  (getNextFrame(container, codec_context, stream_id, frame)) {

           // Processing logic here...
           // AVFrame data array contains three addresses which are out of range

       }

       // freeing resources
       av_free(frame);

       avcodec_close(codec_context);

       avformat_close_input(&amp;container);
    }

    The getNextFrame() method :

    bool getNextFrame(AVFormatContext *pFormatCtx,
                     AVCodecContext *pCodecCtx,
                     int videoStream,
                     AVFrame *pFrame) {

       uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];

       char buf[1024];

       int len;

       int got_picture;
       AVPacket avpkt;

       av_init_packet(&amp;avpkt);

       memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);

       // read data from bit stream and store it in the AVPacket object
       while(av_read_frame(pFormatCtx, &amp;avpkt) >= 0) {

           // check the stream index of the read packet to make sure it is a video stream
           if(avpkt.stream_index == videoStream) {

               // decode the packet and store the decoded content in the AVFrame object and set the flag if we have a complete decoded picture
               avcodec_decode_video2(pCodecCtx, pFrame, &amp;got_picture, &amp;avpkt);

               // if we have completed decoding an entire picture (frame), return true
               if(got_picture) {

                   av_free_packet(&amp;avpkt);

                   return true;
               }
           }

           // free the AVPacket object that was allocated by av_read_frame
           av_free_packet(&amp;avpkt);
       }

       return false;

    }

    The lock management callback function :

    static int lock_call_back(void ** mutex, enum AVLockOp op) {
       switch (op) {
           case AV_LOCK_CREATE:
               *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
               pthread_mutex_init((pthread_mutex_t *)(*mutex), NULL);
               break;
           case AV_LOCK_OBTAIN:
               pthread_mutex_lock((pthread_mutex_t *)(*mutex));
               break;
           case AV_LOCK_RELEASE:
               pthread_mutex_unlock((pthread_mutex_t *)(*mutex));
               break;
           case AV_LOCK_DESTROY:
               pthread_mutex_destroy((pthread_mutex_t *)(*mutex));
               free(*mutex);
               break;
       }

       return 0;
    }