Recherche avancée

Médias (21)

Mot : - Tags -/Nine Inch Nails

Autres articles (65)

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
    Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
    Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)

  • MediaSPIP Init et Diogène : types de publications de MediaSPIP

    11 novembre 2010, par

    À l’installation d’un site MediaSPIP, le plugin MediaSPIP Init réalise certaines opérations dont la principale consiste à créer quatre rubriques principales dans le site et de créer cinq templates de formulaire pour Diogène.
    Ces quatre rubriques principales (aussi appelées secteurs) sont : Medias ; Sites ; Editos ; Actualités ;
    Pour chacune de ces rubriques est créé un template de formulaire spécifique éponyme. Pour la rubrique "Medias" un second template "catégorie" est créé permettant d’ajouter (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (9014)

  • Wav File encoded with FFMPEG has issues with codecs while playing using VLC Player

    24 mai 2022, par user924702

    I want to convert raw PCM data(Taken from Android Phone mic) into a libGSM Wave file. After encoding into file, VLC player shows right codec information and duration but unable to play contents. Please help me to find what I am doing wrong.

    



    Below is my code for encoding and header writing :

    



    void EncodeTest(uint8_t *audioData, size_t audioSize)
{
    AVCodecContext  *audioCodec;
    AVCodec *codec;
    uint8_t *buf;    int bufSize, frameBytes;
    __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"Lets encode :%u with size %d\n",(int)audioData, (int)audioSize);
    //Set up audio encoder
    codec = avcodec_find_encoder(CODEC_ID_GSM);
    if (codec == NULL){
        __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to find encoder(CODEC_ID_GSM)");
        codec = avcodec_find_encoder(CODEC_ID_GSM);
        if (codec == NULL){
            __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to find encoder(CODEC_ID_GSM)");
            return;
        }
    }
    audioCodec                  = avcodec_alloc_context();
    audioCodec->channels        = 1;
    audioCodec->sample_rate     = 8000;
    audioCodec->sample_fmt      = SAMPLE_FMT_S16;
    audioCodec->bit_rate        = 13200;
    audioCodec->priv_data       = gsm_create();

    switch(audioCodec->codec_id) {
        case CODEC_ID_GSM:
            audioCodec->frame_size = GSM_FRAME_SIZE;
            audioCodec->block_align = GSM_BLOCK_SIZE;
            int one = 1;
            gsm_option(audioCodec->priv_data, GSM_OPT_WAV49, &one);
            break;
        case CODEC_ID_GSM_MS: {
            int one = 1;
            gsm_option(audioCodec->priv_data, GSM_OPT_WAV49, &one);
            audioCodec->frame_size = 2*GSM_FRAME_SIZE;
            audioCodec->block_align = GSM_MS_BLOCK_SIZE;
        }
    }
    audioCodec->coded_frame= avcodec_alloc_frame();
    audioCodec->coded_frame->key_frame= 1;
    audioCodec->time_base       = (AVRational){1,  audioCodec->sample_rate};
    audioCodec->codec_type      = CODEC_TYPE_AUDIO;

    if (avcodec_open(audioCodec, codec) < 0){
        __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to avcodec_open");
        return;
    }

    bufSize     = FF_MIN_BUFFER_SIZE * 10;
    buf         = (uint8_t *)malloc(bufSize);
    if (buf == NULL) return;
    frameBytes = audioCodec->frame_size * audioCodec->channels * 2;
    FILE *fileWrite = fopen(FILE_NAME,"w+b");
    if(NULL == fileWrite){
        __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"ERROR:: Unable to open file for reading.");
    }
    /*Write wave header*/
    WriteWav(fileWrite, 32505);/*Just for test*/

    /*Lets encode raw packet and write into file after header.*/
    __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"Lets Encode Actual Bytes");
    int nChunckSize = 0;
    while (audioSize >= frameBytes)
    {
        int packetSize;

        packetSize = avcodec_encode_audio(audioCodec, buf, bufSize, (short *)audioData);
        __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"Encoder returned %d bytes of data\n", packetSize);
        nChunckSize += packetSize;
        audioData += frameBytes;
        audioSize -= frameBytes;
        if(NULL != fileWrite){
            fwrite(buf, packetSize, 1, fileWrite);
        }
        else{
            __android_log_print(ANDROID_LOG_ERROR, DEBUG_TAG,"Unable to open file for writting... NULL");
        }
    }
    if(NULL != fileWrite){
        fclose(fileWrite);
    }
    __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"----- Done with nChunckSize: %d --- ",nChunckSize);
     __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"*****************************");
    wavReadnDisplayHeader(FILE_NAME);
    __android_log_print(ANDROID_LOG_INFO, DEBUG_TAG,"*****************************");
    wavReadnDisplayHeader("/sdcard/Voicemail2.wav");
}


    



    Header Writing :

    



    /** Writes WAV headers */
void WriteWav(FILE *f, long int bytes)
{
    /* quick and dirty */
    fwrite("RIFF",sizeof(char),4,f);                /*  0-3 */      //RIFF
    PutNum(bytes+44-8,f,1,4);                       /*  4-7 */      //ChunkSize
    fwrite("WAVEfmt ",sizeof(char),8,f);            /*  8-15 */     //WAVE Header + FMT header
    PutNum(16,f,1,4);                               /* 16-19 */     //Size of the fmt chunk
    PutNum(49,f,1,2);                                /* 20-21 */     //Audio format, 49=libgsm wave, 1=PCM,6=mulaw,7=alaw, 257=IBM Mu-Law, 258=IBM A-Law, 259=ADPCM
    PutNum(1,f,1,2);                                /* 22-23 */     //Number of channels 1=Mono 2=Sterio
    PutNum(8000,f,1,4);                             /* 24-27 */     //Sampling Frequency in Hz 
    PutNum(2*8000,f,1,4);                           /* 28-31 */     //bytes per second /Sample/persec
    PutNum(2,f,1,2);                                /* 32-33 */     // 2=16-bit mono, 4=16-bit stereo 
    PutNum(16,f,1,2);                                /* 34-35 */     // Number of bits per sample
    fwrite("data",sizeof(char),4,f);                /* 36-39 */     
    PutNum(bytes,f,1,4);                            /* 40-43 */     //Sampled data length  
}


    



    Please help....

    


  • FFmpeg in Docker container not capturing frames

    6 juin 2022, par Ben Whitely

    I need to capture some frames over ethernet so decided to use FFmpeg.

    


    I managed to get it working and capturing on my host before I moved into working inside my Docker containers.

    


    If I run the command on my host, this is the output that I see :

    


    ╰─$ ffmpeg -y -i udp://@:15004 -r 10 -frames:v 1 frame.png
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[h264 @ 0x55ba0869d440] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x55ba0869d440] decode_slice_header error
[h264 @ 0x55ba0869d440] no frame!
[h264 @ 0x55ba0869d440] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x55ba0869d440] decode_slice_header error
[h264 @ 0x55ba0869d440] no frame!
[h264 @ 0x55ba0869d440] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0x55ba0869d440] decode_slice_header error
[h264 @ 0x55ba0869d440] no frame!
Input #0, mpegts, from 'udp://@:15004':
  Duration: N/A, start: 905.464878, bitrate: N/A
  Program 1 
    Stream #0:0[0x11]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 640x512, 60 fps, 60 tbr, 90k tbn, 120 tbc
    Stream #0:1[0x21]: Data: klv (KLVA / 0x41564C4B)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'frame.png':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: png, rgb24, 640x512, q=2-31, 200 kb/s, 10 fps, 10 tbn, 10 tbc
    Metadata:
      encoder         : Lavc58.54.100 png
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.10 bitrate=N/A speed=1.23x    
video:399kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown


    


    However, when I try to run the exact same command inside my docker container, it looks like it tries to do something but never progress beyond this point to capture the frame.

    


    vinden75lr           | ffmpeg version 4.3.4-0+deb11u1 Copyright (c) 2000-2021 the FFmpeg developers
vinden75lr           |   built with gcc 10 (Debian 10.2.1-6)
vinden75lr           |   configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
vinden75lr           |   libavutil      56. 51.100 / 56. 51.100
vinden75lr           |   libavcodec     58. 91.100 / 58. 91.100
vinden75lr           |   libavformat    58. 45.100 / 58. 45.100
vinden75lr           |   libavdevice    58. 10.100 / 58. 10.100
vinden75lr           |   libavfilter     7. 85.100 /  7. 85.100
vinden75lr           |   libavresample   4.  0.  0 /  4.  0.  0
vinden75lr           |   libswscale      5.  7.100 /  5.  7.100
vinden75lr           |   libswresample   3.  7.100 /  3.  7.100
vinden75lr           |   libpostproc    55.  7.100 / 55.  7.100


    


    This is the code that actually executes the command, possible I'm doing something wrong here ? This was a very quick and dirty implementation, just wanted to confirm I could capture a frame before doing anything else.

    


        void VindenCamera::save_image_to_file(){
        std::string filename;

        SPDLOG_INFO("Creating image filename {}", filename);
        create_filename(filename);

        std::string ffmpeg_still_frame_command("ffmpeg -y -i udp://@:15004 -r 10 -frames:v 1 " + filename);

        system(ffmpeg_still_frame_command.c_str());
    }


    


  • FFMPEG on Heroku exceeds memory quota in testing

    5 juillet 2022, par Patrick Vellia

    After following this tutorial, and getting it to work locally on my own development environment, before really getting my hands dirty and working deeper on my own project implementation, I decided to push it up to Heroku to test in a staging environment.

    


    I had to have Heroku add the FFMPEG build-pack and turn on the Redis Server for ActionCable to work.

    


    I didn't link the staging to a cloud storage bucket on Google or Amazon yet, just allowed it to upload directly to the dymo disk for testing. So it would go into the storage directory as it would in development for now.

    


    the test MOV file is 186 MB in size.

    


    The system uploaded the file fine.

    


    According to the logs, it then copied the file from storage to tmp as the tutorial has us do.

    


    Then it called streamio-ffmpeg's transcode method.

    


    At this point, Heroku forcibly kills the dymo because it far exceeds the memory quota.

    


    As this is a test environment, it's only on the free tier of Heroku.

    


    I'm thinking I won't be able to directly process video projects on Heroku itself, unless I'm wrong ? Would it be better to call an API like Cloud Functions or Amazon Lambda, or spin up a Compute Engine long enough to process the FFMPEG command ?