Recherche avancée

Médias (91)

Autres articles (72)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (7705)

  • While using skvideo.io.FFmpegReader and skvideo.io.FFmpegWriter for video throughput the input video and output video length differ

    28 juin 2024, par Kaesebrotus Anonymous

    I have an h264 encoded mp4 video of about 27.5 minutes length and I am trying to create a copy of the video which excludes the first 5 frames. I am using scikit-video and ffmpeg in python for this purpose. I do not have a GPU, so I am using libx264 codec for the output video.

    


    It generally works and the output video excludes the first 5 frames. Somehow, the output video results in a length of about 22 minutes. When visually checking the videos, the shorter video does seem slightly faster and I can identify the same frames at different timestamps. In windows explorer, when clicking properties and then details, both videos' frame rates show as 20.00 fps.

    


    So, my goal is to have both videos of the same length, except for the loss of the first 5 frames which should result in a duration difference of 0.25 seconds, and use the same (almost same) codec and not lose quality.

    


    Can anyone explain why this apparent loss of frames is happening ?

    


    Thank you for your interest in helping me, please find the details below.

    


    Here is a minimal example of what I have done.

    


    framerate = str(20)
reader = skvideo.io.FFmpegReader(inputvideo.mp4, inputdict={'-r': framerate})
writer = skvideo.io.FFmpegWriter(outputvideo.mp4, outputdict={'-vcodec': 'libx264', '-r': framerate})

for idx,frame in enumerate(reader.nextFrame()):
    if idx < 5:
        continue
    writer.writeFrame(frame)

reader.close()
writer.close()


    


    When I read the output video again using FFmpegReader and check the .probeInfo, I can see that the output video has less frames in total. I have also managed to replicate the same problem for shorter videos (now not excluding the first 5 frames, but only throughputting a video), e.g. 10 seconds input turns to 8 seconds output with less frames. I have also tried playing around with further parameters of the outputdict, e.g. -pix_fmt, -b. I have tried to set -time_base in the output dict to the same value as in the inputdict, but that did not seem to have the desired effect. I am not sure if the name of the parameter is right.

    


    For additional info, I am providing the .probeInfo of the input video, of which I used 10 seconds, and the .probeInfo of the 8 second output video it produced.

    


    **input video** .probeInfo:
input dict

{'video': OrderedDict([('@index', '0'),
              ('@codec_name', 'h264'),
              ('@codec_long_name',
               'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10'),
              ('@profile', 'High 4:4:4 Predictive'),
              ('@codec_type', 'video'),
              ('@codec_tag_string', 'avc1'),
              ('@codec_tag', '0x31637661'),
              ('@width', '4096'),
              ('@height', '3000'),
              ('@coded_width', '4096'),
              ('@coded_height', '3000'),
              ('@closed_captions', '0'),
              ('@film_grain', '0'),
              ('@has_b_frames', '0'),
              ('@sample_aspect_ratio', '1:1'),
              ('@display_aspect_ratio', '512:375'),
              ('@pix_fmt', 'yuv420p'),
              ('@level', '60'),
              ('@chroma_location', 'left'),
              ('@field_order', 'progressive'),
              ('@refs', '1'),
              ('@is_avc', 'true'),
              ('@nal_length_size', '4'),
              ('@id', '0x1'),
              ('@r_frame_rate', '20/1'),
              ('@avg_frame_rate', '20/1'),
              ('@time_base', '1/1200000'),
              ('@start_pts', '0'),
              ('@start_time', '0.000000'),
              ('@duration_ts', '1984740000'),
              ('@duration', '1653.950000'),
              ('@bit_rate', '3788971'),
              ('@bits_per_raw_sample', '8'),
              ('@nb_frames', '33079'),
              ('@extradata_size', '43'),
              ('disposition',
               OrderedDict([('@default', '1'),
                            ('@dub', '0'),
                            ('@original', '0'),
                            ('@comment', '0'),
                            ('@lyrics', '0'),
                            ('@karaoke', '0'),
                            ('@forced', '0'),
                            ('@hearing_impaired', '0'),
                            ('@visual_impaired', '0'),
                            ('@clean_effects', '0'),
                            ('@attached_pic', '0'),
                            ('@timed_thumbnails', '0'),
                            ('@non_diegetic', '0'),
                            ('@captions', '0'),
                            ('@descriptions', '0'),
                            ('@metadata', '0'),
                            ('@dependent', '0'),
                            ('@still_image', '0')])),
              ('tags',
               OrderedDict([('tag',
                             [OrderedDict([('@key', 'language'),
                                           ('@value', 'und')]),
                              OrderedDict([('@key', 'handler_name'),
                                           ('@value', 'VideoHandler')]),
                              OrderedDict([('@key', 'vendor_id'),
                                           ('@value', '[0][0][0][0]')])])]))])}

**output video** .probeInfo:
{'video': OrderedDict([('@index', '0'),
              ('@codec_name', 'h264'),
              ('@codec_long_name',
               'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10'),
              ('@profile', 'High'),
              ('@codec_type', 'video'),
              ('@codec_tag_string', 'avc1'),
              ('@codec_tag', '0x31637661'),
              ('@width', '4096'),
              ('@height', '3000'),
              ('@coded_width', '4096'),
              ('@coded_height', '3000'),
              ('@closed_captions', '0'),
              ('@film_grain', '0'),
              ('@has_b_frames', '2'),
              ('@pix_fmt', 'yuv420p'),
              ('@level', '60'),
              ('@chroma_location', 'left'),
              ('@field_order', 'progressive'),
              ('@refs', '1'),
              ('@is_avc', 'true'),
              ('@nal_length_size', '4'),
              ('@id', '0x1'),
              ('@r_frame_rate', '20/1'),
              ('@avg_frame_rate', '20/1'),
              ('@time_base', '1/10240'),
              ('@start_pts', '0'),
              ('@start_time', '0.000000'),
              ('@duration_ts', '82944'),
              ('@duration', '8.100000'),
              ('@bit_rate', '3444755'),
              ('@bits_per_raw_sample', '8'),
              ('@nb_frames', '162'),
              ('@extradata_size', '47'),
              ('disposition',
               OrderedDict([('@default', '1'),
                            ('@dub', '0'),
                            ('@original', '0'),
                            ('@comment', '0'),
                            ('@lyrics', '0'),
                            ('@karaoke', '0'),
                            ('@forced', '0'),
                            ('@hearing_impaired', '0'),
                            ('@visual_impaired', '0'),
                            ('@clean_effects', '0'),
                            ('@attached_pic', '0'),
                            ('@timed_thumbnails', '0'),
                            ('@non_diegetic', '0'),
                            ('@captions', '0'),
                            ('@descriptions', '0'),
                            ('@metadata', '0'),
                            ('@dependent', '0'),
                            ('@still_image', '0')])),
              ('tags',
               OrderedDict([('tag',
                             [OrderedDict([('@key', 'language'),
                                           ('@value', 'und')]),
                              OrderedDict([('@key', 'handler_name'),
                                           ('@value', 'VideoHandler')]),
                              OrderedDict([('@key', 'vendor_id'),
                                           ('@value', '[0][0][0][0]')]),
                              OrderedDict([('@key', 'encoder'),
                                           ('@value',
                                            'Lavc61.8.100 libx264')])])]))])}


    


    I used 10 seconds by adding this to the bottom of the loop shown above :

    


        if idx >= 200:
        break


    


  • 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);
       };
    }
  • Multicast not receiving in Ubuntu server [on hold]

    21 mars 2017, par Manmathan

    I am new to linux and multicast.
    Trying to receive multicast packets in ubuntu server. Added the route command [route add -net 224.0.0.0 netmask 240.0.0.0 eno1]. eno1 is also configured for multicast and promisc.
    Using tcpdump or tshark, found the igmp request going to eno1, but no multicast streams are coming in.
    The multicast are received succesfully only when the default gateway is set to eno1 card. However I need the other nic card eno2 to be default gateway.

    The following page has some information :
    UDP socket (multicast) not receiving data (Ubuntu)

    I am not clear about how to accomplish :

    1. to disable the reverse packet filter : echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter + The same for ethX.
      1. Bind the socket to the to-be-joined group’s IP (otherwise any subsequent socket would get all packets from all groups I joined on that particular port).
      2. Set the interface member of the ip_mreq struct to the IP of the adapter we’re receiving on.

    Please help.
    (ffmpeg is the application).