Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (38)

  • 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

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
    Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
    Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)

  • Librairies et logiciels spécifiques aux médias

    10 décembre 2010, par

    Pour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
    Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)

Sur d’autres sites (5796)

  • Android JavaCV FFmpeg webstream to local static website

    26 mars 2017, par Thomas Devoogdt

    For my integrated test I’m working on an application that needs to provide a live stream to a locally hosted website. I’ve already built a working site that run’s on nanohttpd. This application performs also special image processing. Therefore I use JavaCV. The library is working perfectly and all cpp bindings are working too.

    My question : How to set up a live stream that can directly be played in a static site hosted by nanohttpd ? - I am on the right way ?

    My code :

    init :

    private void initLiveStream() throws FrameRecorder.Exception {
       /* ~~~ https://github.com/bytedeco/javacv/issues/598 ~~~ */
       frameRecorder = new FFmpegFrameRecorder("http://localhost:9090", imageWidth, imageHeight, 0);
       frameRecorder.setVideoOption("preset", "ultrafast");
       frameRecorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
       frameRecorder.setAudioCodec(0);
       frameRecorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
       frameRecorder.setFormat("webm");
       frameRecorder.setGopSize(10);
       frameRecorder.setFrameRate(frameRate);
       frameRecorder.setVideoBitrate(5000);
       frameRecorder.setOption("content_type","video/webm");
       frameRecorder.setOption("listen", "1");
       frameRecorder.start();
    }

    In my CameraView :

    @Override
    public void onPreviewFrame(byte[] data, Camera camera) {
       Camera.Size size = camera.getParameters().getPreviewSize();
       Frame frame = new AndroidFrameConverter().convert(data, size.width, size.height);
       try {
            if(frameRecorder!=null){
                frameRecorder.record(frame);
            }
        } catch (FrameRecorder.Exception e) {
            e.printStackTrace();
        }
    }

    Here is one of the stack traces that ar shown frequently in my search to the solution :

    org.bytedeco.javacv.FrameRecorder$Exception: avio_open error() error -111: Could not open 'http://localhost:9090'

    I couldn’t find any other thread addressing this specific issue.

    Thanks in advance

    EDIT

    Thanks to Chester Cobus, Here is my used code :

    Websocket :

    //Constructor
    AsyncHttpServer serverStream = new AsyncHttpServer();
    List<websocket> sockets = new ArrayList&lt;>();

    //http://stackoverflow.com/a/33021907/5500092
    //I'm planning to use more sockets. This is the only uniform expression I found.
    serverStream.websocket("/((?:[^/]*/)*)(.*)", new AsyncHttpServer.WebSocketRequestCallback() {
        @Override
        public void onConnected(final WebSocket webSocket, AsyncHttpServerRequest request) {
            String uri = request.getPath();
            if (uri.equals("/live")) {
                sockets.add(webSocket);

                //Use this to clean up any references to your websocket
                webSocket.setClosedCallback(new CompletedCallback() {
                    @Override
                    public void onCompleted(Exception ex) {
                        try {
                            if (ex != null)
                                Log.e("WebSocket", "Error");
                        } finally {
                            sockets.remove(webSocket);
                        }
                    }
                });
            }
        }
    });

    //Updater (Observer pattern)
    @Override
    public void updated(byte[] data) {
       for (WebSocket socket : sockets) {
            socket.write(new ByteBufferList(data));
       }
    }
    </websocket>

    Record Acitivy

    private long start_time = System.currentTimeMillis();

    @Override
    public void onPreviewFrame(byte[] data, Camera camera) {
       long now_time = System.currentTimeMillis();
       if ((now_time - start_time) > 250) {
           start_time = now_time;
           //https://forums.xamarin.com/discussion/40991/onpreviewframe-issue-converting-preview-byte-to-android-graphics-bitmap
           Camera.Size size = camera.getParameters().getPreviewSize();
           YuvImage image = new YuvImage(data, ImageFormat.NV21, size.width, size.height, null);
           ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
           image.compressToJpeg(new Rect(0, 0, size.width, size.height), 60, byteArrayOutputStream);
           MainActivity.getWebStreamer().updated(byteArrayOutputStream.toByteArray());
       }
    }

    JavaScript

    var socket;
    var imageElement;

    /**
    * path - String.Format("ws://{0}:8090/live", Window.Location.HostName)
    * image - HTMLImageElement
    */
    function imageStreamer(path, image) {
       imageElement = image;
       socket = new WebSocket(path);

       socket.onmessage = function(msg) {
           var arrayBuffer = msg.data;
           var reader = new FileReader();
           reader.onload = function(e) {
               imageElement.src = e.target.result;
           };
           reader.readAsDataURL(arrayBuffer);
       };
    }
  • h264pred : added AVX2 implementation for tm_vp8 16x16.

    18 mars 2017, par Mirage Abeysekara
    h264pred : added AVX2 implementation for tm_vp8 16x16.
    

    checkasm —bench results with 5000 runs

    pred16x16_tm_vp8_c : 302.8
    pred16x16_tm_vp8_mmx : 101.4
    pred16x16_tm_vp8_mmxext : 95.5
    pred16x16_tm_vp8_sse2 : 95.1
    pred16x16_tm_vp8_avx2 : 38.2

    Signed-off-by : Ronald S. Bultje <rsbultje@gmail.com>

    • [DH] libavcodec/x86/h264_intrapred.asm
    • [DH] libavcodec/x86/h264_intrapred_init.c
  • timelapse images into a movie, 500 at a time

    2 mars 2017, par molly78

    I am trying to make a script to turn a bunch of timelapse images into a movie, using ffmpeg.

    The latest problem is how to loop thru the images in, say, batches of 500.

    There could be 100 images from the day, or there could be 5000 images.

    The reason for breaking this apart is due to running out of memory.

    Afterwards I would need to cat them using MP4Box to join all together...

    I am entirely new to bash, but not entirely programming.

    What I think needs to happen is this

    1) read in the folders contents as the images may not be consecutively named

    2) send ffmpeg a list of 500 at a time to process (https://trac.ffmpeg.org/wiki/Concatenate)

    2b) while you’re looping thru this, set a counter to determine how many loops you’ve done

    3) use the number of loops to create the MP4Box cat command line to join them all at the end.

    the basic script that works if there’s only say 500 images is :

    #!/bin/bash

    dy=$(date '+%Y-%m-%d')

    ffmpeg -framerate 24 -s hd1080 -pattern_type glob -i "/mnt/cams/Camera1/$dy/*.jpg" -vcodec libx264 -pix_fmt yuv420p Cam1-"$dy".mp4

    MP4Box’s cat command looks like :

    MP4Box -cat Cam1-$dy7.mp4 -cat Cam1-$dy6.mp4 -cat Cam1-$dy5.mp4 -cat Cam1-$dy4.mp4 -cat Cam1-$dy3.mp4 -cat Cam1-$dy2.mp4 -cat Cam1-$dy1.mp4 "Cam1 - $dy1 to $dy7.mp4"

    Needless to say help is immensely appreciated for my project