Recherche avancée

Médias (0)

Mot : - Tags -/xmp

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (38)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (4374)

  • video overwriting using ffmpeg - I want to Add video rotation code and rewrite the existing file..How can i do that ?

    27 octobre 2013, par Lakshmi Priya.K

    I want to rotate the .mov file which is in portrait mode by 90 degrees, for that i used the following code..
    It works but, it results in loss of video frames...

    My code is,

    public void encode(File source, File target, EncodingAttributes attributes,
           EncoderProgressListener listener, Integer i) throws IllegalArgumentException,
           InputFormatException, EncoderException {        
       String formatAttribute = attributes.getFormat();

       Float offsetAttribute = attributes.getOffset();

       Float durationAttribute = attributes.getDuration();

       QualityScale qualityScale = attributes.getQualityScale();

       AudioAttributes audioAttributes = attributes.getAudioAttributes();

       VideoAttributes videoAttributes = attributes.getVideoAttributes();

       if (audioAttributes == null && videoAttributes == null) {
           throw new IllegalArgumentException(
                   "Both audio and video attributes are null");
       }
       target = target.getAbsoluteFile();
       target.getParentFile().mkdirs();        
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       if (offsetAttribute != null) {
           ffmpeg.addArgument("-ss");
           ffmpeg.addArgument(String.valueOf(offsetAttribute.floatValue()));
       }
       ffmpeg.addArgument("-i");
       ffmpeg.addArgument(source.getAbsolutePath());
       if (durationAttribute != null) {
           ffmpeg.addArgument("-t");
           ffmpeg.addArgument(String.valueOf(durationAttribute.floatValue()));
       }
       if (qualityScale != null) {
           ffmpeg.addArgument("-qscale:"+qualityScale.getQualityStreamSpecifier());
           ffmpeg.addArgument(String.valueOf(qualityScale.getQualityValue()));
       }
       if (videoAttributes == null) {
           ffmpeg.addArgument("-vn");
       } else {
           String codec = videoAttributes.getCodec();
           if (codec != null) {
               ffmpeg.addArgument("-vcodec");
               ffmpeg.addArgument(codec);
           }
           String tag = videoAttributes.getTag();
           if (tag != null) {
               ffmpeg.addArgument("-vtag");
               ffmpeg.addArgument(tag);
           }
           Integer bitRate = videoAttributes.getBitRate();
           if (bitRate != null) {
               ffmpeg.addArgument("-b");
               ffmpeg.addArgument(String.valueOf(bitRate.intValue()));
           }
           Integer frameRate = videoAttributes.getFrameRate();
           if (frameRate != null) {
               ffmpeg.addArgument("-r");
               ffmpeg.addArgument(String.valueOf(frameRate.intValue()));
           }
           VideoSize size = videoAttributes.getSize();
           if (size != null) {
               ffmpeg.addArgument("-s");
               ffmpeg.addArgument(String.valueOf(size.getWidth()) + "x"
                       + String.valueOf(size.getHeight()));
           }
           FilterGraph filterGraph = videoAttributes.getFilterGraph();
           if (filterGraph != null) {
               ffmpeg.addArgument("-vf");
               if(videoAttributes.getRotate() != null && videoAttributes.getRotate() == 90){                  
                   ffmpeg.addArgument("transpose=1");
               }else if(videoAttributes.getRotate() != null && videoAttributes.getRotate() == 180){
                   ffmpeg.addArgument("vflip,hflip");
               }              
               else {
                   if (filterGraph.isUseExpression()) {
                       ffmpeg.addArgument(filterGraph.getFilterGraphExpression());
                   }
               }          

           }

       }
       if (audioAttributes == null) {
           ffmpeg.addArgument("-an");
       } else {
           String codec = audioAttributes.getCodec();
           if (codec != null) {
               ffmpeg.addArgument("-acodec");
               ffmpeg.addArgument(codec);
           }
           Integer bitRate = audioAttributes.getBitRate();
           if (bitRate != null) {
               ffmpeg.addArgument("-ab");
               ffmpeg.addArgument(String.valueOf(bitRate.intValue()));
           }
           Integer channels = audioAttributes.getChannels();
           if (channels != null) {
               ffmpeg.addArgument("-ac");
               ffmpeg.addArgument(String.valueOf(channels.intValue()));
           }
           Integer samplingRate = audioAttributes.getSamplingRate();
           if (samplingRate != null) {
               ffmpeg.addArgument("-ar");
               ffmpeg.addArgument(String.valueOf(samplingRate.intValue()));
           }
           Integer volume = audioAttributes.getVolume();
           if (volume != null) {
               ffmpeg.addArgument("-vol");
               ffmpeg.addArgument(String.valueOf(volume.intValue()));
           }
       }
       ffmpeg.addArgument("-f");
       ffmpeg.addArgument(formatAttribute);
       ffmpeg.addArgument("-y");
       ffmpeg.addArgument(target.getAbsolutePath());      
       try {
           ffmpeg.execute();
       } catch (IOException e) {
           throw new EncoderException(e);
       }
       try {
           String lastWarning = null;
           long duration;
           long progress = 0;
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getErrorStream()));
           MultimediaInfo info = parseMultimediaInfo(source, reader);
           if (durationAttribute != null) {
               duration = (long) Math
                       .round((durationAttribute.floatValue() * 1000L));
           } else {
               duration = info.getDuration();
               if (offsetAttribute != null) {
                   duration -= (long) Math
                           .round((offsetAttribute.floatValue() * 1000L));
               }
           }
           if (listener != null) {
               listener.sourceInfo(info);
           }
           int step = 0;
           String line;
           while ((line = reader.readLine()) != null) {
               System.out.println("line::::"+line);

               if (step == 0) {
                   if (line.startsWith("WARNING: ")) {
                       if (listener != null) {
                           listener.message(line);
                       }
                   } else if (!line.startsWith("Output #0")) {
                       //throw new EncoderException(line);
                   } else {
                       step++;
                   }
               } else if (step == 1) {
                   if (!line.startsWith("  ")) {
                       step++;
                   } else {
                       System.out.println("line>>>>>>"+line);
                       Hashtable table1 = new Hashtable();
                       Matcher m = ROTATE_INFO_PATTERN.matcher(line);
                       while (m.find()) {
                           if (table1 == null) {
                               table1 = new Hashtable();
                           }
                           String key = m.group(1);
                           String value = m.group(2);
                           table1.put(key, value);
                       }
                       System.out.println("Table values"+table1.get("rotate"));                
                       if(table1.get("rotate") != null){
                           Object videoRotateValue = table1.get("rotate");
                           int rotate = Integer.valueOf(videoRotateValue.toString());
                           switch(rotate){
                           case 90:
                                   videoAttributes.setRotate(rotate);
                                   if(i == 0){
                                       i++;                                        
                                       encode(source, target, attributes, null, i);                                        
                                   }

                           break;
                           case 180:                      
                               videoAttributes.setRotate(rotate);
                               if(i == 0){
                                   i++;
                                   encode(source, target, attributes, null, i);                                        
                               }

                       break;
                           case 270: System.out.println("case 3 :: "+videoRotateValue);
                           break;
                           }
                       }
                   }
               }
               if (step == 2) {
                   if (!line.startsWith("Stream mapping:")) {
                       throw new EncoderException(line);
                   } else {
                       step++;
                   }
               } else if (step == 3) {
                   if (!line.startsWith("  ")) {
                       step++;
                   }
               }
               if (step == 4) {
                   line = line.trim();
                   if (line.length() > 0) {
                       Hashtable table = parseProgressInfoLine(line);
                       if (table == null) {
                           if (listener != null) {
                               listener.message(line);
                           }
                           lastWarning = line;
                       } else {
                           if (listener != null) {
                               String time = (String) table.get("time");
                               if (time != null) {
                                   int dot = time.indexOf('.');
                                   if (dot > 0 && dot == time.length() - 2
                                           && duration > 0) {
                                       String p1 = time.substring(0, dot);
                                       String p2 = time.substring(dot + 1);
                                       try {
                                           long i1 = Long.parseLong(p1);
                                           long i2 = Long.parseLong(p2);
                                           progress = (i1 * 1000L)
                                                   + (i2 * 100L);
                                           int perm = (int) Math
                                                   .round((double) (progress * 1000L)
                                                           / (double) duration);
                                           if (perm > 1000) {
                                               perm = 1000;
                                           }
                                           listener.progress(perm);
                                       } catch (NumberFormatException e) {
                                           ;
                                       }
                                   }
                               }
                           }

                           lastWarning = null;
                       }
                   }
               }
           }
           if (lastWarning != null) {
               if (!SUCCESS_PATTERN.matcher(lastWarning).matches()) {
                   throw new EncoderException(lastWarning);
               }
           }
       } catch (IOException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       } finally {
           ffmpeg.destroy();
       }
    }

    Please advise, how to achieve video rotation without any video Frame loss

    Thanks In Advance

    Lakshmi Priya . K

  • FFmpeg How to write video to a file

    9 décembre 2014, par NoviceAndNovice

    What i want is

    1. Get video packet from stream source
    2. Decode it
    3. And write  that decoded data as video file(avi, mpeg etc)

    I can able to get video Packets from a file (as AVPacket) and also can decode and save as an image.(raw)( FFmpeg tutorials show how to do it).
    But i can not ( do not know ) write that video data to a file(other) which can be played by media players(such as VLC).

    Best Wishes

    Ps : Real code samples will be great if possible...

    Now i make test with av_interleaved_write but i got strange error "non monotone timestamps" ( i have no control over pts values of media source )

    Some Extra Info

    In FFmpeg I have to

    1. Read media packets from media source ( it may be real file(.avi,mov) or even rtsp server).
    2. Then write those media packets to a real file (physical .avi, .mov etc file)

    I need reader and writer. I can read the media source file ( even encode packets according to given format). But i can not write to file...(which any player can play)

    And some pseudoCode

    File myFile("MyTestFile.avi");

    while ( source ->hasVideoPackets)
    {
        packet = source->GetNextVideoPacket();
        Frame decodedFrame = Decode(packet);
        VideoPacket encodedPacket = Encode( decodedFrame);
        myFile.WriteFile(encodedPacket);
    }

    Or Just write the original file without encode decode

        File myFile("MyTestFile.avi");

        while ( source ->hasVideoPackets)
        {
            packet = source->GetNextVideoPacket();
            myFile.WriteFile(packet);
        }

    Then

    I can able to open MyTest.avi file with a player.
  • Weird and unpredictable crash when using libx264 cross-compiled with MinGW

    2 mars 2012, par Daniel

    I'm working on a C++ project using Visual Studio 2010 on Windows. I'm linking dynamically against x264 which I built myself as a shared library using MinGW following the guide at

    http://www.ayobamiadewole.com/Blog/Others/x264compilation.aspx

    The strange thing is that my x264 code is working perfectly sometimes. Then when I change some line of code (or even change the comments in the file !) and recompile everything crashes on the line

    encoder_ = x264_encoder_open(&param);

    With the message

    Access violation reading location 0x00000000

    I'm not doing anything funky at all so it's probably not my code that is wrong but I guess there is something going wrong with the linking or maybe something is wrong with how I compiled x264.

    The full initialization code :

    x264_param_t param = { 0 };
    if (x264_param_default_preset(&param, "ultrafast", "zerolatency") < 0) {
     throw KStreamerException("x264_param_default_preset failed");
    }

    param.i_threads = 1;
    param.i_width = 640;
    param.i_height = 480;
    param.i_fps_num = 10;
    param.i_fps_den = 1;

    encoder_ = x264_encoder_open(&param); // <-----
    if (encoder_ == 0) {
     throw KStreamerException("x264_encoder_open failed");
    }

    x264_picture_alloc(&pic_, X264_CSP_I420, 640, 480);

    Edit : It turns out that it always works in Release mode and when using superfast instead of ultrafast it also works in Debug mode 100%. Could it be that the ultrafast mode is doing some crazy optimizations that the debugger doesn't like ?