Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (12)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

Sur d’autres sites (5971)

  • Add audio to Xuggler video stream (ffmpeg)

    11 avril 2017, par zholmes1

    I am trying to set up Facebook live video streaming in Java. I maintain a BufferedImage separately from this method which contains the image that is being streamed. I am connecting successfully and streaming the video, but Facebook takes the video down after two minutes because I am not sending audio as well. How can I add audio to this stream ?

       IContainer container = IContainer.make();
       IContainerFormat containerFormat_live = IContainerFormat.make();
       containerFormat_live.setOutputFormat("flv", streamUrl, null);
       container.setInputBufferLength(0);
       int retVal = container.open(streamUrl, IContainer.Type.WRITE, containerFormat_live);
       if (retVal < 0) {
           System.err.println("Could not open output container for live stream");
           System.exit(1);
       }


       IStream videoStream = container.addNewStream(0);
       IStreamCoder videoCoder = videoStream.getStreamCoder();
       ICodec videoCodec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_H264);
       videoCoder.setNumPicturesInGroupOfPictures(5);
       videoCoder.setCodec(videoCodec);
       videoCoder.setBitRate(200000);
       videoCoder.setPixelType(IPixelFormat.Type.YUV420P);
       videoCoder.setHeight(IMAGE_HEIGHT_PX_OUTPUT);
       videoCoder.setWidth(IMAGE_WIDTH_PX_OUTPUT);
       System.out.println("[ENCODER] video size is " + IMAGE_HEIGHT_PX_OUTPUT + "x" + IMAGE_WIDTH_PX_OUTPUT);
       videoCoder.setFlag(IStreamCoder.Flags.FLAG_QSCALE, true);
       videoCoder.setGlobalQuality(0);
       IRational frameRate = IRational.make(30, 1);
       videoCoder.setFrameRate(frameRate);

       IRational timeBase = IRational.make(frameRate.getDenominator(), frameRate.getNumerator());
       videoCoder.setTimeBase(timeBase);

    //        IStream audioStream = container.addNewStream(1);
    //        IStreamCoder audioCoder = audioStream.getStreamCoder();
    //        ICodec audioCodec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_AAC);
    //        audioCoder.setCodec(audioCodec);
    //        audioCoder.setBitRate(128 * 1024);
    //        audioCoder.setChannels(1);
    //        audioCoder.setSampleRate(44100);
    //        audioCoder.setFrameRate(IRational.make(1, 1));
    //        audioCoder.setTimeBase(timeBase);
    //
    //        IAudioResampler audioResampler = IAudioResampler.make(audioCoder.getChannels(), audioCoder.getChannels(), audioCoder.getSampleRate(), audioCoder.getSampleRate(), IAudioSamples.Format.FMT_S32, audioCoder.getSampleFormat());

       Properties props = new Properties();
       InputStream is = XugglerRtmpReferenceImpl.class.getResourceAsStream("/libx264-normal.ffpreset");
       try {
           props.load(is);
       } catch (IOException e) {
           System.err.println("You need the libx264-normal.ffpreset file from the Xuggle distribution in your classpath.");
           System.exit(1);
       }

       Configuration.configure(props, videoCoder);
    //        Configuration.configure(props, audioCoder);

       videoCoder.open();
    //        audioCoder.open();
       container.writeHeader();

    //        IAudioSamples audioSamples = IAudioSamples.make(512, audioCoder.getChannels());
    //        audioSamples.setComplete(true, 1024, audioCoder.getSampleRate(), audioCoder.getChannels(), IAudioSamples.Format.FMT_S32, 0);
    //
    //        IAudioSamples resampledAudio = IAudioSamples.make(512, audioCoder.getChannels(), IAudioSamples.Format.FMT_S32);
    //        audioResampler.resample(resampledAudio, audioSamples, 0);


       long firstTimeStamp = System.currentTimeMillis();
       long lastKeyFrameTimestamp = 0;
       long lastTimeStamp = System.currentTimeMillis();
       int i = 0;
       while (streaming) {
           //long iterationStartTime = System.currentTimeMillis();
           long now = System.currentTimeMillis();
           //convert it for Xuggler
           BufferedImage currentScreenshot = new BufferedImage(bufferedImage.getWidth(), bufferedImage.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
           currentScreenshot.getGraphics().drawImage(bufferedImage, 0, 0, null);
           //start the encoding process
           IPacket packet = IPacket.make();
           IConverter converter = ConverterFactory.createConverter(currentScreenshot, IPixelFormat.Type.YUV420P);
           long timeStamp = (now - firstTimeStamp) * 1000;
           IVideoPicture outFrame = converter.toPicture(currentScreenshot, timeStamp);

           // make sure there is a keyframe at least every 2 seconds
           if (System.currentTimeMillis() - lastKeyFrameTimestamp > 1500) {
               outFrame.setKeyFrame(true);
               lastKeyFrameTimestamp = System.currentTimeMillis();
           }
           outFrame.setQuality(0);
           videoCoder.encodeVideo(packet, outFrame, 0);
           // audioCoder.encodeAudio(packet, IAudioSamples.make(0, audioCoder.getChannels()), 0);

           outFrame.delete();
           if (packet.isComplete()) {
               container.writePacket(packet);
               System.out.println("[ENCODER] writing packet of size " + packet.getSize() + " for elapsed time " + ((timeStamp - lastTimeStamp) / 1000));
               lastTimeStamp = System.currentTimeMillis();
           }
           System.out.println("[ENCODER] encoded image " + i + " in " + (System.currentTimeMillis() - now));
           i++;
           try {
               // sleep for framerate milliseconds
               Thread.sleep(Math.max((long) (1000 / frameRate.getDouble()) - (System.currentTimeMillis() - now), 0));
           } catch (InterruptedException e) {
               e.printStackTrace();
           }
       }
       container.writeTrailer();
  • MPEG-DASH - Multiplexed Representations Issue

    26 avril 2017, par Mike

    I’m trying to learn ffmpeg, MP4Box, and MPEG-DASH, but I’m running into an issue with the .mp4 I’m using. I’m using ffmpeg to demux the mp4 with this command :

    ffmpeg -i test.mp4 -c:v copy -g 72 -an video.mp4 -c:a copy audio.mp4

    Once the two files are created, I use MP4Box to segment the files for the dash player using this command :

    MP4Box -dash 4000 -frag 1000 -rap -segment-name segment_ output.mp4

    Which does create all the files I think I need. Then I point the player to the output_dash.mpd and nothing happens except a ton of messages in the console :

    [8] EME detected on this user agent! (ProtectionModel_21Jan2015)
    [11] Playback Initialized
    [21] [dash.js 2.3.0] MediaPlayer has been initialized
    [64] Parsing complete: ( xml2json: 3.42ms, objectiron: 2.61ms, total: 0.00603s)
    [65] Manifest has been refreshed at Wed Apr 12 2017 12:16:52 GMT-0600 (MDT)[1492021012.196]  
    [72] MediaSource attached to element.  Waiting on open...
    [77] MediaSource is open!
    [77] Duration successfully set to: 148.34
    [78] Added 0 inline events
    [78] No video data.
    [79] No audio data.
    [79] No text data.
    [79] No fragmentedText data.
    [79] No embeddedText data.
    [80] Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines
    [81] No streams to play.

    Here is the MP4Box -info on the video I’m using :

    * Movie Info *
       Timescale 1000 - Duration 00:02:28.336
       Fragmented File no - 2 track(s)
       File suitable for progressive download (moov before mdat)
       File Brand mp42 - version 512
       Created: GMT Wed Feb  6 06:28:16 2036

    File has root IOD (9 bytes)
    Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
    Visual PL: Not part of MPEG-4 Visual profiles (0xfe)
    Audio PL: Not part of MPEG-4 audio profiles (0xfe)
    No streams included in root OD

    iTunes Info:
       Name: Rogue One - A Star Wars Story
       Artist: Lucasfilm
       Genre: Trailer
       Created: 2016
       Encoder Software: HandBrake 0.10.2 2015060900
       Cover Art: JPEG File

    Track # 1 Info - TrackID 1 - TimeScale 90000 - Duration 00:02:28.335
    Media Info: Language "Undetermined" - Type "vide:avc1" - 3552 samples
    Visual Track layout: x=0 y=0 width=1920 height=816
    MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
    AVC/H264 Video - Visual Size 1920 x 816
       AVC Info: 1 SPS - 1 PPS - Profile High @ Level 4.1
       NAL Unit length bits: 32
       Pixel Aspect Ratio 1:1 - Indicated track size 1920 x 816
    Self-synchronized

    Track # 2 Info - TrackID 2 - TimeScale 44100 - Duration 00:02:28.305
    Media Info: Language "English" - Type "soun:mp4a" - 6387 samples
    MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
    MPEG-4 Audio MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 44100
    Synchronized on stream 1
    Alternate Group ID 1

    I know I need to separate the video and audio and I think that’s where my issue is. The command I’m using probably isn’t doing the right thing.

    Is there a better command to demux my mp4 ?
    Is the MP4Box command I’m using best for segmenting the files ?
    If I use different files, will they always need to be demuxed ?

    One thing to mention, if I use the following commands everything works fine, but there is no audio because of the -an which means it’s only video :

    ffmpeg -i test.mp4 -c:v copy -g 72 -an output.mp4

    MP4Box -dash 4000 -frag 1000 -rap -segment-name segment_ output.mp4

    UPDATE

    I noticed that the video had no audio stream, but the audio had the video stream which is why I got the mux error. I thought that might be an issue so I ran this command to keep the unwanted streams out of the outputs :

    ffmpeg -i test.mp4 -c:v copy -g 72 -an video.mp4 -c:a copy -vn audio.mp4

    then I run :

    MP4Box -dash 4000 -frag 1000 -rap -segment-name segment_ video.mp4 audio.mp4

    now I no longer get the Multiplexed representations are intentionally not supported... message, but now I get :

    [122] Video Element Error: MEDIA_ERR_SRC_NOT_SUPPORTED
    [123] [object MediaError]
    [125] Schedule controller stopping for audio
    [126] Caught pending play exception - continuing (NotSupportedError: Failed to load because no supported source was found.)

    I tried playing the video and audio independently through Chrome and they both work, just not through the dash player. Ugh, this is painful to learn, but I feel like I’m making progress.

  • Merge commit '549d0bdca53af7a6e0c612ab4b03baecf3a5878f'

    22 avril 2017, par James Almer
    Merge commit '549d0bdca53af7a6e0c612ab4b03baecf3a5878f'
    

    * commit '549d0bdca53af7a6e0c612ab4b03baecf3a5878f' :
    decode : be more explicit about storing the last packet properties

    Also copy pkt->size in extract_packet_props(), as it's needed for
    AVFrame.pkt_size

    Merged-by : James Almer <jamrial@gmail.com>

    • [DH] libavcodec/decode.c
    • [DH] libavcodec/internal.h
    • [DH] libavcodec/pthread_frame.c
    • [DH] libavcodec/rawdec.c
    • [DH] libavcodec/utils.c