Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (64)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • 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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (13760)

  • Merging audio(aac) and video (h.264 in mp4 container) into a mp4 container using Xuggler

    26 août 2016, par Handroid

    Here is the code I am using

       String filenamevideo = videoFilePath;(video.mp4)

       String filenameaudio = audioAACFilePath; (audio.aac)



       IMediaWriter mWriter = ToolFactory.makeWriter(videoWithAudioFilePath); // output
       // file

       IContainer containerVideo = IContainer.make();
       IContainer containerAudio = IContainer.make();

       if (containerVideo.open(filenamevideo, IContainer.Type.READ, null) < 0)
           throw new IllegalArgumentException("Cant find " + filenamevideo);

       if (containerAudio.open(filenameaudio, IContainer.Type.READ, null) < 0)
           throw new IllegalArgumentException("Cant find " + filenameaudio);

       int numStreamVideo = containerVideo.getNumStreams();
       int numStreamAudio = containerAudio.getNumStreams();    

       int videostreamt = -1; // this is the video stream id
       int audiostreamt = -1;

       IStreamCoder videocoder = null;

       for (int i = 0; i < numStreamVideo; i++) {
           IStream stream = containerVideo.getStream(i);
           IStreamCoder code = stream.getStreamCoder();

           if (code.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) {
               videostreamt = i;
               videocoder = code;
               break;
           }

       }

       for (int i = 0; i < numStreamAudio; i++) {
           IStream stream = containerAudio.getStream(i);
           IStreamCoder code = stream.getStreamCoder();

           if (code.getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) {
               audiostreamt = i;
               break;
           }

       }

       if (videostreamt == -1)
           throw new RuntimeException("No video steam found");
       if (audiostreamt == -1)
           throw new RuntimeException("No audio steam found");

       if (videocoder.open() < 0)
           throw new RuntimeException("Cant open video coder");
       IPacket packetvideo = IPacket.make();

       IStreamCoder audioCoder = containerAudio.getStream(audiostreamt).getStreamCoder();

       if (audioCoder.open() < 0)
           throw new RuntimeException("Cant open audio coder");

       mWriter.addAudioStream(0, 0, ICodec.ID.CODEC_ID_AAC, audioCoder.getChannels(),audioCoder.getSampleRate());

       mWriter.addVideoStream(1, 0, ICodec.ID.CODEC_ID_H264, videocoder.getWidth(), videocoder.getHeight());


       IPacket packetaudio = IPacket.make();

       while (containerVideo.readNextPacket(packetvideo) >= 0 || containerAudio.readNextPacket(packetaudio) >= 0) {

           if (packetvideo.getStreamIndex() == videostreamt) {

               // video packet
               IVideoPicture picture = IVideoPicture.make(videocoder.getPixelType(), videocoder.getWidth(),
                       videocoder.getHeight());
               int offset = 0;
               while (offset < packetvideo.getSize()) {
                   int bytesDecoded = videocoder.decodeVideo(picture, packetvideo, offset);
                   if (bytesDecoded < 0)
                       throw new RuntimeException("bytesDecoded not working");
                   offset += bytesDecoded;
                   if (picture.isComplete()) {
                       // System.out.println(picture.getPixelType());
                       mWriter.encodeVideo(1, picture);
                   }
               }
           }

           if (packetaudio.getStreamIndex() == audiostreamt) {
               // audio packet
               IAudioSamples samples = IAudioSamples.make(512, audioCoder.getChannels(), IAudioSamples.Format.FMT_S32);
               int offset = 0;
               while (offset < packetaudio.getSize()) {
                   int bytesDecodedaudio = audioCoder.decodeAudio(samples, packetaudio, offset);
                   if (bytesDecodedaudio < 0)
                       throw new RuntimeException("could not detect audio");
                   offset += bytesDecodedaudio;
                   if (samples.isComplete()) {
                       mWriter.encodeAudio(0, samples);
                   }
               }

           }          
       }

    The output file (mp4) is generating , but unable to play it using (vlc) and in JavaFX scene media.

    Please help me with the inputs on the above code I’m using it in a correct way (Or) help me with the possible solution for merging audio(aac) and video(h264) to mp4 container.

    Thank in advance.

  • Mixing audio(aac) and video (h.264 in mp4 container) and write to mp4 container using Xuggler

    25 novembre 2015, par Handroid

    Here is the code I am using

       String filenamevideo = videoFilePath;(video.mp4)

       String filenameaudio = audioAACFilePath; (audio.aac)



       IMediaWriter mWriter = ToolFactory.makeWriter(videoWithAudioFilePath); // output
       // file

       IContainer containerVideo = IContainer.make();
       IContainer containerAudio = IContainer.make();

       if (containerVideo.open(filenamevideo, IContainer.Type.READ, null) < 0)
           throw new IllegalArgumentException("Cant find " + filenamevideo);

       if (containerAudio.open(filenameaudio, IContainer.Type.READ, null) < 0)
           throw new IllegalArgumentException("Cant find " + filenameaudio);

       int numStreamVideo = containerVideo.getNumStreams();
       int numStreamAudio = containerAudio.getNumStreams();    

       int videostreamt = -1; // this is the video stream id
       int audiostreamt = -1;

       IStreamCoder videocoder = null;

       for (int i = 0; i < numStreamVideo; i++) {
           IStream stream = containerVideo.getStream(i);
           IStreamCoder code = stream.getStreamCoder();

           if (code.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) {
               videostreamt = i;
               videocoder = code;
               break;
           }

       }

       for (int i = 0; i < numStreamAudio; i++) {
           IStream stream = containerAudio.getStream(i);
           IStreamCoder code = stream.getStreamCoder();

           if (code.getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) {
               audiostreamt = i;
               break;
           }

       }

       if (videostreamt == -1)
           throw new RuntimeException("No video steam found");
       if (audiostreamt == -1)
           throw new RuntimeException("No audio steam found");

       if (videocoder.open() < 0)
           throw new RuntimeException("Cant open video coder");
       IPacket packetvideo = IPacket.make();

       IStreamCoder audioCoder = containerAudio.getStream(audiostreamt).getStreamCoder();

       if (audioCoder.open() < 0)
           throw new RuntimeException("Cant open audio coder");

       mWriter.addAudioStream(0, 0, ICodec.ID.CODEC_ID_AAC, audioCoder.getChannels(),audioCoder.getSampleRate());

       mWriter.addVideoStream(1, 0, ICodec.ID.CODEC_ID_H264, videocoder.getWidth(), videocoder.getHeight());


       IPacket packetaudio = IPacket.make();

       while (containerVideo.readNextPacket(packetvideo) >= 0 || containerAudio.readNextPacket(packetaudio) >= 0) {

           if (packetvideo.getStreamIndex() == videostreamt) {

               // video packet
               IVideoPicture picture = IVideoPicture.make(videocoder.getPixelType(), videocoder.getWidth(),
                       videocoder.getHeight());
               int offset = 0;
               while (offset < packetvideo.getSize()) {
                   int bytesDecoded = videocoder.decodeVideo(picture, packetvideo, offset);
                   if (bytesDecoded < 0)
                       throw new RuntimeException("bytesDecoded not working");
                   offset += bytesDecoded;
                   if (picture.isComplete()) {
                       // System.out.println(picture.getPixelType());
                       mWriter.encodeVideo(1, picture);
                   }
               }
           }

           if (packetaudio.getStreamIndex() == audiostreamt) {
               // audio packet
               IAudioSamples samples = IAudioSamples.make(512, audioCoder.getChannels(), IAudioSamples.Format.FMT_S32);
               int offset = 0;
               while (offset < packetaudio.getSize()) {
                   int bytesDecodedaudio = audioCoder.decodeAudio(samples, packetaudio, offset);
                   if (bytesDecodedaudio < 0)
                       throw new RuntimeException("could not detect audio");
                   offset += bytesDecodedaudio;
                   if (samples.isComplete()) {
                       mWriter.encodeAudio(0, samples);
                   }
               }

           }          
       }

    The output file (mp4) is generating , but unable to play it using (vlc) and in JavaFX scene media.

    Please help me with the inputs on the above code I’m using it in a correct way (Or) help me with the possible solution for mixing audio(aac) and video(h264) to mp4 container.

    Thank in advance.

  • NodeJS - FFmpeg : Extract Frame from Video stdin stream (EPIPE write Error)

    3 avril 2022, par ManiB

    I want to pipe an input steam (video) (should later be an http stream) to ffmpeg child process to extract an thumbnail :

    


    require("stream").pipeline(
  require("fs").createReadStream("files/myVideo.mp4"),
  require("child_process").spawn("ffmpeg", ["-i", "-", "-ss", "00:00:01", "-frames:v", "1", "-y", "files/myImage.jpeg"]).stdin,
  (err) => console.log("Done", err)
);


    


    So far so good, I get an extracted Image, but also an Error :

    


    Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}


    


    Converting full videos (e.g. mp4 -> mkv) works without errors.

    


    My suggestion is, FFmpeg will close stdin too early (because image is already found on first second) and readable-stream is not able to write to stdin anymore.

    


    How can I manage, to fix the error and gracefully close all streams ?

    


    System :

    


      

    • Linux Centos 7 (also tried Windows Server 1809)
    • 


    • NodeJS v16.14.1 (Windows v16.13.0)
    • 


    • FFmpeg v4.4.1-static (Windows v4.4-full_build-www.gyan.dev)
    •