Recherche avancée

Médias (91)

Autres articles (104)

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

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (11910)

  • ffmpeg not converting via PHP script

    16 mars 2014, par user3331834

    Essentially, I have this code :

    if(in_array($ext,$audio)&&($ext!=="flac")){
       exec("ffmpeg -i -loglevel 'verbose' ".$fileName.".".$ext." ".$fileName.".flac null >/dev/null 2>/var/www/resources/ffmpegAudio.log &",$ffmpegOutput);
       print_r($ffmpegOutput);
       $editApproveStatus="Audio entry approved. File converted.";
    }

    Ultimately, my goal is to convert files and show a live progress of the conversion (or at least something that updates every few seconds), and running in the background, so that the same page can be used to convert further files.

    Now I'm already stuck, because the conversion just isn't working. I know that the preceding code should be fine, since it makes it all the way to this if statement above, and no errors are being throw up by the PHP. However, my log output shows :

    ffmpeg version 0.8.10-6:0.8.10-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
     built on Feb  6 2014 20:59:46 with gcc 4.8.1
    *** THIS PROGRAM IS DEPRECATED ***
    This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
    -loglevel: No such file or directory

    Which also leads me to another question : If ffmpeg is deprecated, and avconv is the way to do, can I still use the exec code in my PHP as is (replacing the ffmpeg bit with avconv) ? From what I've seen so far on the avconv page, it looks similar, but I can't be certain that it's exactly the same.

    So my two questions : Why isn't the file being converted, and is there any change in the syntax between avconv and ffmpeg ?

  • Problems of using MediaCodec.getOutputFormat() for an encoder in Android 4.1/4.2 devices

    13 mars 2014, par Mark

    I'm trying to use MediaCodec to encode frames (either by camera or decoder) into a video.
    When processing the encoder output by dequeueOutputBuffer(), I expect to receive the return index = MediaCodec.INFO_OUTPUT_FORMAT_CHANGED, so I can call getOutputFormat() to get the encoder output format as the input of the currently used ffmpeg muxer.

    I have tested some pad/phone devices with Android version 4.1 4.3. All of them have at least one hardware video AVC encoder and is used in the test. On the devices with version 4.3, the encoder gives MediaCodec.INFO_OUTPUT_FORMAT_CHANGED before writing the encoded data as expected, and the output format returned from getOutputFormat() can be used by the muxer correctly. On the devices with 4.2.2 or lower, the encoder never gives MediaCodec.INFO_OUTPUT_FORMAT_CHANGED while it can still output the encoded elementary stream, but the muxer cannot know the exact output format.

    I want to ask the following questions :

    1. Does the behavior of encoder (gives MediaCodec.INFO_OUTPUT_FORMAT_CHANGED or not before outputing encoded data) depend on the Android API Level or the chips on individual devices ?
    2. If the encoder writes data before MediaCodec.INFO_OUTPUT_FORMAT_CHANGED appears, is there any way to get the output format of the encoded data ?
    3. The encoder still output the codec config data (with flag MediaCodec.BUFFER_FLAG_CODEC_CONFIG) on the devices before the encoded data. It is mostly used to config a decoder, but can I derive the output format by the codec config data ?

    I have tried these solutions to get the output format but failed :

    • Call getOutputFormat() frequently during the whole encode process. However, all of them throw IllegalStateException without the appearance of MediaCodec.INFO_OUTPUT_FORMAT_CHANGED.
    • Use the initial MediaFormat use to config the encoder at the beginning, like the example :

      m_init_encode_format = MediaFormat.createVideoFormat(m_encode_video_mime, m_frame_width, m_frame_height);
      int encode_bit_rate = 3000000;
      int encode_frame_rate = 15;
      int encode_iframe_interval = 2;

      m_init_encode_format.setInteger(MediaFormat.KEY_COLOR_FORMAT, m_encode_color_format);
      m_init_encode_format.setInteger(MediaFormat.KEY_BIT_RATE, encode_bit_rate);
      m_init_encode_format.setInteger(MediaFormat.KEY_FRAME_RATE, encode_frame_rate);
      m_init_encode_format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, encode_iframe_interval);

      m_encoder = MediaCodec.createByCodecName(m_video_encoder_codec_info.getName());
      m_encoder.configure(m_init_encode_format, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);

      // Assume m_init_encode_format is the output format of the encoder

      However it fails since the output format of the encoder is still "changed" from the initial one.

    Please help me to realize the behavior of an encoder, and if there is any solution to query the output format if the required MediaCodec.INFO_OUTPUT_FORMAT_CHANGED is missing.


    By comparing the output format and the codec config data, the missing fields are csd-0, csd-1, and a "what" field with value = 1869968451.
    (I do not understand the "what" field. It seems to be a constant and is not required. Can anyone tell me about its meaning ?)

    If I parse the codec config data as the csd-1 field (last 8 bytes) and csd-0 field (remaining bytes), it seems that the muxer can work correctly and output a video playable on all of the testing devices.
    (But I want to ask : is this 8-byte assumption correct, or there is more reliable way to parse the data ?)

    However, I got another problem that If I decode the video by Android MediaCodec again, the BufferInfo.presentationTimeUs value get by dequeueOutputBuffer() is 0 for most of the decoded frames. Only the last few frames has correct time. The sample time get by MediaExtractor.getSampleTime() is correct and exactly the value I set to the encoder/muxer, but the decoded frame time is not. This issue only happen on 4.2.2 or lower device.

    It is strange that the frame time is incorrect but the video can be playback in correct speed on the device. (Most of the devices with 4.2.2 or lower I've tested has only 1 Video AVC decoder.) Do I need to set other fields that may affect the presentation time ?

  • How to use command of ffmpeg on android

    23 janvier 2015, par user2830969

    I download ffmpeg static from http://ffmpeg.gusari.org/static/ and I run command

    ./ffmpeg -i inputFile.mp4 -vf drawtext="fontsize=60:fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf:fontcolor=green:text=AAAA:x=(w-max_glyph_w)/2:y=h/2-ascent" outputFile.mp4

    it work fine on my desktop.
    I want to use this command to run in android. I copy ffmpeg file to my android app to run command but it not work.

    public ProcessRunnable create() {
           if (inputPath == null || outputPath == null) {
               throw new IllegalStateException("Need an input and output filepath!");
           }  

           final List<string> cmd = new LinkedList<string>();
            public ProcessRunnable create() {
           if (inputPath == null || outputPath == null) {
               throw new IllegalStateException("Need an input and output filepath!");
           }  

           final List<string> cmd = new LinkedList<string>();

           cmd.add(mFfmpegPath);
           cmd.add("-i");
           cmd.add(inputPath);
           cmd.add("-vf");
           cmd.add("drawtext=\"fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text=AAAA:x=(w-max_glyph_w)/2:y=h/2-a
           cmd.add(mFfmpegPath);
           cmd.add("-i");
           cmd.add(inputPath);
           cmd.add("-vf");
           cmd.add("drawtext=\"fontsize=60:fontfile=/system/fonts/DroidSans.ttf:fontcolor=green:text=AAAA:x=(w-max_glyph_w)/2:y=h/2-ascent\"");
           cmd.add(outputPath);
           Log.w("Command", cmd.toString());
           final ProcessBuilder pb = new ProcessBuilder(cmd);
           return new ProcessRunnable(pb);
       }
    </string></string></string></string>

    please tell me know "How can I do that ?" thanks so much