Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (47)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (7044)

  • How can I transcode a file with FFMPEG and stream the output file in the response of a Java servlet ?

    6 octobre 2012, par user1700589

    Basically, this is what I'm trying to do :
    1. User passes a URL as a GET parameter to my servlet.
    2. Servlet uses a ProcessBuilder to convert the media contained in that URL to a valid media format (ie : MP3).
    3. The servlet streams the output file being transcoded by FFMPEG back to the browser.

    1 and 2 work fine, but it is 3 I am having a problem with. The best I can do is create a FileInputStream to the output file being transcoded and send that as the response but it is not working. My guess is that it is because the file is being written as I'm trying to stream it.

    Is there anyway to intercept the output file argument in FFMPEG and read it into an InputStream ? In my mind it does not seem that it should be difficult to take input file A, transcode it to output file B, and then stream output file B back to the client, on the fly.

    ProcessBuilder pb = new ProcessBuilder("ffmpeg.exe", "-i", url, "file.mp3");
       Process p = pb.start();

       final InputStream inStream = p.getErrorStream();

       new Thread(new Runnable() {

       public void run() {
               InputStreamReader reader = new InputStreamReader(inStream);
               Scanner scan = new Scanner(reader);
               while (scan.hasNextLine()) {
                   System.out.println(scan.nextLine());
               }
           }
       }).start();

       ServletOutputStream stream = null;
       BufferedInputStream buf = null;
       try {

           stream = response.getOutputStream();
           File mp3 = new File(file.mp3");

           //set response headers
           response.setContentType("audio/mpeg");

           response.addHeader("Content-Disposition", "attachment; filename=file.mp3");

           response.setContentLength(-1);

           //response.setContentLength((int) mp3.length());

           FileInputStream input = new FileInputStream(mp3);
           buf = new BufferedInputStream(input);
           int readBytes = 0;
           //read from the file; write to the ServletOutputStream
           while ((readBytes = buf.read()) != -1) {
               stream.write(readBytes);
           }
       } catch (IOException ioe) {
           throw new ServletException(ioe.getMessage());
       } finally {
           if (stream != null) {
               stream.close();
           }
           if (buf != null) {
               buf.close();
           }
       }
  • FFMPEG with PHP does not execute ?

    15 septembre 2012, par Conor

    After reading about a gazillion questions here on SO related to FFMPEG with PHP I have gotten together a small snippet or what-not, but it does not seem to do anything - not even throw errors.

    My PHP is as follows :

    function get_video_thumbnail($file) {
       define('ALL_PLACE_WIDTH', 250);
       define('ALL_PLACE_HEIGHT', 200);

       $ffmpeg = "ffmpeg"; // where ffmpeg is
       $image_source_path = $file; // where the video is
       $image_cmd = " -r 1 -ss 00:00:10 -t 00:00:01 -s ".ALL_PLACE_WIDTH."x".ALL_PLACE_HEIGHT."   -f image2 "; // command
       $dest_image_path = "cdn/thumbnails"; // destination of thumbnail

       $str_command = $ffmpeg  ." -i " . $image_source_path . $image_cmd .$dest_image_path;    
       shell_exec($str_command);
    }

    in the root folder there's a folder "ffmpeg" in what there's "ffmpeg.exe", "ffplay.exe" and "pthreadGC2.dll". So I'm wondering, is there anything I'm missing ? I'm trying to generate a thumbnail from a video/mp4 file.

  • Creating video from image using FFMPEG

    27 août 2012, par yashprit

    I am creating video editing application using JavaScript, ffmpeg and java. Using FFMPEG i have created extract n frame of video, than using canvas.toDataUrl I am replacing new image with existing image frame rate and everything has taken care, but when I use these image to create video, FFMPEG never include newly created PNG image.

    code to save png image from HTML5 canvas

    Base64 decoder = new Base64();
       byte[] pic = decoder.decodeBase64(request.getParameter("pic"));
       String frameCount = request.getParameter("frame");
       InputStream in = new ByteArrayInputStream(pic);
       BufferedImage bImageFromConvert = ImageIO.read(in);
       String outdir = "output\\"+frameCount;
       //Random rand = new Random();
       File file = new File(outdir);
       if(file.isFile()){
           if(file.delete()){
               File writefile = new File(outdir);
               ImageIO.write(bImageFromConvert, "png", file);
           }
       }

    Code for creating image from video

    String filePath = "D:\\temp\\some.mpg";
       String outdir = "output";
       File file = new File(outdir);
       file.mkdirs();
       Map m = System.getenv();

       /*
        * String command[] =
        * {"D:\\ffmpeg-win32-static\\bin\\ffmpeg","-i",filePath
        * ,"-r 30","-f","image2",outdir,"\\user%03d.jpg"};
        *
        * ProcessBuilder pb = new ProcessBuilder(command); pb.start();
        */
       String commands = "D:\\ffmpeg-win32-static\\bin\\ffmpeg -i " + filePath
               + " -r 30  -f image2 " + outdir + "\\image%05d.png";
       Process p = Runtime.getRuntime().exec(commands);

    code for creating video from image

    String filePath = "output";
       File fileP = new File(filePath);
       String commands = "D:\\ffmpeg-win32-static\\bin\\ffmpeg -f image2 -i "
               + fileP + "\\image%5d.png " + fileP + "\\video.mp4";
       System.out.println(commands);
       Runtime.getRuntime().exec(commands);
       System.out.println(fileP.getAbsolutePath());