Recherche avancée

Médias (0)

Mot : - Tags -/organisation

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (38)

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

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (4084)

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

  • cv2.VideoCapture on python

    27 décembre 2015, par pandasarebest

    I am running the following code :

    import numpy as np
    import cv2
    import os

    count = 0

    cap = cv2.VideoCapture("/home/simon/PROJECT/real_data/00000020.mp4")

    while not cap.isOpened():
       cap = cv2.VideoCapture("./00000020.mp4")
       cv2.waitKey(1000)
       print "Wait for the header"

    pos_frame = cap.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)
    while True:
       flag, frame = cap.read()
       if flag:
           # The frame is ready and already captured
           cv2.imshow('video', frame)
           pos_frame = cap.get(cv2.cv.CV_CAP_PROP_POS_FRAMES)
           print str(pos_frame)+" frames"
       else:
           # The next frame is not ready, so we try to read it again
           cap.set(cv2.cv.CV_CAP_PROP_POS_FRAMES, pos_frame-1)
           print "frame is not ready"
           # It is better to wait for a while for the next frame to be ready
           cv2.waitKey(1000)

       if cv2.waitKey(10) & 0xFF == 27:
           break
       if cap.get(cv2.cv.CV_CAP_PROP_POS_FRAMES) ==       cap.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT):
       # If the number of captured frames is equal to the total number of frames,
       # we stop
       break


    if ret == True:
       frame = cv2.VideoCapture.grab()
       frame = 'frame%d' % count

       cv2.imwrite('frame%d.png', frame)

       count += 1
    else:
       print 'stopped at' + count
       break

    And whenever I run it, it loops on the while not loop, printing "wait for header".
    There is never an error code or anything like that either.

    I have tried to run it as a more simple piece of code, where it doesnt have all these checks, and again that doesn’t throw any errors.

    I am attempting to run this code to open a video, and then save the frames as png files throughout the video.

    Does anyone spot any particular problems with the code ?
    Or alternatively does anyone know a piece of code that would do what i want more efficiently, as I have trawled through google searches and stack overflow a lot recently and haven’t found anything

    Thanks in advance
    Panda

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