Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (28)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

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

Sur d’autres sites (5385)

  • ImageIO.write() freezes after 540 iterations

    14 octobre 2019, par the4naves

    I’m currently trying to write a simple audio visualizer (Non realtime), but am running into a very weird problem.

    After about 515-545 iterations of ImageIO.write(), the program freezes ; no exceptions, the program doesn’t crash, just, nothing.

    Before you read the code below, here’s a quick rundown of it to make it a bit easier to understand :
    1. Load data from program arguments.
    2. Start ffmpeg with its input set to stdin.
    3. In a loop ; Continually render an image, then send it to ffmpeg with ImageIO.write().

    Other info :
    I’ve verified ImageIO.write() IS actually the problem by placing a print before and after the try/catch statement.
    My first thought was a memory leak, but that doesn’t seem to be the case, at least according to Runtime.getRuntime().freeMemory() ;
    The iterations needed to freeze the program is inconsistent, though its always been in the range of 515-540.
    Rendering a video with less frames works flawlessly.
    My previous solution was to write all images to a folder, then run ffmpeg on them all at once. This worked fine on any number of frames, but used upwards of a gigabyte of storage for a fairly small test video, unacceptable for the small program I’m trying to create.

    As a final note, I realize the code probably has a ton of optimization/general problems, I haven’t had the time to try and get it to work well, as it isn’t even fully working yet.
    With that said, if you see any obvious problems, feel free to include them in your answer if you have the time, it’ll certainly save me some.

    Thanks

    public class Run {

       public static BufferedImage render = new BufferedImage(1920, 1080, BufferedImage.TYPE_INT_RGB);

       public static Graphics buffer = render.getGraphics();

       public static int frame = 0;

       public static double[] bins = new double[3200];
       public static double[] previousBins = new double[3200];

       public static File audio;

       public static BufferedImage background;

       public static OutputStream output;

       public static void main(String[] args) {
           try {
               String command = "cd /Users/admin/Desktop/render ; ffmpeg -r 60 -blocksize 150000 -i pipe:0 -i " + args[1].replaceAll(" ", "\\\\ ") + " final.mp4";

               System.out.println(command);

               ProcessBuilder processBuilder = new ProcessBuilder("bash", "-c", command);

               Process process = processBuilder.start();

               output = process.getOutputStream();
           } catch (IOException e) {
               e.printStackTrace();
           }

           try {
               background = ImageIO.read(new File(args[0]));
           } catch (IOException e) {
               System.out.println("File not found");
           }

           audio = new File(args[1]);

           ByteArrayOutputStream out = new ByteArrayOutputStream();
           BufferedInputStream in = null;

           try { in = new BufferedInputStream(new FileInputStream(audio));
           } catch (FileNotFoundException e1) {
               e1.printStackTrace();
           }

           try {
               out.flush();

               int read;

               byte[] buff = new byte[3200];

               while ((read = in .read(buff)) > 0) {
                   out.write(buff, 0, read);
               }
           } catch (IOException e1) {
               e1.printStackTrace();
           }

           byte[] audioBytes = out.toByteArray();

           System.out.println("Calculating length");

           int frames = 600;

           System.out.println("Rendering images");

           int[] data = new int[3200];

           int index = 0;

           while (frame < frames) {
               for (int i = 0; i < 3200; i++) {
                   data[i] = (short)(audioBytes[index + 2] << 16 | audioBytes[index + 1] << 8 | audioBytes[index] & 0xff);

                   index += 3;
               }

               index -= 4800;

               fourier(data, bins);

               renderImage();

               try {
                   ImageIO.write(render, "jpg", output);
               } catch (IOException e) {
                   e.printStackTrace();
               }

               frame++;

               if (frame % 20 == 0) {
                   System.out.println(frame + "/" + frames + " frames completed");
               }
           }

           System.out.println("Render completed");

           System.out.println("Optimizing file size");

           System.out.println("Optimization complete");

           System.out.println("Program complete");

           System.exit(0);
       }

       public static void renderImage() {
           buffer.drawImage(background, 0, 0, null);

           for (int i = 0; i < 110; i++) {
               int height = (int)((bins[i] + previousBins[i]) / Short.MAX_VALUE);

               buffer.fillRect(15 * i + 20, 800 - height, 10, (int)(height * 1.2));
           }

           System.arraycopy(bins, 0, previousBins, 0, 3200);
       }

       public static void fourier(int[] inReal, double[] out) {
           for (int k = 0; k < inReal.length; k++) {
               double real = 0.0;
               double imaginary = 0.0;

               for (int t = 0; t < inReal.length; t++) {
                   real += inReal[t] * Math.cos(2 * Math.PI * t * k / inReal.length);
                   imaginary -= inReal[t] * Math.sin(2 * Math.PI * t * k / inReal.length);
               }

               out[k] = Math.sqrt(Math.pow(real, 2) + Math.pow(imaginary, 2));
           }
       }

    }
  • ffmpeg /dev/video1 : No space left on device

    4 avril 2017, par chaitanya kiran

    While converting and redirecting USB camera stream to a multicast ip I’m facing below error.

    ffmpeg -f v4l2 -i /dev/video1 -s 720x480 -pix_fmt yuv420p -c:v mpeg2video -aspect 4:3 -r 30 -g 15 -ar 0 -streamid 0:48 -bf 2 -b:v 100k -bufsize 400k -maxrate 3825k -f rtp_mpegts rtp ://239.0.2.2:5001

    ffmpeg version 3.2.4-static http://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2017 the FFmpeg developers
    built with gcc 5.4.1 (Debian 5.4.1-5) 20170205
    configuration : —enable-gpl —enable-version3 —enable-static —disable-debug —disable-ffplay —disable-indev=sndio —disable-outdev=sndio —cc=gcc-5 —enable-fontconfig —enable-frei0r —enable-gnutls —enable-gray —enable-libass —enable-libfreetype —enable-libfribidi —enable-libmp3lame —enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-librtmp —enable-libsoxr —enable-libspeex —enable-libtheora —enable-libvidstab —enable-libvo-amrwbenc —enable-libvorbis —enable-libvpx —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxvid —enable-libzimg
    libavutil 55. 34.101 / 55. 34.101
    libavcodec 57. 64.101 / 57. 64.101
    libavformat 57. 56.101 / 57. 56.101
    libavdevice 57. 1.100 / 57. 1.100
    libavfilter 6. 65.100 / 6. 65.100
    libswscale 4. 2.100 / 4. 2.100
    libswresample 2. 3.100 / 2. 3.100
    libpostproc 54. 1.100 / 54. 1.100

    [video4linux2,v4l2 @ 0xb982f80] ioctl(VIDIOC_STREAMON) : No space left on device
    /dev/video1 : No space left on device

    Below are top and free -m command outputs

    top

    top - 20:10:13 up 16 min, 4 users, load average : 0.49, 0.37, 0.28
    Tasks : 257 total, 1 running, 256 sleeping, 0 stopped, 0 zombie
    %Cpu(s) : 3.4 us, 0.2 sy, 0.0 ni, 95.9 id, 0.5 wa, 0.0 hi, 0.0 si, 0.0 st
    KiB Mem : 13457292 total, 12299768 free, 650672 used, 506852 buff/cache
    KiB Swap : 3670012 total, 3670012 free, 0 used. 12710776 avail Mem

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    4095 root 20 0 333376 153296 138660 S 25.9 1.1 1:09.41 ffmpeg
    1551 root 20 0 84804 40076 17756 S 0.7 0.3 0:24.00 Xorg.bin
    2574 user 20 0 66900 27436 21268 S 0.7 0.2 0:11.30 gnome-terminal-
    4373 root 20 0 7800 3852 3196 R 0.7 0.0 0:00.03 top
    610 root 20 0 0 0 0 S 0.3 0.0 0:00.03 kworker/4:2
    3762 user 20 0 816928 217120 75100 S 0.3 1.6 0:56.34 firefox
    4240 root 20 0 0 0 0 S 0.3 0.0 0:02.24 kworker/0:2
    1 root 20 0 27464 7508 5044 S 0.0 0.1 0:01.95 systemd
    2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
    3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
    5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
    7 root 20 0 0 0 0 S 0.0 0.0 0:01.29 rcu_sched

    free -m

             total        used        free      shared  buff/cache   available

    Mem : 13141 621 12025 2 495 12426
    Swap : 3583 0 3583

    cat /proc/meminfo |grep -i vmalloc

    VmallocTotal : 524288 kB
    VmallocUsed : 204736 kB
    VmallocChunk : 316560 kB

    P.S: : There is already an instance of ffmpeg running on the machine on /dev/video0.

    Any help in resolving issue would be greatly appreciated

  • Recording a website with PhantomJS and FFMpeg ?

    18 novembre 2016, par Rjaibi Mejdi

    I want to record a website using Phantomjs and use pipeline and FFMpeg to create a live video (Server or Stream URL)

    runner.js code :

    var page = require('webpage').create();
    page.viewportSize = { width: 640, height: 480 };

    page.open('http://www.goodboydigital.com/pixijs/examples/12-2/', function () {
     setInterval(function() {
       page.render('/dev/stdout', { format: "png" });
     }, 25);
    });

    Commande Line :

    $ phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 24 -i - -c:v libx264 -pix_fmt yuv420p -threads 10 -movflags +faststart -b:v 3500k -bufsize 1024k -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/1734882043502131?ds=1&s_l=1&a=AaYJ7cQfH719X5Kl"

    The problem is that I get this error when I want to start a live stream in facebook :
    - In the preview mode is working
    In the preview mode is working
    - When I start the Live I got this message
    When I start the Live I got this message