Recherche avancée

Médias (91)

Autres articles (28)

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

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Taille des images et des logos définissables

    9 février 2011, par

    Dans beaucoup d’endroits du site, logos et images sont redimensionnées pour correspondre aux emplacements définis par les thèmes. L’ensemble des ces tailles pouvant changer d’un thème à un autre peuvent être définies directement dans le thème et éviter ainsi à l’utilisateur de devoir les configurer manuellement après avoir changé l’apparence de son site.
    Ces tailles d’images sont également disponibles dans la configuration spécifique de MediaSPIP Core. La taille maximale du logo du site en pixels, on permet (...)

Sur d’autres sites (4285)

  • Is it possible to automate ffmpeg-normalize in java ?

    6 avril 2019, par Saad

    I need to use ffmpeg-normalize (https://github.com/slhck/ffmpeg-normalize) to properly normalize audio files in my java program but ffmpeg-normalize requires manual installation and command usage.

    I thought I could automate it in java using ProcessBuilder but it’s been proving somewhat impossible.

    ffmpeg-normalize is written in python, so I tried every stackoverflow question that relates to running python commands in java. None of them worked, it seems windows just refuses to allow java to run commands in general.

    I added python to my environment variables as well. No dice. Windows keeps telling me it doesn’t recognize python nor py nor pip as valid internal or external commands.

    This is my final code, I tried all other solutions before this including Runtime.exe, using "cmd /c start", and all other derivatives of that.

    My last attempt was running a .bat file from the java cmd processor and have the .bat do the rest, but not only is that windows only, but also fails.

    Running pip in a cmd from cmd.exe directly (outside the java program I mean), it runs properly and shows me the help menu for pip. When the cmd opens from the java app, windows refuses to acknowledge the existence of python all together like in the image below.

    .

                   Process process = Runtime.getRuntime().exec("cmd /c start " + installerBat.getAbsolutePath(), null, ffNormExtractDir);
                   StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream());
                   StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream());
                   errorGobbler.start();
                   outputGobbler.start();
                   try {
                       process.waitFor();
                   } catch (InterruptedException e) {
                       e.printStackTrace();
                   }
               }

    I expected the java-born cmd to run the commands instantly and perfectly, but it simply refuses to run them.

    So what is my best approach to make installing ffmpeg-normalize a breeze to the user ?

  • How to encode using the FFMpeg in Android (using H263)

    10 mai 2019, par Kenny910

    I am trying to follow the sample code on encoding in the ffmpeg document and successfully build a application to encode and generate a mp4 file but I face the following problems :

    1) I am using the H263 for encoding but I can only set the width and height of the AVCodecContext to 176x144, for other case (like 720x480 or 640x480) it will return fail.

    2) I can’t play the output mp4 file by using the default Android player, isn’t it support H263 mp4 file ? p.s. I can play it by using other player

    3) Is there any sample code on encoding other video frame to make a new video (which mean decode the video and encode it back in different quality setting, also i would like to modify the frame content) ?

    Here is my code, thanks !

    JNIEXPORT jint JNICALL Java_com_ffmpeg_encoder_FFEncoder_nativeEncoder(JNIEnv* env, jobject thiz, jstring filename){

    LOGI("nativeEncoder()");

    avcodec_register_all();
    avcodec_init();
    av_register_all();

    AVCodec         *codec;
    AVCodecContext  *codecCtx;
    int             i;
    int             out_size;
    int             size;
    int             x;
    int             y;
    int             output_buffer_size;
    FILE            *file;
    AVFrame         *picture;
    uint8_t         *output_buffer;
    uint8_t         *picture_buffer;

    /* Manual Variables */
    int             l;
    int             fps = 30;
    int             videoLength = 5;

    /* find the H263 video encoder */
    codec = avcodec_find_encoder(CODEC_ID_H263);
    if (!codec) {
       LOGI("avcodec_find_encoder() run fail.");
    }

    codecCtx = avcodec_alloc_context();
    picture = avcodec_alloc_frame();

    /* put sample parameters */
    codecCtx->bit_rate = 400000;
    /* resolution must be a multiple of two */
    codecCtx->width = 176;
    codecCtx->height = 144;
    /* frames per second */
    codecCtx->time_base = (AVRational){1,fps};
    codecCtx->pix_fmt = PIX_FMT_YUV420P;
    codecCtx->codec_id = CODEC_ID_H263;
    codecCtx->codec_type = AVMEDIA_TYPE_VIDEO;

    /* open it */
    if (avcodec_open(codecCtx, codec) < 0) {
       LOGI("avcodec_open() run fail.");
    }

    const char* mfileName = (*env)->GetStringUTFChars(env, filename, 0);

    file = fopen(mfileName, "wb");
    if (!file) {
       LOGI("fopen() run fail.");
    }

    (*env)->ReleaseStringUTFChars(env, filename, mfileName);

    /* alloc image and output buffer */
    output_buffer_size = 100000;
    output_buffer = malloc(output_buffer_size);

    size = codecCtx->width * codecCtx->height;
    picture_buffer = malloc((size * 3) / 2); /* size for YUV 420 */

    picture->data[0] = picture_buffer;
    picture->data[1] = picture->data[0] + size;
    picture->data[2] = picture->data[1] + size / 4;
    picture->linesize[0] = codecCtx->width;
    picture->linesize[1] = codecCtx->width / 2;
    picture->linesize[2] = codecCtx->width / 2;

    for(l=0;l/encode 1 second of video
       for(i=0;i/prepare a dummy image YCbCr
           //Y
           for(y=0;yheight;y++) {
               for(x=0;xwidth;x++) {
                   picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
               }
           }

           //Cb and Cr
           for(y=0;yheight/2;y++) {
               for(x=0;xwidth/2;x++) {
                   picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
                   picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
               }
           }

           //encode the image
           out_size = avcodec_encode_video(codecCtx, output_buffer, output_buffer_size, picture);
           fwrite(output_buffer, 1, out_size, file);
       }

       //get the delayed frames
       for(; out_size; i++) {
           out_size = avcodec_encode_video(codecCtx, output_buffer, output_buffer_size, NULL);
           fwrite(output_buffer, 1, out_size, file);
       }
    }

    //add sequence end code to have a real mpeg file
    output_buffer[0] = 0x00;
    output_buffer[1] = 0x00;
    output_buffer[2] = 0x01;
    output_buffer[3] = 0xb7;

    fwrite(output_buffer, 1, 4, file);
    fclose(file);
    free(picture_buffer);
    free(output_buffer);
    avcodec_close(codecCtx);
    av_free(codecCtx);
    av_free(picture);

    LOGI("finish");

    return 0; }
  • ffmpeg h264 interesting bright video fail ?

    23 novembre 2019, par Max Paython

    I am trying streaming with ffmpeg using the information I found here.

    • Server

      ffmpeg -f dshow -i video="john":audio="doe" -vcodec libx264
      -preset ultrafast -tune zerolatency -acodec aac -f mpegts udp://localhost:1234
    • Client

      ffmpeg -i udp://localhost:1234?listen test.mp4

    The client will actually live stream the video, but for testing purposes I am writing the output to a file for now.

    Here comes the interesting part. I began the stream(video and audio) in a dark room, everything is fine. I turn on the room’s lights and the client cries with many errors. I later checked the output, it is very corrupted indeed on the light turned-on parts. What could be the reason behind this ? I am posting the errors here if it could be of assistance.

    Some of the errors :

    udp://localhost:1234?listen: corrupt decoded frame in stream 0trate= 845.6kbits/s dup=1250 drop=0 speed=1.08x
       Last message repeated 1 times
    [h264 @ 0000026c4af69400] Invalid NAL unit 1, skipping.7.61 bitrate= 864.7kbits/s dup=1441 drop=0 speed=1.07x
    [h264 @ 0000026c4af69400] Invalid level prefix
    [h264 @ 0000026c4af69400] error while decoding MB 18 8
    [h264 @ 0000026c4af69400] concealing 911 DC, 911 AC, 911 MV errors in P frame
    [h264 @ 0000026c4af4b780] Invalid NAL unit 1, skipping.
    [h264 @ 0000026c4af4b780] negative number of zero coeffs at 10 14
    [h264 @ 0000026c4af4b780] error while decoding MB 10 14
    [h264 @ 0000026c4af4b780] concealing 679 DC, 679 AC, 679 MV errors in P frame
    udp://localhost:1234?listen: corrupt decoded frame in stream 0
       Last message repeated 1 times
    [h264 @ 0000026c4ba1e1c0] Invalid NAL unit 1, skipping.8.21 bitrate= 858.0kbits/s dup=1460 drop=0 speed=1.07x
    [h264 @ 0000026c4ba1e1c0] out of range intra chroma pred mode
    [h264 @ 0000026c4ba1e1c0] error while decoding MB 34 18
    [h264 @ 0000026c4ba1e1c0] concealing 495 DC, 495 AC, 495 MV errors in P frame
    [h264 @ 0000026c4bb16840] top block unavailable for requested intra mode
    [h264 @ 0000026c4bb16840] error while decoding MB 10 0
    [h264 @ 0000026c4bb16840] concealing 160 DC, 160 AC, 160 MV errors in P frame
    udp://localhost:1234?listen: corrupt decoded frame in stream 0
    [h264 @ 0000026c4bb16cc0] Invalid NAL unit 0, skipping.8.58 bitrate= 853.9kbits/s dup=1463 drop=0 speed=1.06x
    [h264 @ 0000026c4bb16cc0] corrupted macroblock 16 28 (total_coeff=-1)
    [h264 @ 0000026c4bb16cc0] error while decoding MB 16 28
    [h264 @ 0000026c4bb16cc0] concealing 113 DC, 113 AC, 113 MV errors in P frame
    [h264 @ 0000026c4bb17140] cbp too large (84) at 12 0
    [h264 @ 0000026c4bb17140] error while decoding MB 12 0
    [h264 @ 0000026c4bb17140] concealing 160 DC, 160 AC, 160 MV errors in P frame
    [mpegts @ 0000026c4aeb8d80] PES packet size mismatch

    Edit : As suggestion, I added these parameters to the server.

    -b:v 1M -bufsize 2M

    Now the errors are mostly gone. Except one time where it seemed like it occured just as I was turning off the lights, although I could not reproduce it after trying 4-5 times.

    Errors :

    [h264 @ 000002646f0d2f80] cbp too large (118) at 23 1422.25 bitrate= 659.5kbits/s dup=368 drop=0 speed=1.33x
    [h264 @ 000002646f0d2f80] error while decoding MB 23 14
    [mpegts @ 000002646e578d80] PES packet size mismatch
    [h264 @ 000002646f0d2f80] concealing 666 DC, 666 AC, 666 MV errors in P frame
    [h264 @ 000002646f0d0f80] concealing 160 DC, 160 AC, 160 MV errors in P frame
    [aac @ 000002646e64d640] Number of bands (59) exceeds limit (43).
    Error while decoding stream #0:1: Invalid data found when processing input
    [aac @ 000002646e64d640] Multiple frames in a packet.
    [aac @ 000002646e64d640] Reserved bit set.
    [aac @ 000002646e64d640] Number of bands (31) exceeds limit (29).
    Error while decoding stream #0:1: Invalid data found when processing input
    [h264 @ 000002646e5e11c0] concealing 160 DC, 160 AC, 160 MV errors in P frame
    udp://localhost:1234?listen: corrupt decoded frame in stream 0trate= 633.1kbits/s dup=368 drop=0 speed=1.35x
       Last message repeated 2 times

    The errors decreased because I increased the bitrate ? (I don’t know the default bitrate by the way). Bright decoding fails because it carries more information, data ? (same in raw video, but maybe file is heavier encoded bright frames)