Recherche avancée

Médias (1)

Mot : - Tags -/livre électronique

Autres articles (44)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

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

Sur d’autres sites (8094)

  • Decode .wav file and write it into another file using ffmpeg

    16 février 2017, par deshu

    How to decode a .wav file and write it into another file using ffmpeg ?

    I got decoded data by this piece of code :

    -(void)audioDecode:(const char *)outfilename inFileName:(const char *)filename

    {

    const char* input_filename=filename;

       //avcodec_register_all();
       av_register_all();
       avcodec_register_all();
      // av_register_all();
       //av_ini

    //    AVFormatContext* container=avformat_alloc_context();
    //    if(avformat_open_input(&container,filename,NULL,NULL)<0){
    //        NSLog(@"Could not open file");
    //    }

       AVCodec *codec;
       AVCodecContext *c= NULL;
       int len;
       FILE *f, *outfile;
       uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
       AVPacket avpkt;
       AVFrame *decoded_frame = NULL;

       av_init_packet(&avpkt);

       printf("Decode audio file %s to %s\n", filename, outfilename);
       avcodec_register_all();

       AVFrame* frame = av_frame_alloc();
       if (!frame)
       {
           fprintf(stderr, "Could not allocate audio frame\n");
                           exit(1);
       }

       AVFormatContext* formatContext = NULL;
       /* Opening the file, and check if it has opened */
       if (avformat_open_input(&formatContext, filename, NULL, NULL) != 0)
       {
           av_frame_free(&frame);
           NSLog(@"Could not open file");
       }

       if (avformat_find_stream_info(formatContext, NULL) < 0)
       {
           av_frame_free(&frame);
           avformat_close_input(&formatContext);

           NSLog(@"Error finding the stream info");
       }

           outfile = fopen(outfilename, "wb");
           if (!outfile) {
               av_free(c);
               exit(1);
           }

       /* Find the audio Stream, if no audio stream are found, clean and exit */
       AVCodec* cdc = NULL;
       int streamIndex = av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, &cdc, 0);
       if (streamIndex < 0)
       {
           av_frame_free(&frame);
           avformat_close_input(&formatContext);
           NSLog(@"Could not find any audio stream in the file");
           exit(1);
       }

       /* Open the audio stream to read data  in audioStream */
       AVStream* audioStream = formatContext->streams[streamIndex];

       /* Initialize the codec context */
       AVCodecContext* codecContext = audioStream->codec;
       codecContext->codec = cdc;
       /* Open the codec, and verify if it has opened */
       if (avcodec_open2(codecContext, codecContext->codec, NULL) != 0)
       {
           av_frame_free(&frame);
           avformat_close_input(&formatContext);
           NSLog(@"Couldn't open the context with the decoder");
           exit(1);
       }

       /* Initialize buffer to store compressed packets */
       AVPacket readingPacket;
       av_init_packet(&readingPacket);
       int lenght = 1;
       long long int chunk = ((formatContext->bit_rate)*lenght/8);
       int j=0;
       int count = 0;
       //audioChunk output;


       while(av_read_frame(formatContext, &readingPacket)==0){
           //if((count+readingPacket.size)>start){
               if(readingPacket.stream_index == audioStream->index){

                   AVPacket decodingPacket = readingPacket;

                   // Audio packets can have multiple audio frames in a single packet
                   while (decodingPacket.size > 0){
                       // Try to decode the packet into a frame
                       // Some frames rely on multiple packets, so we have to make sure the frame is finished before
                       // we can use it
                       int gotFrame = 0;
                       int result = avcodec_decode_audio4(codecContext, frame, &gotFrame, &decodingPacket);

                       count += result;

                       if (result >= 0 && gotFrame)
                       {
                           decodingPacket.size -= result;
                           decodingPacket.data += result;
                           int a;

                           for(int i=0;idata[0], 1, decodingPacket.size, outfile);
    //                            *(output.data+j)=frame->data[0][i];
    //
                               j++;
                               if(j>=chunk) break;
                           }

                           // We now have a fully decoded audio frame
                       }
                       else
                       {
                           decodingPacket.size = 0;
                           decodingPacket.data = NULL;
                       }
                      // if(j>=chunk) break;
                   }
               }
    //        }else count+=readingPacket.size;
    //        
    //        // To prevent memory leak, must free packet.
    //        av_free_packet(&readingPacket);
    //        if(j>=chunk) break;
       }
       fclose(outfile);

    But the file is created with zero bytes. I don’t know what’s wrong with this code. And I got one more error : "Format adp detected only with low score of 25, misdetection possible !"

  • get audio current freqency for each 0.1 second of audio file with ffmpeg sox or opus into file.txt

    15 mars 2019, par Vlad

    I am trying to get audio freqency statistic from call record in file.opus for each 0,1 second, have try ffmpeg (spectrum) ffprobe ,
    for example
    sox  '.$file.' −n rate 6k spectrogram −z 62 -w Hamming -o aaaaaa/test10.png stat -freq 2>aaaaaa/test10.txt
    return spectrum
    all of them return values but no freqency found any other library ? Or what I am doing wrong I now it retrun spectrum but I need concrete freqency of human voice it is possible with ffmpeg or ffprobe or sox ? I am working in php but running shel comands any help will be aprisiatied. What should be my next step ? I am lost I have no idea how could get freqency from this numbers or "it is possible " ??? What is the first step comand in sox etc.

  • converting .mov file to .h264 file

    29 août 2011, par Robin Rye

    ok, this is the case, i actually want to parse frames from a mov file. get the encoded h264 frames. and i've managed to do so by using ffmpeg but when i try to make a movie again by using ffmpeg -i test* test.mov i get test00: Invalid data found when processing input so there is something not correct with the structure of the frames. as i understand it a frame should have the following appearance :

    00 00 00 01 XX data -------------

    where XX is say whether it is a I-,P- or B-frame. or more specifically type(XX) = 0x0F && XX says if it is I(type(XX) = 5 ?),P(type(XX) = 7 ?) or B(type(XX) = 8 ?) frame. I'm not sure about these number, i've been looking for it but not found good sources. so that's question number one, what number should the NALU be for the different frames ?

    anyway, when i use av_read_frame on the mov file, i get frame that look like this :

    4B = size, 1B = XX and then data. (at least this is what i think i get)

    the files where i store the frames are always size long when i look at them in a hexeditor(otherwise as well of course). and XX is always 65(ie. type(XX) = 5) in the first and then 61(ie. type(XX) = 1) for a couple of frames and then back to being 65 for one frame and so on.

    i guess that these are frames like : I P P P P P P I P P P P P P P I P P P P P P P .... however then my assumption about the type numbers for the different frame types are false, which is highly likely. (any suggestion on reading about this ? except the ISO/IEC 14496-10, i don't understand it really).

    I've tried to remove the size and append 00 00 00 01 before the XX byte and the data but without success. any tips on how i could modify the frames to be valid H264 encoded frames ?