Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (50)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

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

Sur d’autres sites (3755)

  • Decoding audio w/ ffmpeg error on Android

    14 août 2012, par stranded

    Well, I knew I was going out of my comfort zone when I decided to try and decode audio using ffmpeg on Android but now I will have to admit that I'm stranded.
    It took me many days to just build ffmpeg for Android. Roman's10 guide did not work for me but finally things started looking up, thanks to this tutorial. So because of Dmitry's help I managed to build the armeabi version (not armeabi-v7) for my phone (LG P500) and everything basic works.

    But when I try to use avcodec_decode_audio3() things go downhill :( Never before have I felt so close to making things work (after all it seems to be only one line that is troublesome)
    but unable to though. I've read many questions here on SO that have brought me closer to the goal. Googling, on the other hand, has had limited results - making questions here the only fruit.

    Yes, I know ! I ramble. But I can't help it, I'm only trying to explain in detail where I'm stuck and how I got there. So without further ado I bring you the code :

    NATIVE CODE :

    #include
    #include <android></android>log.h>

    #include "libavcodec/avcodec.h"
    #include "libavformat/avformat.h"

    #define LOG_TAG "mylib"
    #define LOGI(...)  __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
    #define LOGE(...)  __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)

    #define INBUFF_SIZE 4096
    #define AUDIO_INBUFF 20480
    #define AUDIO_REFILL_SIZE 4096

    jint Java_com_nothingworks_for_me_MainActivity_decode(JNIEnv * env, jobject this, jstring jfilename){
       const char *filename = (*env)->GetStringUTFChars(env, jfilename, NULL);
       AVCodec *codec;
       AVCodecContext *c= NULL;
       int audioStream;
       int out_size, len, i;
       FILE *f, *outfile;
       uint8_t *outbuf;
       uint8_t inbuf[AUDIO_INBUFF + FF_INPUT_BUFFER_PADDING_SIZE];
       AVPacket avpkt;
       AVFormatContext *pFormatCtx;

       av_register_all();
       avcodec_init();
       av_init_packet(&amp;avpkt);

       if(av_open_input_file(&amp;pFormatCtx, filename, NULL, 0, NULL)!=0)
       {
           LOGE("Can&#39;t open file &#39;%s&#39;\n", filename);
           return 1;
       }
       else
       {
           LOGI("File was opened\n");
           LOGI("File &#39;%s&#39;, Codec %s",
                   pFormatCtx->filename,
                   pFormatCtx->iformat->name
           );
       }

       if (av_find_stream_info(pFormatCtx) &lt; 0){
           LOGE("Can&#39;t find stream info");
       }
       audioStream = -1;
       for (i = 0; i &lt; pFormatCtx->nb_streams; i++) {
           if (pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
               audioStream = i;
               break;
           }
       }

       if (audioStream == -1) {
           LOGE("Didn&#39;t find stream!");
       }
       c = pFormatCtx->streams[audioStream]->codec;

       codec = avcodec_find_decoder(c->codec_id);
       if (!codec) {
           LOGE("Unsupported Codec!");
       }

       c= avcodec_alloc_context();

       /* open it */
       if (avcodec_open(c, codec) &lt; 0) {
           LOGE("Can&#39;t open codec");
           exit(1);
       }

       outbuf = av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE * 2);

       f = fopen(filename, "rb");
       if (!f) {
           LOGE("Can&#39;t open file");
           exit(1);
       }

       /* decode until eof */
       avpkt.data = inbuf;
       avpkt.size = fread(inbuf, 1, AUDIO_INBUFF, f);
       LOGI("avpkt.size %d", avpkt.size);

       while (avpkt.size > 0) {
           out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE * 2;

    THINGS GO WRONG HERE ! avcodec_decode_audio3() The code continues from ▲ to ▼ :

           len = avcodec_decode_audio3(c, (int16_t *)outbuf, &amp;out_size, &amp;avpkt);
           LOGI("data_size %d len %d", out_size, len);
           if (len &lt; 0) {
               LOGE("Error while decoding");
               exit(1);
           }
           if (out_size > 0) {

           }
           avpkt.size -= len;
           avpkt.data += len;
           if (avpkt.size &lt; AUDIO_REFILL_SIZE) {
               /* Refill the input buffer, to avoid trying to decode
                * incomplete frames. Instead of this, one could also use
                * a parser, or use a proper container format through
                * libavformat. */
               memmove(inbuf, avpkt.data, avpkt.size);
               avpkt.data = inbuf;
               len = fread(avpkt.data + avpkt.size, 1,
                       AUDIO_INBUFF - avpkt.size, f);
               if (len > 0)
                   avpkt.size += len;
           }
       }
       fclose(f);
       free(outbuf);

       avcodec_close(c);
       av_free(c);
       return 0;
    }

    What happens is that avcodec_decode_audio3() returns -1 and that's pretty much it :(
    I have no idea what to do next. I can't find much info about this and I only started fiddling with C less than two weeks ago so your guidance is my only hope now [play dramatic sound]. Hope someone can shed a little light on this mystery.

    Ohh ! And the native code is some kind of a hybrid between what I have found here on SO, like this and this, and the ffmpeg example. On the java side I only have a call to this native method and pass it string which is the path to a MP3 song on my droid. I don't use AudioTrack or anything else in my java code yet 'cause I'm only trying to get the decoding to work for now.

    -Drama Queen OUT !

  • Video becomes choppy when the order in the hstack filter is changed

    25 octobre 2018, par Mayank

    I have a FFmpeg command wherein I am merging 2 videos side by side using hstack filter. When I place first video on the right hand side and second video on the left hand side, the final merged video is perfect in quality and plays smoothly.

    However, when I swap the order in hstack filter, the final video is very choppy.

    Can someone please let me know the issue in this command ? Many thanks in advance.

    Also, the file size of the non working file is almost double than that of working file. Can you explain why ?

    Here is the working command :

    ffmpeg -i 1_a.opus -i 2_a.opus -itsoffset 0.024 -i 1_v.mp4 -itsoffset 0.113 -i 2_v.mp4 -filter_complex "[1:a]adelay=15646|15646[a1]; [0:a][a1]amix; [3:v]trim=0:15.646,geq=0:128:128[silence]; [3:v]fifo[3v]; [silence][3v]concat[3_v_silence]; [3_v_silence][2:v]hstack" -preset ultrafast -y n_m_bars_try2.mp4

    output :

    ffmpeg version 4.0.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
     configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
     libavutil      56. 14.100 / 56. 14.100
     libavcodec     58. 18.100 / 58. 18.100
     libavformat    58. 12.100 / 58. 12.100
     libavdevice    58.  3.100 / 58.  3.100
     libavfilter     7. 16.100 /  7. 16.100
     libswscale      5.  1.100 /  5.  1.100
     libswresample   3.  1.100 /  3.  1.100
     libpostproc    55.  1.100 / 55.  1.100
    Input #0, ogg, from '1_a.opus':
     Duration: 00:01:03.82, start: -0.020000, bitrate: 37 kb/s
       Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Input #1, ogg, from '2_a.opus':
     Duration: 00:00:52.40, start: -0.020000, bitrate: 44 kb/s
       Stream #1:0: Audio: opus, 48000 Hz, stereo, fltp
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '1_v.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.12.100
     Duration: 00:01:03.85, start: 0.000000, bitrate: 2644 kb/s
       Stream #2:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 2633 kb/s, 333 fps, 333 tbr, 10656 tbn, 666 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '2_v.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.12.100
     Duration: 00:00:52.32, start: 0.000000, bitrate: 861 kb/s
       Stream #3:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 860 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Stream mapping:
     Stream #0:0 (opus) -> amix:input0
     Stream #1:0 (opus) -> adelay
     Stream #2:0 (h264) -> hstack:input1
     Stream #3:0 (h264) -> trim
     Stream #3:0 (h264) -> fifo
     amix -> Stream #0:0 (aac)
     hstack -> Stream #0:1 (libx264)
    Press [q] to stop, [?] for help
    [libx264 @ 0x528d600] using SAR=1/1
    [libx264 @ 0x528d600] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
    [libx264 @ 0x528d600] profile Constrained Baseline, level 3.1
    [libx264 @ 0x528d600] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
    Output #0, mp4, to 'navid_mayank_bars_try2.mp4':
     Metadata:
       encoder         : Lavf58.12.100
       Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         encoder         : Lavc58.18.100 aac
       Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x480 [SAR 1:1 DAR 8:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
       Metadata:
         encoder         : Lavc58.18.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    frame= 1704 fps= 42 q=-1.0 Lsize=   14440kB time=00:01:08.12 bitrate=1736.5kbits/s dup=3 drop=21229 speed=1.69x    
    video:13448kB audio:953kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.269503%
    [aac @ 0x52b8680] Qavg: 22255.799
    [libx264 @ 0x528d600] frame I:7     Avg QP:16.29  size: 46284
    [libx264 @ 0x528d600] frame P:1697  Avg QP:18.36  size:  7924
    [libx264 @ 0x528d600] mb I  I16..4: 100.0%  0.0%  0.0%
    [libx264 @ 0x528d600] mb P  I16..4:  1.8%  0.0%  0.0%  P16..4: 31.0%  0.0%  0.0%  0.0%  0.0%    skip:67.2%
    [libx264 @ 0x528d600] coded y,uvDC,uvAC intra: 29.9% 59.3% 17.5% inter: 13.4% 24.6% 0.8%
    [libx264 @ 0x528d600] i16 v,h,dc,p: 36% 29% 18% 17%
    [libx264 @ 0x528d600] i8c dc,h,v,p: 42% 25% 21% 11%
    [libx264 @ 0x528d600] kb/s:1616.23

    Non working command :

    ffmpeg -i 1_a.opus -i 2_a.opus -itsoffset 0.024 -i 1_v.mp4 -itsoffset 0.113 -i 2_v.mp4 -filter_complex "[1:a]adelay=15646|15646[a1]; [0:a][a1]amix; [3:v]trim=0:15.646,geq=0:128:128[silence]; [3:v]fifo[3v]; [silence][3v]concat[3_v_silence]; [2:v][3_v_silence]hstack" -preset ultrafast -y m_n_bars_try2.mp4

    output :

    ffmpeg version 4.0.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
     configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
     libavutil      56. 14.100 / 56. 14.100
     libavcodec     58. 18.100 / 58. 18.100
     libavformat    58. 12.100 / 58. 12.100
     libavdevice    58.  3.100 / 58.  3.100
     libavfilter     7. 16.100 /  7. 16.100
     libswscale      5.  1.100 /  5.  1.100
     libswresample   3.  1.100 /  3.  1.100
     libpostproc    55.  1.100 / 55.  1.100
    Input #0, ogg, from '1_a.opus':
     Duration: 00:01:03.82, start: -0.020000, bitrate: 37 kb/s
       Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Input #1, ogg, from '2_a.opus':
     Duration: 00:00:52.40, start: -0.020000, bitrate: 44 kb/s
       Stream #1:0: Audio: opus, 48000 Hz, stereo, fltp
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '1_v.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.12.100
     Duration: 00:01:03.85, start: 0.000000, bitrate: 2644 kb/s
       Stream #2:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 2633 kb/s, 333 fps, 333 tbr, 10656 tbn, 666 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '2_v.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.12.100
     Duration: 00:00:52.32, start: 0.000000, bitrate: 861 kb/s
       Stream #3:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 860 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Stream mapping:
     Stream #0:0 (opus) -> amix:input0
     Stream #1:0 (opus) -> adelay
     Stream #2:0 (h264) -> hstack:input0
     Stream #3:0 (h264) -> trim
     Stream #3:0 (h264) -> fifo
     amix -> Stream #0:0 (aac)
     hstack -> Stream #0:1 (libx264)
    Press [q] to stop, [?] for help
    [libx264 @ 0x6d21600] using SAR=1/1
    [libx264 @ 0x6d21600] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
    [libx264 @ 0x6d21600] profile Constrained Baseline, level 5.1
    [libx264 @ 0x6d21600] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
    Output #0, mp4, to 'mayank_navid_bars_try2.mp4':
     Metadata:
       encoder         : Lavf58.12.100
       Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         encoder         : Lavc58.18.100 aac
       Stream #0:1: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x480 [SAR 1:1 DAR 8:3], q=-1--1, 333 fps, 10656 tbn, 333 tbc (default)
       Metadata:
         encoder         : Lavc58.18.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Past duration 0.999992 too large
       Last message repeated 12 times
    More than 1000 frames duplicated   33280kB time=00:01:08.03 bitrate=4007.4kbits/s dup=982 drop=1590 speed=0.536x    
    frame=22679 fps=177 q=-1.0 Lsize=   33892kB time=00:01:08.10 bitrate=4076.9kbits/s dup=1339 drop=1590 speed=0.531x    
    video:32804kB audio:953kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.401324%
    [aac @ 0x6d4c680] Qavg: 22255.799
    [libx264 @ 0x6d21600] frame I:91    Avg QP:15.31  size: 51639
    [libx264 @ 0x6d21600] frame P:22588 Avg QP:18.24  size:  1279
    [libx264 @ 0x6d21600] mb I  I16..4: 100.0%  0.0%  0.0%
    [libx264 @ 0x6d21600] mb P  I16..4:  0.2%  0.0%  0.0%  P16..4: 13.0%  0.0%  0.0%  0.0%  0.0%    skip:86.8%
    [libx264 @ 0x6d21600] coded y,uvDC,uvAC intra: 44.9% 54.0% 29.9% inter: 2.0% 10.9% 0.1%
    [libx264 @ 0x6d21600] i16 v,h,dc,p: 45% 24% 13% 18%
    [libx264 @ 0x6d21600] i8c dc,h,v,p: 51% 20% 18% 11%
    [libx264 @ 0x6d21600] kb/s:3945.79
  • when ffpmeg drops frames some things aren't played back in real time

    8 février 2024, par Alex028502

    I am trying to run a bunch of ffpmeg processes that act as simulators for cameras, and something funny is happening when I the processor can't keep up with the configured frame rate.

    &#xA;

    I have replaced the rtsp stream with an output file, and managed to reproduce the issue, so will just show that to keep it simple.

    &#xA;

    First here is a makefile that creates my source movie :

    &#xA;

    clock.mp4: Makefile&#xA;    rm -f $@&#xA;    ffmpeg -f lavfi -i color=c=black:s=4096x2160:r=25 -vf \&#xA;"drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=72:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2: \&#xA;text=&#x27;%{eif\:trunc(n/25)\:d}&#x27;:start_number=0:rate=25" \&#xA;-t 60 -r 25 $@&#xA;

    &#xA;

    that gives me a one minute long movie that prints the second number to the screen. I have tested it out and the seconds are close enough. I put a lot of pixels to make it easier to jam up my CPU.

    &#xA;

    Here is the script that creates a processes similar to the one I am trying to debug (called experiment.sh)

    &#xA;

    I am actually using H.264, but H.265 is easier to overwhelm the processor with

    &#xA;

    #! /usr/bin/env bash&#xA;&#xA;set -e&#xA;&#xA;echo starting > message$1.txt&#xA;&#xA;rm -f superclock$1.mp4&#xA;ffmpeg -re -stream_loop -1 -i clock.mp4 \&#xA;       -an -vcodec libx265 -preset ultrafast -sc_threshold -1 -x265-params repeat-headers=1 \&#xA;       -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=24:fontcolor=white:x=10:y=10:text=&#x27;%{localtime\:%X}&#x27;, \&#xA;            drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=24:fontcolor=white:x=10:y=(h-text_h-10):textfile=message$1.txt:reload=1, \&#xA;            scale=1920x1080,fps=25" \&#xA;       -b:v 3M -minrate 3M -maxrate 3M \&#xA;       -bufsize 6M -g 25 superclock$1.mp4 &amp;&#xA;pid=$!&#xA;&#xA;for x in $(seq 0 10)&#xA;do&#xA;    echo $x > message$1.txt&#xA;    sleep 10&#xA;done&#xA;&#xA;kill -INT $pid || true&#xA;

    &#xA;

    It should

    &#xA;

      &#xA;
    • put the second in the middle of the screen - 'cause it gets it from the source video
    • &#xA;

    • put the approximate sixth of minute in the lower left corner&#xA;(only approximate because of the sleep but close enough)
    • &#xA;

    • put the the wall clock time in the upper left corner
    • &#xA;

    &#xA;

    and it works

    &#xA;

    make clock.mpg&#xA;./experiment.sh 0&#xA;vlc superclock0.mp4&#xA;

    &#xA;

    shows something like this&#xA;working video

    &#xA;

    Now here is the interesting part

    &#xA;

    If I run the script in four different terminals at the same time

    &#xA;

    ./experiment.sh 1&#xA;./experiment.sh 2&#xA;./experiment.sh 3&#xA;./experiment.sh 4&#xA;

    &#xA;

    It can't keep up with the frame rate, and I see this in the output :

    &#xA;

    frame= 1515 fps= 16 q=0.0 size=     768kB time=00:00:59.96 bitrate= 104.9k&#xA;

    &#xA;

    I was hoping the end result would all look ok when I watch it except with fewer frames, but the timestamps of the frames would make it all work as expected

    &#xA;

    However...

    &#xA;

      &#xA;
    • The time in the middle, that is inherited from the source video, the seconds in the middle of the screen, stays in sync with VLC's clock.
    • &#xA;

    • the wall clock in the upper left seems play at 150% speed
    • &#xA;

    • the every ten seconds incrementor in the lower left seems to increment every 7 seconds
    • &#xA;

    • the video is only 1:25 long even though it was recording for at least 1:40 according to sleeps
    • &#xA;

    • the wall clock in the upper right hand corner makes it more than 1'40" and then counter in the lower left makes it to 10.
    • &#xA;

    &#xA;

    30 seconds in

    &#xA;

    Here are four states to compare

    &#xA;

    |                  | Start    | 30" in   | end      |&#xA;|------------------&#x2B;----------&#x2B;----------|----------|&#xA;| Video Time       | 00:00    | 00:30    | 01:24    |&#xA;| Wall Clock Time  | 15:05:50 | 15:06:39 | 15:07:39 |&#xA;| sixth of minute  | 0        | 4        | 10       |&#xA;| seconds counter  | 0        | 30       | 24       |&#xA;

    &#xA;

    end of the movie

    &#xA;

    So you can see the vlc clock keeps pace with the original clock from the source movie.. even when it is only able to produce frames at 2/3 of the rate. However, the it is taking 50% long to get through the whole source movie I guess ?

    &#xA;

    I am having trouble coming up with a theory that can explain exactly how this happens.

    &#xA;

    Does anybody know how I can "correct" this ? (make it so that the movie is played at the same rate that it is recorded)

    &#xA;

    I am thinking of using a lower frame rate and size as the input video.. but it would be nice to have something that will always work as expected, just with a lower frame rate, no matter how busy the processor is.

    &#xA;