Recherche avancée

Médias (91)

Autres articles (98)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • 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 (...)

Sur d’autres sites (9134)

  • Revision 3327 : Le modèle pour les images prenant en compte les largeurs et autres ...

    25 avril 2010, par kent1 — Log

    Le modèle pour les images prenant en compte les largeurs et autres hauteurs fixées au modèle

  • FFmpeg player backporting to Android 2.1 - one more problem

    22 avril 2024, par tretdm

    I looked for a lot of information about how to build and use FFmpeg in early versions of Android, looked at the source codes of players from 2011-2014 and was able to easily build FFmpeg 4.0.4 and 3.1.4 on the NDKv5 platform. I have highlighted the main things for this purpose :

    


      

    • <android></android>bitmap.h> and <android></android>native_window.h> before Android 2.2 (API Level 8) such a thing did not exist
    • &#xA;

    • this requires some effort to implement buffer management for A/V streams, since in practice, when playing video, the application silently crashed after a few seconds due to overflow (below code example in C++ and Java)
    • &#xA;

    • FFmpeg - imho, the only way to support a sufficient number of codecs that are not officially included in Android 2.1 and above
    • &#xA;

    &#xA;

    void decodeVideoFromPacket(JNIEnv *env, jobject instance,&#xA;                           jclass mplayer_class, AVPacket avpkt, &#xA;                           int total_frames, int length) {&#xA;    AVFrame     *pFrame = NULL&#xA;    AVFrame     *pFrameRGB = NULL;&#xA;    pFrame = avcodec_alloc_frame();&#xA;    pFrameRGB = avcodec_alloc_frame();&#xA;    int frame_size = avpicture_get_size(PIX_FMT_RGB32, gVideoCodecCtx->width, gVideoCodecCtx->height);&#xA;    unsigned char* buffer = (unsigned char*)av_malloc((size_t)frame_size * 3);&#xA;    if (!buffer) {&#xA;        av_free(pFrame);&#xA;        av_free(pFrameRGB);&#xA;        return;&#xA;    }&#xA;    jbyteArray buffer2;&#xA;    jmethodID renderVideoFrames = env->GetMethodID(mplayer_class, "renderVideoFrames", "([BI)V");&#xA;    int frameDecoded;&#xA;    avpicture_fill((AVPicture*) pFrame,&#xA;                   buffer,&#xA;                   gVideoCodecCtx->pix_fmt,&#xA;                   gVideoCodecCtx->width,&#xA;                   gVideoCodecCtx->height&#xA;                  );&#xA;&#xA;    if (avpkt.stream_index == gVideoStreamIndex) { // If video stream found&#xA;        int size = avpkt.size;&#xA;        total_frames&#x2B;&#x2B;;&#xA;        struct SwsContext *img_convert_ctx = NULL;&#xA;        avcodec_decode_video2(gVideoCodecCtx, pFrame, &amp;frameDecoded, &amp;avpkt);&#xA;        if (!frameDecoded || pFrame == NULL) {&#xA;            return;&#xA;        }&#xA;&#xA;        try {&#xA;            PixelFormat pxf;&#xA;            // RGB565 by default for Android Canvas in pre-Gingerbread devices.&#xA;            if(android::get_android_api_version(env) >= ANDROID_API_CODENAME_GINGERBREAD) {&#xA;                pxf = PIX_FMT_BGR32;&#xA;            } else {&#xA;                pxf = PIX_FMT_RGB565;&#xA;            }&#xA;&#xA;            int rgbBytes = avpicture_get_size(pxf, gVideoCodecCtx->width,&#xA;                                            gVideoCodecCtx->height);&#xA;&#xA;            // Converting YUV to RGB frame &amp; RGB frame to char* buffer &#xA;            &#xA;            buffer = convertYuv2Rgb(pxf, pFrame, rgbBytes); // result of av_image_copy_to_buffer()&#xA;&#xA;            if(buffer == NULL) {&#xA;                return;&#xA;            }&#xA;&#xA;            buffer2 = env->NewByteArray((jsize) rgbBytes);&#xA;            env->SetByteArrayRegion(buffer2, 0, (jsize) rgbBytes,&#xA;                                    (jbyte *) buffer);&#xA;            env->CallVoidMethod(instance, renderVideoFrames, buffer2, rgbBytes);&#xA;            env->DeleteLocalRef(buffer2);&#xA;            free(buffer);&#xA;        } catch (...) {&#xA;            if (debug_mode) {&#xA;                LOGE(10, "[ERROR] Render video frames failed");&#xA;                return;&#xA;            }&#xA;        }&#xA;    }&#xA;}&#xA;

    &#xA;

    private void renderVideoFrames(final byte[] buffer, final int length) {&#xA;        new Thread(new Runnable() {&#xA;            @Override&#xA;            public void run() {&#xA;                Canvas c;&#xA;                VideoTrack track = null;&#xA;                for (int tracks_index = 0; tracks_index &lt; tracks.size(); tracks_index&#x2B;&#x2B;) {&#xA;                    if (tracks.get(tracks_index) instanceof VideoTrack) {&#xA;                        track = (VideoTrack) tracks.get(tracks_index);&#xA;                    }&#xA;                }&#xA;                if (track != null) {&#xA;                    int frame_width = track.frame_size[0];&#xA;                    int frame_height = track.frame_size[1];&#xA;                    if (frame_width > 0 &amp;&amp; frame_height > 0) {&#xA;                        try {&#xA;                            // RGB_565  == 65K colours (16 bit)&#xA;                            // RGB_8888 == 16.7M colours (24 bit w/ alpha ch.)&#xA;                            int bpp = Build.VERSION.SDK_INT > 9 ? 16 : 24;&#xA;                            Bitmap.Config bmp_config =&#xA;                                    bpp == 24 ? Bitmap.Config.RGB_565 : Bitmap.Config.ARGB_8888;&#xA;                            Paint paint = new Paint();&#xA;                            if(buffer != null &amp;&amp; holder != null) {&#xA;                                holder.setType(SurfaceHolder.SURFACE_TYPE_NORMAL);&#xA;                                if((c = holder.lockCanvas()) == null) {&#xA;                                    Log.d(MPLAY_TAG, "Lock canvas failed");&#xA;                                    return;&#xA;                                }&#xA;                                ByteBuffer bbuf =&#xA;                                        ByteBuffer.allocateDirect(minVideoBufferSize);&#xA;                                bbuf.rewind();&#xA;                                for(int i = 0; i &lt; buffer.length; i&#x2B;&#x2B;) {&#xA;                                    bbuf.put(i, buffer[i]);&#xA;                                }&#xA;                                bbuf.rewind();&#xA;&#xA;                                // The approximate location where the application crashed.&#xA;                                Bitmap bmp = Bitmap.createBitmap(frame_width, frame_height, bmp_config);&#xA;                                bmp.copyPixelsFromBuffer(bbuf);&#xA;                                &#xA;                                float aspect_ratio = (float) frame_width / (float) frame_height;&#xA;                                int scaled_width = (int)(aspect_ratio * (c.getHeight()));&#xA;                                c.drawBitmap(bmp,&#xA;                                        null,&#xA;                                        new RectF(&#xA;                                                ((c.getWidth() - scaled_width) / 2), 0,&#xA;                                                ((c.getWidth() - scaled_width) / 2) &#x2B; scaled_width,&#xA;                                                c.getHeight()),&#xA;                                        null);&#xA;                                holder.unlockCanvasAndPost(c);&#xA;                                bmp.recycle();&#xA;                                bbuf.clear();&#xA;                            } else {&#xA;                                Log.d(MPLAY_TAG, "Video frame buffer is null");&#xA;                            }&#xA;                        } catch (Exception ex) {&#xA;                            ex.printStackTrace();&#xA;                        } catch (OutOfMemoryError oom) {&#xA;                            oom.printStackTrace();&#xA;                            stop();&#xA;                        }&#xA;                    }&#xA;                }&#xA;            }&#xA;        }).start();&#xA;    }&#xA;

    &#xA;

    Exception (tested in Android 4.1.2 emulator) :

    &#xA;

    E/dalvikvm-heap: Out of memory on a 1228812-byte allocation&#xA;I/dalvikvm: "Thread-495" prio=5 tid=21 RUNNABLE&#xA;   ................................................&#xA;     at android.graphics.Bitmap.nativeCreate(Native Method)&#xA;     at android.graphics.Bitmap.createBitmap(Bitmap.java:640)&#xA;     at android.graphics.Bitmap.createBitmap(Bitmap.java:620)&#xA;     at [app_package_name].MediaPlayer$5.run(MediaPlayer.java:406)&#xA;     at java.lang.Thread.run(Thread.java:856)&#xA;

    &#xA;

    For clarification : I first compiled FFmpeg 0.11.x on a virtual machine with Ubuntu 12.04 LTS from my written build script, looked for player examples suitable for Android below 2.2 (there is little information about them, unfortunately) and opened the file on the player and after showing the first frames it crashed into a stack or buffer overflow, on I put off developing the player for some time.

    &#xA;

    Is there anything ready-made that, as a rule, fits into one C++ file and takes into account all the nuances of backporting ? Thanks in advance.

    &#xA;

  • Libav linking error : undefined references

    22 février 2017, par Fedech

    Here’s my problem :

    • I built ffmpeg from source (version 1.2), the libav* libraries are in /usr/local/lib and they’re static
    • I’m compiling a ns3 (www.nsnam.org) module, so my only control over the linker is through the env variable LINKFLAGS
    • In the source the headers are in a "extern C" block, so it’s not the usual g++ name mangling
    • I set LINKFLAGS="-I/usr/local/include/libavformat -I/usr/local/include/libavcodec -I/usr/local/include/libavutil -L/usr/local/lib -lavformat -lavcodec -lavutil", and the linker can’t seem to find any of the libav* functions I call (I get a lot of "undefined reference" and then "collect2 : error : ld returned status 1"

    Can anyone help me ? Thanks...

    edit : here are a few of the undefined reference messages :

       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_guess_format'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_read_frame'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `avformat_write_header'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_interleaved_write_frame'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_find_stream_info'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_register_all'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_init_packet'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `avformat_alloc_context'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `av_dump_format'
       ./libns3.14.1-qoe-monitor-debug.so: undefined reference to `avio_close'

    edit2 : here is the message I get after "build failed" :

    -> task in 'scratch-simulator' failed (exit status 1):
    {task 53952272: cxxprogram scratch-simulator.cc.1.o -> scratch-simulator}
    ['/usr/bin/g++', '-I/usr/local/include/libavcodec', '-I/usr/local/include/libavformat/',
    '-I/usr/local/include/libavutil/', '-L/usr/local/lib', '-I/usr/local
    /include/libavcodec', '-I/usr/local/include/libavformat/', '-I/usr/local/include
    /libavutil/', '-L/usr/local/lib', '-pthread', '-pthread', '-Wl,-z,relro',
    'scratch/scratch-simulator.cc.1.o', '-o', '/home/fede/Thesis/ns-allinone-3.14.1
    /ns-3.14.1/build/scratch/scratch-simulator', '-Wl,-Bstatic', '-Wl,-Bdynamic',
    '-Wl,--no-as-needed', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.',
    '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.',
    '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.',
    '-L.', '-L.', '-L.', '-L.', '-L.', '-L/usr/lib', '-lns3.14.1-test-debug', '-lns3.14.1-
    csma-layout-debug', '-lns3.14.1-point-to-point-layout-debug', '-lns3.14.1-netanim-
    debug', '-lns3.14.1-lte-debug', '-lns3.14.1-spectrum-debug', '-lns3.14.1-antenna-
    debug', '-lns3.14.1-aodv-debug', '-lns3.14.1-dsdv-debug', '-lns3.14.1-dsr-debug',
    '-lns3.14.1-mesh-debug', '-lns3.14.1-olsr-debug', '-lns3.14.1-csma-debug', '-lns3.14.1-
    wimax-debug', '-lns3.14.1-applications-debug', '-lns3.14.1-virtual-net-device-debug',
    '-lns3.14.1-uan-debug', '-lns3.14.1-energy-debug', '-lns3.14.1-flow-monitor-debug',
    '-lns3.14.1-nix-vector-routing-debug', '-lns3.14.1-tap-bridge-debug', '-lns3.14.1-
    visualizer-debug', '-lns3.14.1-internet-debug', '-lns3.14.1-bridge-debug', '-lns3.14.1-
    point-to-point-debug', '-lns3.14.1-mpi-debug', '-lns3.14.1-wifi-debug', '-lns3.14.1-
    buildings-debug', '-lns3.14.1-propagation-debug', '-lns3.14.1-mobility-debug',
    '-lns3.14.1-config-store-debug', '-lns3.14.1-tools-debug', '-lns3.14.1-stats-debug',
    '-lns3.14.1-emu-debug', '-lns3.14.1-topology-read-debug', '-lns3.14.1-network-debug',
    '-lns3.14.1-qoe-monitor-debug', '-lns3.14.1-core-debug', '-lrt', '-lgsl',
    '-lgslcblas', '-lm', '-ldl', '-lgtk-x11-2.0', '-lgdk-x11-2.0', '-latk-1.0',
    '-lgio-2.0', '-lpangoft2-1.0', '-lpangocairo-1.0', '-lgdk_pixbuf-2.0', '-lcairo',
    '-lpango-1.0', '-lfreetype', '-lfontconfig', '-lgobject-2.0', '-lglib-2.0', '-lxml2',
    '-lpython2.7']