Recherche avancée

Médias (2)

Mot : - Tags -/media

Autres articles (111)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Les notifications de la ferme

    1er décembre 2010, par

    Afin d’assurer une gestion correcte de la ferme, il est nécessaire de notifier plusieurs choses lors d’actions spécifiques à la fois à l’utilisateur mais également à l’ensemble des administrateurs de la ferme.
    Les notifications de changement de statut
    Lors d’un changement de statut d’une instance, l’ensemble des administrateurs de la ferme doivent être notifiés de cette modification ainsi que l’utilisateur administrateur de l’instance.
    À la demande d’un canal
    Passage au statut "publie"
    Passage au (...)

  • Initialisation de MediaSPIP (préconfiguration)

    20 février 2010, par

    Lors de l’installation de MediaSPIP, celui-ci est préconfiguré pour les usages les plus fréquents.
    Cette préconfiguration est réalisée par un plugin activé par défaut et non désactivable appelé MediaSPIP Init.
    Ce plugin sert à préconfigurer de manière correcte chaque instance de MediaSPIP. Il doit donc être placé dans le dossier plugins-dist/ du site ou de la ferme pour être installé par défaut avant de pouvoir utiliser le site.
    Dans un premier temps il active ou désactive des options de SPIP qui ne le (...)

Sur d’autres sites (7370)

  • JavaCV FFmpegFrameGrabber preload audio

    1er juillet 2015, par James

    I have an application that streams video data to a RTMP server using javacv’s FFmpegFrameRecorder. I want to add some audio to this stream from a separate file - a short sound clip that I want to play on repeat.

    Given the sound clip is very short, I want to preload the audio data into memory and just loop over it - so I can avoid excessive IO etc.

    I’ve attempted to add audio to the stream using javacv’s FFmpegFrameGrabber, as prescribed on multiple tutorials.

    The addition of audio works perfectly if I don’t attempt to preload/cache any of the audio data, for example :

    private FFmpegFrameRecorder frameRecorder;
    private FFmpegFrameGrabber frameGrabber;

    ...
    //frameRecorder and frameGrabber setup during initialization
    ...

    public void record(IplImage image) {
           try {
               frameRecorder.record(image);
               Frame frame = frameGrabber.grabFrame();
               if(frame == null) {
                   frameGrabber = new FFmpegFrameGrabber("audioFileHere.wav");
                   frameGrabber.start();
                   frame = frameGrabber.grabFrame();
               }
               frameRecorder.record(frame);
           } catch (FrameRecorder.Exception e) {
               log.error(getMarker(FATAL), "Can't record frame!", e);
           } catch (FrameGrabber.Exception e) {
               log.error(getMarker(FATAL), "Can't record frame!", e);
           }
    }

    However, if I try to preload the audio data I get garbage sound being played :

    private FFmpegFrameRecorder frameRecorder;
    private List<framedata> audioData;

    private static final class FrameData {
       public final Buffer[] samples;
       public final Integer sampleRate;
       public final Integer audioChannels;

       //Constructors, getters and setters here
    }

    ...
       //frameRecorder setup during initialization
       audioData = new ArrayList&lt;>();
       FFmpegFrameGrabber audioGrabber = new FFmpegFrameGrabber("audioFileHere.wav");
       try {
           audioGrabber.start();
           Frame frame;
           while ((frame = audioGrabber.grabFrame()) != null) {
               Buffer[] buffers = frame.samples;
               Buffer[] copiedBuffers = new Buffer[buffers.length];
               for (int i = 0; i &lt; buffers.length; i++) {
                   copiedBuffers[i] = ((ShortBuffer) buffers[i]).duplicate();
               }
               FrameData frameData = new FrameData(copiedBuffers, frame.sampleRate, frame.audioChannels);
               audioData.add(frameData);
           }
       } catch (FrameGrabber.Exception e) {
           e.printStackTrace();
       }
    ...

    private int frameCount = 0;

    public void record(IplImage image) {
       frameCount++;
       try {
           FrameData frameData = audioData.get(frameCount % audioData.size());
           frameRecorder.record(image);
           frameRecorder.record(frameData.sampleRate, frameData.audioChannels, frameData.samples);
       } catch (FrameRecorder.Exception e) {
           log.error(getMarker(FATAL), "Can't record frame!", e);
       }
    }
    </framedata>

    NOTE : I have to deep copy the Frame object because FFmpegFrameGrabber.grabFrame() recycles a single Frame object

    Can someone explain why this doesn’t work and/or how I could achieve the desired result ?

  • Using HEVC with Alpha to Compose Moviepy Video

    3 avril, par James Grace

    I'm using moviepy, PIL and numpy and trying to compile a video with 3 components : A background image that is a PNG with no transparency, an Overlay Video that is a HEVC with Alpha, and a primary clip that is produced with a collection of PNG images with transparency.

    &#xA;

    The video is composed with background + overlay video + main video.

    &#xA;

    The problem I'm having is that the overlay video has a black background, so the background image is covered completely. Moviepy is able to import the HEVC video successfully by it seems as though the Alpha channel is lost on import.

    &#xA;

    Any ideas ?

    &#xA;

    Here's my code :

    &#xA;

    from PIL import Image&#xA;import moviepy.editor as mpe&#xA;import numpy as np&#xA;&#xA;def CompileVideo() :&#xA;&#xA;    frames = ["list_of_png_files_with_transparency"]&#xA;    fps = 30.0&#xA;    clips = [mpe.ImageClip(np.asarray(Image.open(frame))).set_duration(1 / int(fps)) for frame in frames]&#xA;    ad_clip = mpe.concatenate_videoclips(clips, method="compose")&#xA;    bg_clip = mpe.ImageClip(np.asarray(Image.open("path_to_background_file_no_transparency"))).set_duration(ad_clip.duration)&#xA;&#xA;    overlay_clip = mpe.VideoFileClip("path_to_HEVC_with_Alpha.mov")&#xA;&#xA;    comp = [bg_clip, overlay_clip, ad_clip]&#xA;&#xA;    final = mpe.CompositeVideoClip(comp).set_duration(ad_clip.duration)&#xA;    final.write_videofile("output.mp4", fps=fps)&#xA;

    &#xA;

  • Using Flutter FFMPEG_KIT to convert a sequence of RGBA images into a mp4 video

    30 avril 2023, par jdevp2

    I’m trying to convert a sequence of RGBA byte images into an MP4 video by using Flutter FFMPEGKit package. The following is the code snippet but it gives me an error. I’m not sure what is the correct option that I should use to convert a set of rawrgba images to a video. I appreciate any help.

    &#xA;

     static Future<void> videoEncoder() async {&#xA;    appTempDir = &#x27;${(await getTemporaryDirectory()).path}/workPath&#x27;;&#xA;   &#xA;    FFmpegKit.execute(&#xA;           &#x27;-hide_banner -y -f rawvideo -pix_fmt rgba -i appTempDir/input%d.rgba -c:v mpeg4  -r 12 appTempDir/output.mp4&#x27;)&#xA;     .then((session) async {&#xA;       final returnCode = await session.getReturnCode();&#xA;      if (ReturnCode.isSuccess(returnCode)) {&#xA;        print(&#x27;SUCCESS&#x27;);&#xA;      } else if (ReturnCode.isCancel(returnCode)) {&#xA;        print(&#x27;CANCEL&#x27;);&#xA;      } else {&#xA;        print(&#x27;ERROR&#x27;);&#xA;      }&#xA;    });&#xA;  }&#xA;}&#xA;</void>

    &#xA;

    The image rgba data is saved via the following code snippet.

    &#xA;

    Utils.getBuffer(renderKey).then((value) async {&#xA;        ui.Image buffer = value;&#xA;        final data =&#xA;            await buffer!.toByteData(format: ui.ImageByteFormat.rawRgba);&#xA;        Uint8List uData = data!.buffer.asUint8List();&#xA;        VideoUtil.saveImageFileToDirectory(uData, &#x27;input$frameNum.rgba&#x27;);&#xA;        frameNum&#x2B;&#x2B;;&#xA;        });&#xA;

    &#xA;