Recherche avancée

Médias (0)

Mot : - Tags -/interaction

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

Autres articles (68)

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (4782)

  • Issue when calling ffmpeg.c twice that makes the app crashes ?

    6 février 2013, par Jimmy

    I'm trying to call ffmpeg.c to trim a video based on this code 'video-trimmer'. So when I try to run the activity (that loads and uses the native lib) the first time I click trin it works and I could trim the video but when I try to run it again it crashes (and it only work with the application restarts).

    So I spend three days looking for a solution for this issue, most of the answers says the issue with the static variables in ffmpeg.c and creating a lib that loads and unload the class fixes the issue (answer1, answer2). So I tried to apply the solution that is based on the answers and this github repo on the video-trimmer project but all my attempts failed.

    Is there any one knows about a fork of the 'video-trimmer' project that fixes the issue ?. or can anybody provide step by step answer of how to implement the solution in the 'video-trimmer' project (because I tried to follow all the solution on the web and apply them in that project but with no luck).

  • ffmpeg in child process doesn't exit when parent closes pipe

    28 mars 2013, par user2221129

    This code snippet is from a pthread process. It is responsible for reading configuration/options to pass to ffmpeg. The data piped to ffmpeg is coming in on a ring buffer of video frames (as a proof of concept, in the final implementation these would be coming from a camera device). The parent writes to the child via a pipe established with dup2. The problem I'm having is that most of the time, the ffmpeg process doesn't seem to recognize the pipe has been closed by the parent (as strace shows the ffmpeg is in read). There are probably some unhandled mutex situations.

    #define CHILD_READ  writepipe[0]
    #define PARENT_WRITE    writepipe[1]
    #define MAX_VIDEO_BUFFERS 30

    static int last_frame_written = -1;
    static int buffer_size = -1;
    static void *video_buffer[MAX_VIDEO_BUFFERS];

    #define MAXTHREADS 2
    static pthread_t thread[MAXTHREADS];
    static int sigusr[MAXTHREADS];
    static int sigusr_thread[MAXTHREADS];

    #define MAXPARAMETERS 100

    void* encoder_thread(void *ptr)
    {
       int param;
       const char **parameters = new const char* [MAXPARAMETERS];
       ssize_t bytes_written_debug = 0;

       int writepipe[2] = {-1,-1};
       int last_frame_read = -1;
       pid_t   childpid;

       // xxx
       if ( 0 != pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) )
       {
           fprintf(stderr,"pthread_setcancelstate could not be set\n");
       }

       param = *(int*)ptr;
       fprintf(stderr,"param = %d\n", param);

       switch (param)
       {
           ...read config file and populate parameters for child call...
       }

       while ( last_frame_written == -1 )
       {
           fprintf(stderr,"ENCODER THREAD WAITING\n");
           sleep(1);
       }

       if ( pipe(writepipe) < 0 )
       {
           ...handle error case...
       }


       if ( (childpid = fork()) < 0)
       {
           fprintf(stderr,"child failed\n");
       }
       else if ( 0 == childpid )   /* in the child */
       {
           dup2(CHILD_READ,  STDIN_FILENO);
           //close(CHILD_READ); // doesn't seem to matter
           close(PARENT_WRITE);

           execv("/usr/bin/ffmpeg",(char **)parameters);
           return;
       }
       else                /* in the parent */
       {
           fprintf(stderr,"THREAD CHILD PID: %d\n",childpid);
           close(CHILD_READ);

           while ( last_frame_written > -1 && 0==sigusr_thread[param] )
           {
               if ( last_frame_read != last_frame_written )
               {
                   // send frame to child (ffmpeg)
                   last_frame_read = last_frame_written;
                   bytes_written_debug = write(PARENT_WRITE,video_buffer[last_frame_read], buffer_size);
                   if ( bytes_written_debug < 0 )
                   {
                       fprintf(stderr, "write error\n");
                       break;
                   }
               }

               usleep(10000); // assume ~100Hz rate
           }

    /// Problems begin now: no more data from main process,
    /// Shouldn't this close "close" the pipe created with dup2 and hence EOF ffmpeg?
           if ( close(PARENT_WRITE) )
           {
               fprintf(stderr,"\n\nclose failure! wtf?\n\n\n");
           }

    // debug sleep:
    // waiting 10 sec doesn't seem to help...
    // trying to give ffmpeg some time if it needs it
           sleep(10);

    // kill never fails here:
           if ( !kill(childpid,SIGINT) )
           {
               fprintf(stderr, "\n\nkill child %d\n", childpid);
           }
           else
           {
               fprintf(stderr, "\n\nkill failed for child %d\n", childpid);
           }

           fprintf(stderr,"\n\nwaiting\n\n\n");
           int status = 0;

    // wait forever (in most cases); ps -axw shows all the ffmpeg's
           wait(&status);
       }
    }




    int main()
    {
       ...
       for ( int i = 0; i < MAXTHREADS; ++i)
       {
           sigusr[i] = 0;
           sigusr_thread[i] = 0;
           param[i] = i;
           iret = pthread_create( &thread[i], NULL, encoder_thread, (void*) &param[i] );
       }
       ...

       // Maybe this is important to the pthread signaling?
       // Don't think so because thread's SIGINT isn't picked up by signal handler (not shown)
       sigemptyset(&set);
       sigaddset(&set, SIGHUP);
       sigaddset(&set, SIGINT);
       sigaddset(&set, SIGUSR1);
       sigaddset(&set, SIGUSR2);
       sigaddset(&set, SIGALRM);

       /* block out these signals */
       sigprocmask(SIG_BLOCK, &set, NULL);

       ...read file/populate frame buffer until file exhausted...

       fprintf(stderr, "waiting for threads to exit\n");

       for ( int i = 0; i < MAXTHREADS; ++i)
       {
           sigusr_thread[i] = 1;
           pthread_join( thread[i], NULL);
       }
       fprintf(stderr, "done waiting for threads to exit\n");

       ...

       return 0;
    }

    I've embedded comments and questions in the thread's parent code after the frame buffer read/write loop.

    Hope I've provided enough detail - stackoverflow posting noob ! Thank you.

  • Android FFMPEG java concat multiple files

    17 juillet 2015, par Kim T

    I’m using a fork of the cordova-plugin-video-editor library :

    https://github.com/jbavari/cordova-plugin-video-editor/pull/13

    Which uses the android-ffmpeg-java library here :

    https://github.com/guardianproject/android-ffmpeg-java

    The out of box cordova plugin example works well to encode a single video using the following code :

    File tempFile = File.createTempFile("ffmpeg", null, appContext.getCacheDir());
    FfmpegController ffmpegController = new FfmpegController(appContext, tempFile);

    TranscodeCallback tcCallback = new TranscodeCallback();

    Clip clipIn = new Clip(videoSrcPath);
    Clip clipOut = new Clip(outputFilePath);
    clipOut.videoCodec = "libx264";
    clipOut.videoFps = "24"; // tailor this to your needs
    clipOut.videoBitrate = 512; // 512 kbps - tailor this to your needs
    clipOut.audioChannels = 1;
    clipOut.width = outputWidth;
    clipOut.height = outputHeight;
    clipOut.duration = videoDuration;
    ffmpegController.processVideo(clipIn, clipOut, true, tcCallback);

    This calls the android-ffmpeg-java code here :

    https://github.com/guardianproject/android-ffmpeg-java/blob/master/src/org/ffmpeg/android/FfmpegController.java#L225

    They have a multiple file concat test example here :

    https://github.com/guardianproject/android-ffmpeg-java/blob/master/src/org/ffmpeg/android/test/ConcatTest.java#L16

    So I have modified the cordova plugin code to match the example :

    ArrayList<clip> listVideos = new ArrayList<clip>();

    Clip clip = new Clip();
    clip.path = new File(videoSrcPath).getCanonicalPath();
    ffmpegController.getInfo(clip);
    clip.duration = 5;
    listVideos.add(clip);

    Clip clip2 = new Clip();
    clip2.path = new File(videoSrcPath2).getCanonicalPath();
    ffmpegController.getInfo(clip2);
    clip2.duration = 5;
    listVideos.add(clip2);

    Clip clipOut = new Clip();
    clipOut.path = new File(outputFilePath).getCanonicalPath();
    ffmpegController.concatAndTrimFilesMP4Stream(listVideos, clipOut, false, false, new ShellUtils.ShellCallback() {
       @Override
       public void shellOut(String shellLine) {
           System.out.println("fc>" + shellLine);
       }
       @Override
       public void processComplete(int exitValue) {
           if (exitValue &lt; 0)
               System.err.println("concat non-zero exit: " + exitValue);
       }
    });
    </clip></clip>

    However when run I get the error :

    23:15:08.498    3218-3293/com.example.hello D/VideoEditor﹕ execute method starting
    07-10 23:15:08.498    3218-3293/com.example.hello D/VideoEditor﹕ transcodeVideo firing
    07-10 23:15:08.499    3218-3293/com.example.hello D/VideoEditor﹕ options: {"fileUri":"content:\/\/com.android.providers.media.documents\/document\/video%3A23389","fileUri2":"content:\/\/com.android.providers.media.documents\/document\/video%3A23390","outputFileName":"1436584506888","quality":2,"outputFileType":1,"optimizeForNetworkUse":1,"duration":2}
    07-10 23:15:08.615    3218-3293/com.example.hello D/VideoEditor﹕ videoSrcPath: /storage/emulated/0/Movies/-a.mp4
    07-10 23:15:08.615    3218-3293/com.example.hello D/VideoEditor﹕ videoSrcPath2: /storage/emulated/0/Movies/-b.mp4
    07-10 23:15:08.618    3218-3293/com.example.hello V/VideoEditor﹕ outputFilePath: /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
    07-10 23:15:08.618    3218-3293/com.example.hello W/PluginManager﹕ THREAD WARNING: exec() call to VideoEditor.transcodeVideo blocked the main thread for 121ms. Plugin should use CordovaInterface.getThreadPool().
    07-10 23:15:09.126    3742-3742/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.506    3750-3750/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.836    3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -t 0 0 : 0 0 : 5.000000 -i /storage/emulated/0/Movies/-a.mp4 -f mpegts -c copy -an -bsf:v h264_mp4toannexb /storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts
    07-10 23:15:09.864    3758-3758/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.865    3218-3759/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.869    3218-3759/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libavutil      51. 54.100 / 51. 54.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libavcodec     54. 23.100 / 54. 23.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libavformat    54.  6.100 / 54.  6.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libavdevice    54.  0.100 / 54.  0.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libavfilter     2. 77.100 /  2. 77.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libswscale      2.  1.100 /  2.  1.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libswresample   0. 15.100 /  0. 15.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>  libpostproc    52.  0.100 / 52.  0.100
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>[NULL @ 0xb6421100] Unable to find a suitable output format for '0'
    07-10 23:15:09.870    3218-3759/com.example.hello I/System.out﹕ fc>0: Invalid argument
    07-10 23:15:09.891    3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -t 0 0 : 0 0 : 5.000000 -i /storage/emulated/0/Movies/-b.mp4 -f mpegts -c copy -an -bsf:v h264_mp4toannexb /storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts
    07-10 23:15:09.912    3762-3762/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.913    3218-3763/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.917    3218-3763/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
    07-10 23:15:09.917    3218-3763/com.example.hello I/System.out﹕ fc>  built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libavutil      51. 54.100 / 51. 54.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libavcodec     54. 23.100 / 54. 23.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libavformat    54.  6.100 / 54.  6.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libavdevice    54.  0.100 / 54.  0.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libavfilter     2. 77.100 /  2. 77.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libswscale      2.  1.100 /  2.  1.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libswresample   0. 15.100 /  0. 15.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>  libpostproc    52.  0.100 / 52.  0.100
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>[NULL @ 0xb6321100] Unable to find a suitable output format for '0'
    07-10 23:15:09.918    3218-3763/com.example.hello I/System.out﹕ fc>0: Invalid argument
    07-10 23:15:09.940    3218-3264/com.example.hello I/System.out﹕ fc>/data/data/com.example.hello/app_bin/ffmpeg -y -i concat:/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts|/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts -c copy -an /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
    07-10 23:15:09.963    3766-3766/? W/linker﹕ /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.964    3218-3767/com.example.hello I/System.out﹕ fc>WARNING: linker: /data/data/com.example.hello/app_bin/ffmpeg has text relocations. This is wasting memory and prevents security hardening. Please fix.
    07-10 23:15:09.971    3218-3767/com.example.hello I/System.out﹕ fc>ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
    07-10 23:15:09.972    3218-3767/com.example.hello I/System.out﹕ fc>  built on Dec 22 2014 12:52:34 with gcc 4.6 20120106 (prerelease)
    07-10 23:15:09.972    3218-3767/com.example.hello I/System.out﹕ fc>  configuration: --arch=arm --cpu=cortex-a8 --target-os=linux --enable-runtime-cpudetect --prefix=/data/data/info.guardianproject.ffmpeg/app_opt --enable-pic --disable-shared --enable-static --cross-prefix=/home/n8fr8/dev/android/ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi- --sysroot=/home/n8fr8/dev/android/ndk/platforms/android-16/arch-arm --extra-cflags='-I../x264 -mfloat-abi=softfp -mfpu=neon -fPIE -pie' --extra-ldflags='-L../x264 -fPIE -pie' --enable-version3 --enable-gpl --disable-doc --enable-yasm --enable-decoders --enable-encoders --enable-muxers --enable-demuxers --enable-parsers --enable-protocols --enable-filters --enable-avresample --enable-libfreetype --disable-indevs --enable-indev=lavfi --disable-outdevs --enable-hwaccels --enable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-network --enable-libx264 --enable-zlib
    07-10 23:15:09.973    3218-3767/com.example.hello I/System.out﹕ fc>  libavutil      51. 54.100 / 51. 54.100
    07-10 23:15:09.973    3218-3767/com.example.hello I/System.out﹕ fc>  libavcodec     54. 23.100 / 54. 23.100
    07-10 23:15:09.974    3218-3767/com.example.hello I/System.out﹕ fc>  libavformat    54.  6.100 / 54.  6.100
    07-10 23:15:09.974    3218-3767/com.example.hello I/System.out﹕ fc>  libavdevice    54.  0.100 / 54.  0.100
    07-10 23:15:09.974    3218-3767/com.example.hello I/System.out﹕ fc>  libavfilter     2. 77.100 /  2. 77.100
    07-10 23:15:09.975    3218-3767/com.example.hello I/System.out﹕ fc>  libswscale      2.  1.100 /  2.  1.100
    07-10 23:15:09.976    3218-3767/com.example.hello I/System.out﹕ fc>  libswresample   0. 15.100 /  0. 15.100
    07-10 23:15:09.976    3218-3767/com.example.hello I/System.out﹕ fc>  libpostproc    52.  0.100 / 52.  0.100
    07-10 23:15:09.976    3218-3767/com.example.hello I/System.out﹕ fc>concat:/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/0.ts|/storage/emulated/0/Android/data/com.example.hello/cache/ffmpeg-246029513.tmp/1.ts: Not a directory
    07-10 23:15:09.981    3218-3264/com.example.hello D/VideoEditor﹕ transcode exception
       java.lang.Exception: There was a problem rendering the video: /storage/emulated/0/Movies/HelloWorld/VID_1436584506888.mp4
               at org.ffmpeg.android.FfmpegController.concatAndTrimFilesMP4Stream(FfmpegController.java:1272)
               at org.apache.cordova.videoeditor.VideoEditor$1.run(VideoEditor.java:257)
               at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
               at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
               at java.lang.Thread.run(Thread.java:818)

    I’m not sure why it says ’Not a directory’ ? Surely it’s valid because the files are created at the previous step ?