Recherche avancée

Médias (91)

Autres articles (64)

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

  • Sélection de projets utilisant MediaSPIP

    29 avril 2011, par

    Les exemples cités ci-dessous sont des éléments représentatifs d’usages spécifiques de MediaSPIP pour certains projets.
    Vous pensez avoir un site "remarquable" réalisé avec MediaSPIP ? Faites le nous savoir ici.
    Ferme MediaSPIP @ Infini
    L’Association Infini développe des activités d’accueil, de point d’accès internet, de formation, de conduite de projets innovants dans le domaine des Technologies de l’Information et de la Communication, et l’hébergement de sites. Elle joue en la matière un rôle unique (...)

Sur d’autres sites (5346)

  • R "only" substitute of the av package to split and convert an mp4 into multiple mp3 [closed]

    9 février 2024, par Bakaburg

    I am developing an R package that requires splitting an mp4 file into multiple segments and converting these segments into mp3 format. Currently, I use the av package for this task. However, av depends on the external ffmpeg tool, necessitating separate installation. This dependency complicates the setup for non-expert users of my package.

    


    I am seeking an alternative approach that either uses only R or incorporates a low-level solution directly within the package, eliminating the need for external tool installations. The goal is to streamline the user experience by minimizing setup complexity.

    


    Does anyone know of such a solution or approach that can substitute the functionality provided by av without external dependencies ?

    


  • How can you combine multiple video files with FFMPEG and merging the audio track as well

    19 décembre 2023, par Codrut

    I'm trying to combine multiple MP4 files in Delphi with the FFMPEG video library. I have the headers unit with all the functions. All videos are MPEG-4, and so is the destination output file.

    


    I found this question on Stack Overflow asking the same question. To combine video files while keeping the audio and video tracks.
I have translated the answers to Delphi, and while the code is executed successfully, the output file is invalid and cannot be played.

    


    Here is my implementation :

    


    var&#xA;  Files: TArray<pansichar>;&#xA;  Output: PAnsiChar;&#xA;&#xA;  I, S: integer;&#xA;&#xA;  i_fmt_ctx: PAVFormatContext;&#xA;  i_video_stream: PAVStream;&#xA;  o_fmt_ctx: PAVFormatContext;&#xA;  o_video_stream: PAVStream;&#xA;&#xA;  P: PPAVStream;&#xA;begin&#xA;  SetLength(Files, 2);&#xA;  Files[0] := PAnsiChar(&#x27;.\Clips\file9.mp4&#x27;);&#xA;  Files[1] := PAnsiChar(&#x27;.\Clips\file10.mp4&#x27;);&#xA;  Output := &#x27;.\Output\out.mp4&#x27;;&#xA;&#xA;  avcodec_register_all();   &#xA;  av_register_all();&#xA;&#xA;  (* should set to NULL so that avformat_open_input() allocate a new one *)&#xA;  i_fmt_ctx := nil;&#xA;&#xA;  if avformat_open_input(@i_fmt_ctx, Files[0], nil, nil) &lt;> 0 then&#xA;    raise Exception.Create(&#x27;Could not open file&#x27;);&#xA;&#xA;  if avformat_find_stream_info(i_fmt_ctx, nil) &lt; 0 then&#xA;    raise Exception.Create(&#x27;Could not find stream info&#x27;);&#xA;                &#xA;  (* Find 1st video stream *)&#xA;  i_video_stream := nil;&#xA;  P := i_fmt_ctx.streams;&#xA;  for i := 0 to i_fmt_ctx.nb_streams-1 do begin&#xA;    if P^.codec.codec_type = AVMEDIA_TYPE_VIDEO then&#xA;      begin&#xA;        i_video_stream := P^;&#xA;        Break;&#xA;      end;&#xA;    Inc(P);&#xA;  end;&#xA;  if i_video_stream = nil then&#xA;    raise Exception.Create(&#x27;Could not find video stream&#x27;);&#xA;&#xA;  avformat_alloc_output_context2(@o_fmt_ctx, nil, nil, Output);&#xA;&#xA;  (*&#xA;  since all input files are supposed to be identical (framerate, dimension, color format, ...)&#xA;  we can safely set output codec values from first input file&#xA;  *)&#xA;  o_video_stream := avformat_new_stream(o_fmt_ctx, nil);&#xA;  &#xA;  var c: PAVCodecContext;&#xA;  c := o_video_stream.codec;&#xA;  c.bit_rate := 400000;&#xA;  c.codec_id := i_video_stream.codec.codec_id;&#xA;  c.codec_type := i_video_stream.codec.codec_type;&#xA;  c.time_base.num := i_video_stream.time_base.num;&#xA;  c.time_base.den := i_video_stream.time_base.den;&#xA;  //fprintf(stderr, "time_base.num = %d time_base.den = %d\n", c->time_base.num, c->time_base.den);&#xA;  c.width := i_video_stream.codec.width;&#xA;  c.height := i_video_stream.codec.height;&#xA;  c.pix_fmt := i_video_stream.codec.pix_fmt;&#xA;  //printf("%d %d %d", c->width, c->height, c->pix_fmt);&#xA;  c.flags := i_video_stream.codec.flags;&#xA;  c.flags := c.flags or CODEC_FLAG_GLOBAL_HEADER;&#xA;  c.me_range := i_video_stream.codec.me_range;&#xA;  c.max_qdiff := i_video_stream.codec.max_qdiff;&#xA;&#xA;  c.qmin := i_video_stream.codec.qmin;&#xA;  c.qmax := i_video_stream.codec.qmax;&#xA;&#xA;  c.qcompress := i_video_stream.codec.qcompress;&#xA;&#xA;  c.extradata := i_video_stream.codec.extradata;&#xA;  c.extradata_size := i_video_stream.codec.extradata_size;&#xA;&#xA;  avio_open(@o_fmt_ctx.pb, Output, AVIO_FLAG_WRITE);&#xA;&#xA;  (* yes! this is redundant *)&#xA;  avformat_close_input(@i_fmt_ctx);&#xA;&#xA;  avformat_write_header(o_fmt_ctx, nil);&#xA;&#xA;  var last_pts: integer; last_pts := 0;&#xA;  var last_dts: integer; last_dts := 0;&#xA;  for i := 1 to High(Files) do begin&#xA;    i_fmt_ctx := nil;&#xA;&#xA;    if avformat_open_input(@i_fmt_ctx, Files[i], nil, nil) &lt;> 0 then&#xA;      raise Exception.Create(&#x27;Could not open input file&#x27;);&#xA;&#xA;    if avformat_find_stream_info(i_fmt_ctx, nil) &lt; 0 then&#xA;      raise Exception.Create(&#x27;Could not find stream info&#x27;);&#xA;&#xA;    av_dump_format(i_fmt_ctx, 0, Files[i], 0);&#xA;    &#xA;    (* we only use first video stream of each input file *)&#xA;    i_video_stream := nil;&#xA;&#xA;    P := i_fmt_ctx.streams;&#xA;    for S := 0 to i_fmt_ctx.nb_streams-1 do&#xA;      begin&#xA;        if (P^.codec.codec_type = AVMEDIA_TYPE_VIDEO) then&#xA;          begin&#xA;            i_video_stream := P^;&#xA;            break;&#xA;          end;&#xA;        &#xA;        Inc(P);&#xA;      end;&#xA;&#xA;    if i_video_stream = nil then&#xA;      raise Exception.Create(&#x27;Could not find video stream&#x27;);&#xA;    &#xA;    var pts, dts: int64;&#xA;    pts := 0; dts := 0;&#xA;    while true do begin&#xA;      var i_pkt: TAVPacket;&#xA;      av_init_packet( @i_pkt );&#xA;      i_pkt.size := 0;&#xA;      i_pkt.data := nil;&#xA;&#xA;      if av_read_frame(i_fmt_ctx, @i_pkt) &lt; 0 then&#xA;        break;&#xA;      (*&#xA;        pts and dts should increase monotonically&#xA;        pts should be >= dts&#xA;      *)&#xA;      i_pkt.flags := i_pkt.flags or AV_PKT_FLAG_KEY;&#xA;      pts := i_pkt.pts;&#xA;      Inc(i_pkt.pts, last_pts);&#xA;      dts := i_pkt.dts;&#xA;      Inc(i_pkt.dts, last_dts);&#xA;      i_pkt.stream_index := 0;&#xA;&#xA;      // Write&#xA;      av_interleaved_write_frame(o_fmt_ctx, @i_pkt);&#xA;    end;&#xA;&#xA;    Inc(last_dts, dts);&#xA;    Inc(last_pts, pts);  &#xA;  &#xA;    avformat_close_input(@i_fmt_ctx)&#xA;  end;&#xA;&#xA;  av_write_trailer(o_fmt_ctx);&#xA;&#xA;  avcodec_close(o_fmt_ctx.streams^.codec);&#xA;  av_freep(&amp;o_fmt_ctx.streams^.codec);&#xA;  av_freep(&amp;o_fmt_ctx.streams);&#xA;&#xA;  avio_close(o_fmt_ctx.pb);&#xA;  av_free(o_fmt_ctx);&#xA;</pansichar>

    &#xA;

    Which is a translation of Михаил Чеботарев's answer.

    &#xA;

    Even if the code worked, I see no handling of the AVMEDIA_TYPE_AUDIO stream, which means this answer is 1/2 of the problem, since It only combines the video stream.

    &#xA;

    Another approach I tried was using the UBitmaps2Video FFMPEG implementation, which is successfully able to merge the video files, but only the video stream, no audio.

    &#xA;

    I tried manually converting the audio stream with the Bass Audio Library. It was able to read the audio and write It in a single WAV file, which then I converted to MP3. Finally muxing the combined video file and the MP3 file with MuxStreams2. Unfortunately, the audio and video do not align properly. I was unable to pinpoint the issue.

    &#xA;

    Currently, the only functional option is using the precompiled FFMPEG Executables and using ShellExecute with the according parameters to combine the videos.&#xA;This more exactly :

    &#xA;

    ffmpeg -f concat -safe 0 -i video-list.txt -c copy output.mp4&#xA;

    &#xA;

    But I would still rather use the FFMPEG headers in Delphi to combine the videos that way, as that gives the option for Progress indicatiors, more control of the playback and the ability to pause the thread at any point.

    &#xA;

    So, why does my implementation to merge video files not work. And what is a good method to include the audio stream as well ?

    &#xA;

  • how to remove multiple parts from a video, using ffmpeg ?

    26 septembre 2023, par jojo

    how to remove multiple parts from a video ?&#xA;for example i have a video of one minute and i want to delete following segments :

    &#xA;

    from second 0.0 to second 10.0&#xA;from second 20.0 to second 30.0&#xA;from second 40.0 to second 45.0

    &#xA;

    please remember i want to delete above mentioned segments, the output should not include these segments.&#xA;i have already tried all the answers, but they are all joining the trimmed segments, which i don't want.e.g :

    &#xA;

    ffmpeg -i foo.mp4 -filter_complex "[0:v]trim=duration=30[av];[0:a]atrim=duration=30[aa];[0:v]trim=start=40:end=50,setpts=PTS-STARTPTS[bv];[0:a]atrim=start=40:end=50,asetpts=PTS-STARTPTS[ba];[0:v]trim=start=80,setpts=PTS-STARTPTS[cv];[0:a]atrim=start=80,asetpts=PTS-STARTPTS[ca];[av][aa][bv][ba][cv][ca]concat=n=3:v=1:a=1" out.mp4&#xA;

    &#xA;

    thank you.&#xA;note :(python version also accepted.)

    &#xA;