Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (71)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

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

Sur d’autres sites (7820)

  • Cutting MPEG-TS file via ffmpegwrapper ?

    27 janvier 2016, par Stefan Kendall

    I have MPEG-TS files on the device. I would like to cut a fairly-exact time off the start of the files on-device.

    Using FFmpegWrapper as a base, I’m hoping to achieve this.

    I’m a little lost on the C API of ffmpeg, however. Where do I start ?

    I tried just dropping all packets prior to a start PTS I was looking for, but this broke the video stream.

       packet->pts = av_rescale_q(packet->pts, inputStream.stream->time_base, outputStream.stream->time_base);
       packet->dts = av_rescale_q(packet->dts, inputStream.stream->time_base, outputStream.stream->time_base);

       if(startPts == 0){
           startPts = packet->pts;
       }

       if(packet->pts < cutTimeStartPts + startPts){
           av_free_packet(packet);
           continue;
       }

    How do I cut off part of the start of the input file without destroying the video stream ? When played back to back, I want 2 cut segments to run seamlessly together.

    ffmpeg -i time.ts -c:v libx264 -c:a copy -ss $CUT_POINT -map 0 -y after.ts
    ffmpeg -i time.ts -c:v libx264 -c:a copy -to $CUT_POINT -map 0 -y before.ts

    Seems to be what I need. I think the re-encode is needed so the video can start at any arbitrary point and not an existing keyframe. If there’s a more efficient solution, that’s great. If not, this is good enough.

    EDIT : Here’s my attempt. I’m cobbling together various pieces I don’t fully understand copied from here. I’m leaving off the "cutting" piece for now to try and get audio + video encoded written without layering complexity. I get EXC_BAD_ACCESS on avcodec_encode_video2(...)

    - (void)convertInputPath:(NSString *)inputPath outputPath:(NSString *)outputPath
                    options:(NSDictionary *)options progressBlock:(FFmpegWrapperProgressBlock)progressBlock
            completionBlock:(FFmpegWrapperCompletionBlock)completionBlock {
       dispatch_async(conversionQueue, ^{
           FFInputFile *inputFile = nil;
           FFOutputFile *outputFile = nil;
           NSError *error = nil;

           inputFile = [[FFInputFile alloc] initWithPath:inputPath options:options];
           outputFile = [[FFOutputFile alloc] initWithPath:outputPath options:options];

           [self setupDirectStreamCopyFromInputFile:inputFile outputFile:outputFile];
           if (![outputFile openFileForWritingWithError:&error]) {
               [self finishWithSuccess:NO error:error completionBlock:completionBlock];
               return;
           }
           if (![outputFile writeHeaderWithError:&error]) {
               [self finishWithSuccess:NO error:error completionBlock:completionBlock];
               return;
           }

           AVRational default_timebase;
           default_timebase.num = 1;
           default_timebase.den = AV_TIME_BASE;
           FFStream *outputVideoStream = outputFile.streams[0];
           FFStream *inputVideoStream = inputFile.streams[0];

           AVFrame *frame;
           AVPacket inPacket, outPacket;

           frame = avcodec_alloc_frame();
           av_init_packet(&inPacket);

           while (av_read_frame(inputFile.formatContext, &inPacket) >= 0) {
               if (inPacket.stream_index == 0) {
                   int frameFinished;
                   avcodec_decode_video2(inputVideoStream.stream->codec, frame, &frameFinished, &inPacket);
    //                if (frameFinished && frame->pkt_pts >= starttime_int64 && frame->pkt_pts <= endtime_int64) {
                   if (frameFinished){
                       av_init_packet(&outPacket);
                       int output;
                       avcodec_encode_video2(outputVideoStream.stream->codec, &outPacket, frame, &output);
                       if (output) {
                           if (av_write_frame(outputFile.formatContext, &outPacket) != 0) {
                               fprintf(stderr, "convert(): error while writing video frame\n");
                               [self finishWithSuccess:NO error:nil completionBlock:completionBlock];
                           }
                       }
                       av_free_packet(&outPacket);
                   }
                   if (frame->pkt_pts > endtime_int64) {
                       break;
                   }
               }
           }
           av_free_packet(&inPacket);

           if (![outputFile writeTrailerWithError:&error]) {
               [self finishWithSuccess:NO error:error completionBlock:completionBlock];
               return;
           }

           [self finishWithSuccess:YES error:nil completionBlock:completionBlock];
       });
    }
  • ffmpeg Command Fails in C

    16 février 2016, par cclloyd

    I have a program that stitches together files in ffmpeg using the system() function. It works when I run the command normally, but fails when I run it through the C program (it gets like 80% of the way through then fails saying

    [concat @ 0x7fe299801000] Impossible to open '/Us' parts.txt: No such file or directory
    No more output streams to write to, finishing.

    But that only happens in the C program. Not when I run the exact same command manually.

    The command it’s running is

    char command[1024];
    sprintf(command, "ffmpeg -f concat -i parts.txt -c copy s%de%02d.ts", season, episode);
    system(command);

    And the parts.txt file is as follows : http://pastebin.com/pUAu9mbt

    (Before you ask, yes those are absolute pathnames, not relative)

  • AVSampleBufferDisplayLayer with VTDecompressionSession

    7 juillet 2016, par user1784317

    I’ve been struggling with AVSampleBufferDisplayLayer being really choppy with a lot of motion. When there was motion in my live stream, it would be come pixelated and half frozen with multiple frames displaying at once. However, once I added the following piece of code, everything was solved :

    VTDecodeFrameFlags flags = kVTDecodeFrame_EnableAsynchronousDecompression
    | kVTDecodeFrame_EnableTemporalProcessing;
    VTDecodeInfoFlags flagOut;
    VTDecompressionSessionDecodeFrame(decompressionSession, sampleBuffer, flags,
    (void*)CFBridgingRetain(NULL), &flagOut);

    Note that I did create the decompression session before, but I don’t actually do anything in the callback. I am still calling enqueueSampleBuffer : on AVSampleBufferDisplayLayer and that is how the video is displayed on the screen.

    Do you have to call VTDecompressionSessionDecodeFrame for AVSampleBufferDisplayLayer to display correctly ? I thought AVSampleBufferDisplayLayerr would use VTDecompressionSessionDecodeFrame internally. Is this due to being on the iOS Simulator ?