Recherche avancée

Médias (91)

Autres articles (49)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Activation de l’inscription des visiteurs

    12 avril 2011, par

    Il est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
    Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
    Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

Sur d’autres sites (10119)

  • Audio streams mixed from 2 videos with ffmpeg C or C++

    11 septembre 2015, par 0nand0n

    I’ve searched for this problem but results are always kind of ffmpeg commands. Reason I need to develop using C is that I have to process image frames in a pretty complicated ways but program must run fast.
    I have several questions on these stuffs :

    1, Can we just copy streams from input video to the streams of AVFormatContext struct for output file. As I read from remuxing.c example, they have to read packets from streams and then copy packets one by one to output streams of output AVFormatContext struct.

    2, when mixing audio streams from 2 source videos, could we just add another stream with codec->codec_type = AVMEDIA_TYPE_AUDIO or we have to mix two audio streams into one ?
    From 1 and 2, we can just copy 2 audio streams from 2 input videos to the output AVFormatContext struct, can’t we ?

    3, Can we use the same AVCodecContext for both decoding and encoding of one stream ? It means result of AVCodecContext from avcodec_find_decoder could be used for encoding without calling to avcodec_find_encoder ?

    4, Last, how to read loudness (volume) of each audio frame (average) ? This might be easy with the provided tools of ffmpeg but I cannot find any result developed by C.

  • iOS FFMPEG hight level API

    10 janvier 2019, par Gralex

    I have video file with subtitles and I’d like to get all subtitles from it. With terminal it’s quite easy to do this.

    ffmpeg -i video.mkv -map 0:s:0 subs.srt

    How can I execute this command on iOS ?

    Edit

    Or maybe you know easy way to get subtitles from video file ? Fails on av_guess_format returns NULL.

    + (void)readSubtitles:(NSString *)videoPath saveFolder:(NSString *)saveFolder {
       AVFormatContext *pFormatCtx;

       av_register_all();
       avcodec_register_all();
       avformat_network_init();
       pFormatCtx = avformat_alloc_context();

       if (avformat_open_input(&pFormatCtx, [videoPath UTF8String], NULL, NULL) != 0) {
           return;
       }

       if (avformat_find_stream_info(pFormatCtx, NULL) < 0) {
           return;
       }

       for (int i = 0; i < pFormatCtx->nb_streams; i++) {
           if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE) {
               NSString *subPath = [saveFolder stringByAppendingPathComponent:[NSString stringWithFormat:@"sub_%d.srt", i]];
               [self parseSubtitles:pFormatCtx streamIdx:i savePath:subPath];
           }
       }
    }

    + (void)parseSubtitles:(AVFormatContext *)context streamIdx:(int)idx savePath:(NSString *)savePath {
       const char *filename = [savePath UTF8String];
       AVStream *avstream = context->streams[idx];
       AVCodec *codec = avcodec_find_decoder( avstream->codec->codec_id );
       int result = avcodec_open2( avstream->codec, codec, NULL );
       AVOutputFormat *outFormat = av_guess_format( NULL, "sub.mp4", NULL );
       NSAssert(outFormat != NULL, @"Error finding format"); // !!! fails !!!

       NSLog(@"Found output format: %@ (%@)", [NSString stringWithUTF8String:outFormat->name], [NSString stringWithUTF8String:outFormat->long_name]);

       AVFormatContext *outFormatContext;
       avformat_alloc_output_context2( &outFormatContext, NULL, NULL, filename );
       AVCodec *encoder = avcodec_find_encoder( outFormat->subtitle_codec );
    //    checkResult( encoder != NULL, "Error finding encoder" );
       NSLog(@"Found encoder:  %@", [NSString stringWithUTF8String:encoder->name]);


       AVStream *outStream = avformat_new_stream( outFormatContext, encoder );
       AVCodecContext *c = outStream->codec;

       result = avcodec_get_context_defaults3( c, encoder );


    //    outStream->codecpar
       NSLog(@"outstream codec:  %@", [NSString stringWithUTF8String:outStream->codec]);
       NSLog(@"Opened stream  %d, codec=%d", outStream->id, outStream->codec->codec_id);
       result = avio_open( &outFormatContext->pb, filename, AVIO_FLAG_WRITE );
    //    checkResult( result == 0, "Error opening out file" );
    //    cerr << "out file opened correctly" << endl;
       result = avformat_write_header( outFormatContext, NULL );
    //    checkResult(result==0, "Error writing header");
    //    cerr << "header wrote correctly" << endl;
       result = 0;
       AVPacket pkt;
       av_init_packet( &pkt );
       pkt.data = NULL;
       pkt.size = 0;

    //    cerr << "srt codec id: " << AV_CODEC_ID_SUBRIP << endl;
       while( av_read_frame( context, &pkt ) >= 0 )
       {
           if(pkt.stream_index != idx)
               continue;
           int gotSubtitle = 0;
           AVSubtitle subtitle;
           result = avcodec_decode_subtitle2( avstream->codec, &subtitle, &gotSubtitle, &pkt );
           uint64_t bufferSize = 1024 * 1024 ;
           uint8_t *buffer = (uint8_t *)malloc(bufferSize * sizeof(uint8_t));
           memset(buffer, 0, bufferSize);
           if( result >= 0 )
           {
               result = avcodec_encode_subtitle( outStream->codec, buffer, bufferSize, &subtitle );
    //            cerr << "Encode subtitle result: " << result << endl;
           }

    //        cerr << "Encoded subtitle: " << buffer << endl;
           free(buffer);
       }
    }
  • aadec : add chapters and seeking

    8 juillet 2018, par Karsten Otto
    aadec : add chapters and seeking
    

    read_packet reads content in chunks. Thus seek must be clamped to valid
    chunk positions in the file, which in turn are relative to chapter start
    positions.

    So in read_header, scan for chapter headers once by skipping through the
    content. Set stream time_base based on bitrate in bytes/s, for easy
    timestamp to position conversion.

    Then in read_seek, find the chapter containing the seek position, calculate
    the nearest chunk position, and reinit the read_seek state accordingly.

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavformat/aadec.c