Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (44)

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

  • MediaSPIP Player : les contrôles

    26 mai 2010, par

    Les contrôles à la souris du lecteur
    En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (7248)

  • Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    20 mars 2014, par user3441169

    I need to convert a video file from .flv to .mp4.

    When ever run the my application getting the exception.

    Please find the below my ffmpeg command along with error.

    Command :

    /usr/bin/avconv -y -i /home/veera/Desktop/videos/Prasad.Daily-2014-03-19.flv -vcodec libx264 -r 30000/1001 -b:v 250k -bt 250k -s 1280x720 -acodec libvo_aacenc -ar 32000 -ab 48k -crf 22 -profile:v baseline -level 1 -movflags +faststart -preset veryfast /home/veera/Desktop/videos/resized.mp4

    Output :

    ERROR>Stream mapping :

    ERROR> Stream #0:0 -> #0:0 (h264 -> libx264)

    ERROR> Stream #0:1 -> #0:1 (aac -> libvo_aacenc)

    ERROR>Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    ExitValue : 1

  • AppRTC : Google’s WebRTC test app and its parameters

    23 juillet 2014, par silvia

    If you’ve been interested in WebRTC and haven’t lived under a rock, you will know about Google’s open source testing application for WebRTC : AppRTC.

    When you go to the site, a new video conferencing room is automatically created for you and you can share the provided URL with somebody else and thus connect (make sure you’re using Google Chrome, Opera or Mozilla Firefox).

    We’ve been using this application forever to check whether any issues with our own WebRTC applications are due to network connectivity issues, firewall issues, or browser bugs, in which case AppRTC breaks down, too. Otherwise we’re pretty sure to have to dig deeper into our own code.

    Now, AppRTC creates a pretty poor quality video conference, because the browsers use a 640×480 resolution by default. However, there are many query parameters that can be added to the AppRTC URL through which the connection can be manipulated.

    Here are my favourite parameters :

    • hd=true : turns on high definition, ie. minWidth=1280,minHeight=720
    • stereo=true : turns on stereo audio
    • debug=loopback : connect to yourself (great to check your own firewalls)
    • tt=60 : by default, the channel is closed after 30min – this gives you 60 (max 1440)

    For example, here’s how a stereo, HD loopback test would look like : https://apprtc.appspot.com/?r=82313387&hd=true&stereo=true&debug=loopback .

    This is not the limit of the available parameter, though. Here are some others that you may find interesting for some more in-depth geekery :

    • ss=[stunserver] : in case you want to test a different STUN server to the default Google ones
    • ts=[turnserver] : in case you want to test a different TURN server to the default Google ones
    • tp=[password] : password for the TURN server
    • audio=true&video=false : audio-only call
    • audio=false : video-only call
    • audio=googEchoCancellation=false,googAutoGainControl=true : disable echo cancellation and enable gain control
    • audio=googNoiseReduction=true : enable noise reduction (more Google-specific parameters)
    • asc=ISAC/16000 : preferred audio send codec is ISAC at 16kHz (use on Android)
    • arc=opus/48000 : preferred audio receive codec is opus at 48kHz
    • dtls=false : disable datagram transport layer security
    • dscp=true : enable DSCP
    • ipv6=true : enable IPv6

    AppRTC’s source code is available here. And here is the file with the parameters (in case you want to check if they have changed).

    Have fun playing with the main and always up-to-date WebRTC application : AppRTC.

    UPDATE 12 May 2014

    AppRTC now also supports the following bitrate controls :

    • arbr=[bitrate] : set audio receive bitrate
    • asbr=[bitrate] : set audio send bitrate
    • vsbr=[bitrate] : set video receive bitrate
    • vrbr=[bitrate] : set video send bitrate

    Example usage : https://apprtc.appspot.com/?r=&asbr=128&vsbr=4096&hd=true

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