Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (58)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

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

  • Extract audio from video using autogen ffmpeg C# in Unity

    5 décembre 2024, par Johan Sophie

    Hi I'm using ffmpeg autogen to extract audio from video in Unity, but when I following this code, the file write cannot write, it's 0Kb, so what's issue of this or someone have any examples for extract audio using this library, apologize for my English. This is github of library : 
https://github.com/Ruslan-B/FFmpeg.AutoGen

    



    unsafe void TestExtractAudio()
{

    string inFile = Application.streamingAssetsPath + "/" + strFileName;
    string outFile = Application.streamingAssetsPath + "/" + strFileNameAudio;

    AVOutputFormat* outFormat = null;
    AVFormatContext* inFormatContext = null;
    AVFormatContext* outFormatContext = null;
    AVPacket packet;

    ffmpeg.av_register_all();

    inFormatContext = ffmpeg.avformat_alloc_context();
    outFormatContext = ffmpeg.avformat_alloc_context();

    if (ffmpeg.avformat_open_input(&inFormatContext, inFile, null, null) < 0)
    {
        throw new ApplicationException("Could not open input file.");
    }

    if (ffmpeg.avformat_find_stream_info(inFormatContext, null) < 0)
    {
        throw new ApplicationException("Failed to retrieve input stream info.");
    }

    ffmpeg.avformat_alloc_output_context2(&outFormatContext, null, null, outFile);
    if (outFormatContext == null)
    {
        throw new ApplicationException("Could not create output context");
    }

    outFormat = outFormatContext->oformat;

    AVStream* inStream = inFormatContext->streams[1];
    AVStream* outStream = ffmpeg.avformat_new_stream(outFormatContext, inStream->codec->codec);
    if (outStream == null)
    {
        throw new ApplicationException("Failed to allocate output stream.");
    }

    if (ffmpeg.avcodec_copy_context(outStream->codec, inStream->codec) < 0)
    {
        throw new ApplicationException("Couldn't copy input stream codec context to output stream codec context");
    }

    outFormatContext->audio_codec_id = AVCodecID.AV_CODEC_ID_MP3;

    int retcode = ffmpeg.avio_open(&outFormatContext->pb, outFile, ffmpeg.AVIO_FLAG_WRITE);
    if (retcode < 0)
    {
        throw new ApplicationException("Couldn't open output file");
    }

    int returnCode = ffmpeg.avformat_write_header(outFormatContext, null);

    if (returnCode < 0)
    {
        throw new ApplicationException("Error occurred opening output file.");
    }

    while (true)
    {
        if (ffmpeg.av_read_frame(inFormatContext, &packet) < 0)
        {
            break;
        }

        if (packet.stream_index == 1)
        {

            inStream = inFormatContext->streams[1];
            outStream = outFormatContext->streams[0];

            // TODO: Replicate log packet functionality to print out what's inside the packet.

            packet.pts = ffmpeg.av_rescale_q_rnd(packet.pts, inStream->time_base, outStream->time_base,
                AVRounding.AV_ROUND_NEAR_INF | AVRounding.AV_ROUND_PASS_MINMAX);
            packet.dts = ffmpeg.av_rescale_q_rnd(packet.dts, inStream->time_base, outStream->time_base,
                AVRounding.AV_ROUND_NEAR_INF | AVRounding.AV_ROUND_PASS_MINMAX);

            packet.duration = ffmpeg.av_rescale_q(packet.duration, inStream->time_base, outStream->time_base);

            int returncode = ffmpeg.av_interleaved_write_frame(outFormatContext, &packet);

        }

        ffmpeg.av_packet_unref(&packet);
    }

    ffmpeg.av_write_trailer(outFormatContext);


    ffmpeg.avformat_close_input(&inFormatContext);

    ffmpeg.avformat_free_context(outFormatContext);

    Console.WriteLine("Press any key to continue...");

    Console.ReadKey();
}


    



    the value returnCode return less than 0, so someone can fix this, thanks so much for that

    


  • ios video after trimming then play on non ios device audio/video out of sync

    31 août 2015, par gavinHe

    trimming video,then I send the video trimmed to android device and play,I find audio/video out of sync, the audio is several seconds behind the video. but the video can play normal on iOS device.
    1.I trim video with codes like this :

    - (IBAction)showTrimmedVideo:(UIButton *)sender
    {
    [self deleteTmpFile];

    NSURL *videoFileUrl = [NSURL fileURLWithPath:self.originalVideoPath];

    AVAsset *anAsset = [[AVURLAsset alloc] initWithURL:videoFileUrl options:nil];
    NSArray *compatiblePresets = [AVAssetExportSession exportPresetsCompatibleWithAsset:anAsset];
    if ([compatiblePresets containsObject:AVAssetExportPresetMediumQuality]) {

       self.exportSession = [[AVAssetExportSession alloc]
                             initWithAsset:anAsset presetName:AVAssetExportPresetHighestQuality];
       // Implementation continues.

       NSURL *furl = [NSURL fileURLWithPath:self.tmpVideoPath];

       self.exportSession.outputURL = furl;
       self.exportSession.outputFileType = AVFileTypeMPEG4;

       CMTime start = CMTimeMakeWithSeconds(self.startTime, anAsset.duration.timescale);
       CMTime duration = CMTimeMakeWithSeconds(self.stopTime-self.startTime, anAsset.duration.timescale);
       CMTimeRange range = CMTimeRangeMake(start, duration);
       self.exportSession.timeRange = range;

       self.trimBtn.hidden = YES;
       self.myActivityIndicator.hidden = NO;
       [self.myActivityIndicator startAnimating];
       [self.exportSession exportAsynchronouslyWithCompletionHandler:^{

           switch ([self.exportSession status]) {
               case AVAssetExportSessionStatusFailed:
                   NSLog(@"Export failed: %@", [[self.exportSession error] localizedDescription]);
                   break;
               case AVAssetExportSessionStatusCancelled:
                   NSLog(@"Export canceled");
                   break;
               default:
                   NSLog(@"NONE");
                   dispatch_async(dispatch_get_main_queue(), ^{
                       [self.myActivityIndicator stopAnimating];
                       self.myActivityIndicator.hidden = YES;
                       self.trimBtn.hidden = NO;
                       [self playMovie:self.tmpVideoPath];
                   });
                   break;
           }
       }];
    }
    }

    2.I send the video trimmed to server,then android device get video from server,but they find audio/video out of sync,at first I consider of server do something wrong,so I just send video to android device with USB,the error still exist.

    3.so I analyze the trimmed video by ffmpeg tools :
    ffmpeg -i trimVideo.mp4
    then I find trimVideo.mp4 start is a negative number.
    here is what ffmpeg print :

    Metadata :
    major_brand : qt
    minor_version : 0
    compatible_brands : qt
    creation_time : 2015-08-29 12:22:13
    encoder : Lavf56.15.102
    Duration : 00:02:21.77, start : -4.692568, bitrate : 359 kb/s
    Stream #0:0(und) : Audio : aac (LC) (mp4a / 0x6134706D), 24000 Hz, stereo, fltp, 69 kb/s (default)
    Metadata :
    creation_time : 2015-08-29 12:22:13
    handler_name : Core Media Data Handler
    Stream #0:1(und) : Video : h264 (High) (avc1 / 0x31637661), yuv420p, 512x288 [SAR 1:1 DAR 16:9], 277 kb/s, 15.16 fps, 15.17 tbr, 12136 tbn, 30.34 tbc (default)
    Metadata :
    creation_time : 2015-08-29 12:22:13
    handler_name : Core Media Data Handler
    encoder : ’avc1’

    I have been puzzled by this bug for several days, I am sorry of my bad english and I really need your help,thanks.

  • How to embed subtitles into an mp4 file using gstreamer

    27 août 2021, par Stephen

    My Goal

    


    I'm trying to embed subtitles into an mp4 file using the mp4mux gstreamer element.

    


    What I've tried

    


    The pipeline I would like to use is :

    


    GST_DEBUG=3 gst-launch-1.0 filesrc location=sample-nosub-avc.mp4 ! qtdemux ! queue ! video/x-h264 ! mp4mux name=mux reserved-moov-update-period=1000 ! filesink location=output.mp4 filesrc location=english.srt ! subparse ! queue ! text/x-raw,format=utf8 ! mux.subtitle_0


    


    It just demuxes a sample mp4 file for the h.264 stream and then muxes it together with an srt subtitle file.

    


    The error I get is :

    


    Setting pipeline to PAUSED ...&#xA;0:00:00.009958915 1324869 0x5624a8c7a0a0 WARN                 basesrc gstbasesrc.c:3600:gst_base_src_start_complete:<filesrc0> pad not activated yet&#xA;Pipeline is PREROLLING ...&#xA;0:00:00.010128080 1324869 0x5624a8c53de0 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<filesrc1> error: Internal data stream error.&#xA;0:00:00.010129102 1324869 0x5624a8c53e40 WARN                 qtdemux qtdemux_types.c:239:qtdemux_type_get: unknown QuickTime node type pasp&#xA;0:00:00.010140810 1324869 0x5624a8c53de0 WARN                 basesrc gstbasesrc.c:3072:gst_base_src_loop:<filesrc1> error: streaming stopped, reason not-negotiated (-4)&#xA;0:00:00.010172990 1324869 0x5624a8c53e40 WARN                 qtdemux qtdemux.c:3237:qtdemux_parse_trex:<qtdemux0> failed to find fragment defaults for stream 1&#xA;ERROR: from element /GstPipeline:pipeline0/GstFileSrc:filesrc1: Internal data stream error.&#xA;Additional debug info:&#xA;gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline0/GstFileSrc:filesrc1:&#xA;streaming stopped, reason not-negotiated (-4)&#xA;ERROR: pipeline doesn&#x27;t want to preroll.&#xA;Setting pipeline to NULL ...&#xA;Freeing pipeline ...&#xA;</qtdemux0></filesrc1></filesrc1></filesrc0>

    &#xA;

    My Thoughts

    &#xA;

    I believe the issue is not related to the above warning but rather mp4mux's incompatibility with srt subtitles.

    &#xA;

    The reason I belive this is because, other debug logs hint at it, but also stealing the subititles from another mp4 file and muxing it back together does work.

    &#xA;

    gst-launch-1.0  filesrc location=sample-nosub-avc.mp4 ! qtdemux ! mp4mux name=mux ! filesink location=output.mp4 filesrc location=sample-with-subs.mp4 ! qtdemux name=demux demux.subtitle_1 ! text/x-raw,format=utf8 ! queue ! mux.subtitle_0&#xA;

    &#xA;

    A major catch 22 I am having is that mp4 files don't typically support srt subtitles, but gstreamer's subparse element doesn't support parsing mp4 subtitle formats (tx3g, ttxt, etc.) so I'm not sure how I'm meant to put it all together.

    &#xA;

    I'm very sorry for the lengthy question but I've tried many things so it was difficult to condense it. Any hints or help is appreciated. Thank you.

    &#xA;