Recherche avancée

Médias (91)

Autres articles (23)

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

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (5569)

  • Pydub does not work sometimes (ffmpeg problem)

    17 juillet 2022, par randomguy

    I'm making a program for macOS that uses pydub and therefore ffmpeg (ffmpeg was installed by copying ffmpeg and ffprobe to /usr/local/bin).

    


    When I run my program through the terminal (python3 [filename]) or compile it into an executable file without extension, it works fine. But when I run it via IDLE or compile to .app, ffmpeg doesn't work. It says this :

    


    RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)


    


    The same message appears when ffmpeg is not installed at all.

    


    How to make ffmpeg/pydub work correctly ?

    


  • FFmpeg remuxing parts of an audio file

    22 décembre 2022, par zorleone

    I'm trying to remux individual tracks from a FLAC file using the FFmpeg libraries.
I get the starting timestamps from a Cue sheet, I seek to the timestamps using avformat_seek_file. However after writing the packets to output files, they only have data from the beginning of the input file.

    


    This is the code snippet which opens the input FLAC and also creates an output AVFormatContext for each track. I'm guessing the issue is avformat_seek_file, it doesn't seem to do anything, since even though I seek to the beginning of a track, the output file contains data from the beginning of the input.

    


        for(int i = 0; i <= sheet.ntracks; i++) {
        sheet.avfmtctx = avformat_alloc_context();
        if(avformat_open_input(&sheet.avfmtctx, sheet.file, NULL, NULL) < 0) {
            fprintf(stderr,
                    "avformat_open_input(): failed to open %s\n",
                    sheet.file);
            return 1;
        }
        int audio_stream_idx = -1;
        for(int i = 0; i < sheet.avfmtctx->nb_streams; i++) {
            if(sheet.avfmtctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
                audio_stream_idx = i;
                break;
            }
        }
        avformat_find_stream_info(sheet.avfmtctx, NULL);
        AVFormatContext *output;
        char *filepath = title_to_filepath(&sheet.tracks[i], sheet.file);
        avformat_alloc_output_context2(&output, NULL, NULL, filepath);
        AVStream *out_audio_stream = avformat_new_stream(output, NULL);
        avcodec_parameters_copy(out_audio_stream->codecpar,
                                sheet.avfmtctx->streams[audio_stream_idx]->codecpar);

        if(avio_open(&output->pb, filepath, AVIO_FLAG_WRITE) < 0) {
            fprintf(stderr, "Failed to open %s for writing\n", filepath);
            return 1;
        }
        if(avformat_write_header(output, NULL) < 0) {
            fprintf(stderr, "avformat_write_header() failed\n");
            return 1;
        }
        int64_t current_frame = sheet.tracks[i].index;
        int64_t next_track_index = (i < sheet.ntracks) ?
                                   sheet.tracks[i + 1].index :
                                   INT64_MAX;
        if(avformat_seek_file(sheet.avfmtctx,
                           -1,
                           INT64_MIN,
                           current_frame,
                           current_frame,
                           0) < 0) {
            fprintf(stderr, "Failed to seek to the index of track %d\n", i);
            avformat_free_context(sheet.avfmtctx);
            sheet.avfmtctx = NULL;
            av_write_trailer(output);
            avio_closep(&output->pb);
            avformat_free_context(output);
            free(filepath);
            continue;
        }
        AVPacket *pkt = av_packet_alloc();
        int64_t pts_diff = AV_NOPTS_VALUE, dts_diff = AV_NOPTS_VALUE;
        while(current_frame < next_track_index && !avio_feof(output->pb)) {
            int ret;
            if((ret = av_read_frame(sheet.avfmtctx, pkt)) < 0) {
                if(ret != AVERROR_EOF)
                    fprintf(stderr, "av_read_frame() failed: %s\n", av_err2str(ret));
                break;
            }
            if(pkt->stream_index != audio_stream_idx)
                continue;
            // runs only once
            if(pts_diff == AV_NOPTS_VALUE && dts_diff == AV_NOPTS_VALUE) {
                pts_diff = pkt->pts;
                dts_diff = pkt->dts;
            }

            pkt->stream_index = 0; // first and only stream
            pkt->pts -= pts_diff;
            pkt->dts -= dts_diff;
            pkt->pos = -1;
            av_interleaved_write_frame(output, pkt);

            current_frame++;
        }

        avformat_free_context(sheet.avfmtctx);
        sheet.avfmtctx = NULL;

        av_write_trailer(output);
        av_packet_free(&pkt);
        avio_closep(&output->pb);
        avformat_free_context(output);

        free(filepath);
    }



    


    current_frame and next_track_index are calculated from the INDEX lines in the Cue sheet : MM * 60 * 75 + SS * 75 + FF.
Can someone tell me what I'm doing wrong, and how to get the data I need from the input ?

    


  • Remux and segment only parts of a video file without difference in output

    20 juin 2013, par Christian P.

    I have a working program built on top of libav (alternatively ffmpeg - expertise is either is useful here).

    It takes an mp4 video, encoded with h264 video / AAC audio, and remuxes it to MPEG TS and segments it into X second chunks. It is analogous to the following ffmpeg command :

    ffmpeg -y -i video.mp4 -c:a copy -bsf:a aac_adtstoasc -c:v copy -bsf:v h264_mp4toannexb -flags -global_header -map 0 -f segment -segment_time 10 -segment_list playlist.m3u8 -segment_format mpegts chunk_%03d.ts

    The reason I am not using the command-line, is that I wish to generate only a subset of the segments. So if a video results in 10 segments of between 8 and 12 seconds (the segments are never exactly the desired length due to keyframes), I might wish to generate segments 3-7 at a later time.

    The complete code for my program can be found here.

    I use av_read_frame to read every frame from the source file, remux (including a bitfilter process) and write to output file. Once the duration since the last output becomes close/greater than the desired segment length, I flush the output file, close it, open the next segment and continue.

    I have tried altering the code to do an av_seek_frame to the end of the first segment and start from there (I also attempted to start at the end of the 2nd and 3rd segment). The new segments are the same length (in seconds and pts), but have a different size than the comparable segments from the full runthrough (within a few kilobytes) - the starting segment (whether it's the 2nd, 3rd or other) also shows as having 2 packets LESS than the comparable segment from previously.

    I assumed that av_seek_frame would give me an exact match as if I had manually done a loop with av_read_frame up to that frame, but it seems like it's not the case.

    What I wish for :

    • A way to "fast-forward" in the file to a specific (not approximate) point in the file.
    • To write from that point forward and have the output be completely identical to the output a full run provides (same size, same length, same exact bytes).