Recherche avancée

Médias (0)

Mot : - Tags -/configuration

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

Autres articles (28)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Installation en mode standalone

    4 février 2011, par

    L’installation de la distribution MediaSPIP se fait en plusieurs étapes : la récupération des fichiers nécessaires. À ce moment là deux méthodes sont possibles : en installant l’archive ZIP contenant l’ensemble de la distribution ; via SVN en récupérant les sources de chaque modules séparément ; la préconfiguration ; l’installation définitive ;
    [mediaspip_zip]Installation de l’archive ZIP de MediaSPIP
    Ce mode d’installation est la méthode la plus simple afin d’installer l’ensemble de la distribution (...)

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

Sur d’autres sites (2422)

  • Different code(.java file) for different platform ?

    2 mars 2016, par AR792

    I have a code where image data is passed from bitmap to FFmpeg frame recorder and converted to a video. But i need to make small changes while running it on LG G3(armv7) from Asus zenfone 5(x86).

    Following are the class variables that create the issue :(declared under, class Main Activity)

    inputWidth = 1024 ;

    inputHeight = 650 ;

    Following is the method where the issue occurs :

    byte [] getNV21(int inputWidth, int inputHeight, Bitmap bitmap) {

       int [] argb = new int[inputWidth * inputHeight];

       bitmap.getPixels(argb, 0, inputWidth, 0, 0, inputWidth, inputHeight);

       byte [] yuv = new byte[inputWidth*inputHeight*3/2];
       encodeYUV420SP(yuv, argb, inputWidth, inputHeight);

       return yuv;
    }

    void encodeYUV420SP(byte[] yuv420sp, int[] argb, int width, int height) {
       final int frameSize = width * height;

       int yIndex = 0;
       int uvIndex = frameSize;

       int a, R, G, B, Y, U, V;
       int index = 0;
       for (int j = 0; j < height; j++) {
           for (int i = 0; i < width; i++) {

               a = (argb[index] & 0xff000000) >> 24; // a is not used obviously
               R = (argb[index] & 0xff0000) >> 16;
               G = (argb[index] & 0xff00) >> 8;
               B = (argb[index] & 0xff) >> 0;

               // well known RGB to YUV algorithm
               Y = ( (  66 * R + 129 * G +  25 * B + 128) >> 8) +  16;
               U = ( ( -38 * R -  74 * G + 112 * B + 128) >> 8) + 128;
               V = ( ( 112 * R -  94 * G -  18 * B + 128) >> 8) + 128;

               // NV21 has a plane of Y and interleaved planes of VU each sampled by a factor of 2
               //    meaning for every 4 Y pixels there are 1 V and 1 U.  Note the sampling is every other
               //    pixel AND every other scanline.
               yuv420sp[yIndex++] = (byte) ((Y < 0) ? 0 : ((Y > 255) ? 255 : Y));
               if (j % 2 == 0 && index % 2 == 0) {
                   yuv420sp[uvIndex++] = (byte)((V<0) ? 0 : ((V > 255) ? 255 : V));
                   yuv420sp[uvIndex++] = (byte)((U<0) ? 0 : ((U > 255) ? 255 : U));
               }

               index ++;
           }
       }
    }

    Working CODE :

    LG G3 :I can use the above variables at any place in the code to get the required output.
    Bitmap size returned = 2734200

    Asus Zenfone 5 : Except at creating the bitmap, I have to use everywhere else bitmap.getHeight() and bitmap.getWidth(), to get the required output.

    Surprisingly here Bitmap size returned = 725760 (So its not setting according to set bitmap parameters ?)

    INCORRECT CODE :

    LG G3 : IF i use bitmap.getHeight() and bitmap.getWidth(), i get java.lang.ArrayIndexOutOfBoundsException : length = 102354 , index = 102354. @getNV21 method

    Asus Zenfone 5 : If i use inputWidth , inputHeight i get
    java.lang.IllegalArgumentException : x + width must be <= bitmap.width() @getNV21 method

    How can i generalize the above code for both phones ?

  • What is the optimal way to synchronize frames in ffmpeg c/c++ ?

    16 septembre 2022, par Turgut

    I made a program that read's n number of video's as input, draws those videos to the GLFW window and finally encodes it all as a singular video output. The problem is frames of each video in question can be different, it's dependent on the user's input.

    &#xA;

    For example : the user can put two video's which has an FPS of 30 and 59, and can want an output 23,797. The problem is those video's are not in sync with each other, thus on the output we can see that the input video's are either faster or slower.

    &#xA;

    Duration of each video is also dependent on the input. For example, in accordance to the previous example, the first input might be 30 second and the second can be 13 second, while the output is 50 seconds.

    &#xA;

    I mostly read the frames similar to a moving png rather than a solid video since there are no iframe and bframes. There are just data I get from the GLFW window.

    &#xA;

    As an example, let's say we give one video as input which has an FPS of 30 and duration of 30, and our output has an FPS of 23.797 and duration of 30. I have 2 function's skip_frame and wait_frame which respectively either read's a frame twice so we skip a frame or don't read the frame on that iteration. Those function's are used depending on the situation, whether it's output < input or output > input.

    &#xA;

    Here is what my code roughly looks like :

    &#xA;

    while(current_time &lt; output_duration){&#xA;   for(auto input_video: all_inputs){&#xA;      for(int i = 0; i &lt; amount_to_read_from_input(); i&#x2B;&#x2B;){&#xA;         frame = input_video.read_frame();&#xA;      }&#xA;   }&#xA;   &#xA;   GLFW_window.draw_to_screen(frame);&#xA;&#xA;   encoder.encode_one_video_frame(GLFW_window.read_window());&#xA;}&#xA;

    &#xA;

    Basically skip_frame and wait_frame are both inside amount_to_read_from_input() and return 2 or 0 respectively.

    &#xA;

    So far I have tried multiplying duration with fps for both input and output. Then getting the result of their subtraction. Going from our previous example we get 900 - 714 = 186.&#xA;Then I divide the result to the output fps like so : 714 / 186 = 3.8. Meaning that I have to skip a frame every 3.8 iterations. (I skip a frame every 3 iterations and save the residual 0.8 for the next iter.)

    &#xA;

    But it's still a seconds or two behind. (Like it ends at 29 seconds for a 30 second output.) and the audio is out-of-sync. Ffmpeg handles my audio so there are no errors on that part.

    &#xA;

    Also seen this question but I don't think I can utilize ffmpeg's function's here since im reading from a glfw window and it comes down to my algorithm.

    &#xA;

    The problem is what is the math here ?

    &#xA;

    What can I do to make sure these frames are stabilized on almost every input/output combination ?

    &#xA;

  • FFMPEG RTMP STREAM RECORDING TIMEOUT

    11 novembre 2020, par abreski

    [SOLVED] — solution in FINAL EDIT&#xA;i am recording an rtmp livestream with ffmpeg, and looking to add a flag that will automatically stop processing the moment new data stops arriving.

    &#xA;

    If i start and stop the script (stop by killing the process on demand), everything is fine, recording is saved and can be played.&#xA;However, when the stream is stopped from the source without a manual call to STOP, the script will still run for a bit and the resulting file will be corrupted (tested with manual stop call - works , and with stopping the stream before the recording , simulating browser/tab close or disconnect - fails)

    &#xA;

    the command i'm running

    &#xA;

    $command = "ffmpeg -i {$rtmpUrl} -c:v copy -c:a copy -t 3600 {$path} >/dev/null  2>/dev/null &amp;";&#xA;$res = shell_exec($command)&#xA;

    &#xA;

    i tried adding -timeout 0 option before and after the input like this

    &#xA;

    $command = "ffmpeg -timeout 0 -i {$rtmpUrl} -c:v copy -c:a copy -t 3600 {$path} >/dev/null  2>/dev/null &amp;"; &#xA;

    &#xA;

    and

    &#xA;

    $command = "ffmpeg -i {$rtmpUrl} -c:v copy -c:a copy -timeout 0 -t 3600 {$path} >/dev/null  2>/dev/null &amp;";&#xA;

    &#xA;

    but no improvement.

    &#xA;

    What am i missing here ? is there any way to automatically stop the script when new data stops ariving from the livestream (meaning that stream is stopped and recording should stop aswell).

    &#xA;

    Note $rtmpUrl and $path have been checked and everything works fine as long as the script is stopped before the livestream ends.

    &#xA;

    Any suggestions are highly appreciated

    &#xA;

    LATER EDIT : realised timeout was set in the wrong place, added it first but result was still the same, so still looking for any suggestions

    &#xA;

    $command = "timout 0 ffmpeg -i {$rtmpUrl} -c:v copy -c:a copy -t 3600 {$path} >/dev/null  2>/dev/null &amp;";&#xA;

    &#xA;

    FINAL EDIT&#xA;in case someone finds this thread looking for a solution in a similar case,&#xA;solved, timeout was not what i was looking for, instead using the -re flag fixed it for us.&#xA;Now script stops when no more new frames come in

    &#xA;

    $command = "ffmpeg -re -i {$rtmpUrl} -c:v copy -c:a copy -t 3600 {$path} >/dev/null  2>/dev/null &amp;";&#xA;

    &#xA;