Recherche avancée

Médias (91)

Autres articles (63)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (9057)

  • opusdsp : adjust and optimize C function to match assembly

    15 août 2019, par Lynne
    opusdsp : adjust and optimize C function to match assembly
    

    The C and asm versions behaved differently _outside_ of the codec.

    The C version returned pre-multiplied 'state' for the next execution
    to use right away, while the assembly version outputted non-multiplied
    'state' for the next execution to multiply to save instructions.
    Since the initial state when initialized or seeking is always 0,
    and since C and asm versions were never mixed, there was no issue.

    However, comparing outputs directly in checkasm doesn't work without
    dividing the initial state by CELT_EMPH_COEFF and multiplying the
    returned state by CELT_EMPH_COEFF for the assembly function.

    Since its actually faster to do this in C as well, copy the behavior the
    asm versions use. As a reminder, the initial state 0 is divided by
    CELT_EMPH_COEFF on seek and init (just in case in the future this is
    changed, its technically more correct to init with CELT_EMPH_COEFF than 0,
    however when seeking this will result in more audiable pops, unlike with 0
    where the output gets in sync over a few samples).

    • [DH] libavcodec/opus_celt.c
    • [DH] libavcodec/opusdsp.c
  • How to properly pass an asset FileDescriptor to FFmpeg using JNI in Android

    15 juillet 2014, par William Seemann

    I’m trying to retrieve metadata in Android using FFmpeg, JNI and a Java FileDescriptor and it isn’t’ working. I know FFmpeg supports the pipe protocol so I’m trying to emmulate : "cat test.mp3 | ffmpeg i pipe:0" programmatically. I use the following code to get a FileDescriptor from an asset bundled with the Android application :

    FileDescriptor fd = getContext().getAssets().openFd("test.mp3").getFileDescriptor();
    setDataSource(fd, 0, 0x7ffffffffffffffL); // native function, shown below

    Then, in my native (In C++) code I get the FileDescriptor by calling :

    static void wseemann_media_FFmpegMediaMetadataRetriever_setDataSource(JNIEnv *env, jobject thiz, jobject fileDescriptor, jlong offset, jlong length)
    {
       //...

       int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); // function contents show below

       //...
    }

    // function contents
    static int jniGetFDFromFileDescriptor(JNIEnv * env, jobject fileDescriptor) {
       jint fd = -1;
       jclass fdClass = env->FindClass("java/io/FileDescriptor");

       if (fdClass != NULL) {
           jfieldID fdClassDescriptorFieldID = env->GetFieldID(fdClass, "descriptor", "I");
           if (fdClassDescriptorFieldID != NULL && fileDescriptor != NULL) {
               fd = env->GetIntField(fileDescriptor, fdClassDescriptorFieldID);
           }
       }

       return fd;
    }

    I then pass the file descriptor pipe # (In C) to FFmpeg :

    char path[256] = "";

    FILE *file = fdopen(fd, "rb");

    if (file && (fseek(file, offset, SEEK_SET) == 0)) {
       char str[20];
       sprintf(str, "pipe:%d", fd);
       strcat(path, str);
    }

    State *state = av_mallocz(sizeof(State));
    state->pFormatCtx = NULL;

    if (avformat_open_input(&amp;state->pFormatCtx, path, NULL, &amp;options) != 0) { // Note: path is in the format "pipe:<the fd="fd">"
       printf("Metadata could not be retrieved\n");
       *ps = NULL;
       return FAILURE;
    }

    if (avformat_find_stream_info(state->pFormatCtx, NULL) &lt; 0) {
       printf("Metadata could not be retrieved\n");
       avformat_close_input(&amp;state->pFormatCtx);
       *ps = NULL;
       return FAILURE;
    }

    // Find the first audio and video stream
    for (i = 0; i &lt; state->pFormatCtx->nb_streams; i++) {
       if (state->pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO &amp;&amp; video_index &lt; 0) {
           video_index = i;
       }

       if (state->pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO &amp;&amp; audio_index &lt; 0) {
           audio_index = i;
       }

       set_codec(state->pFormatCtx, i);
    }

    if (audio_index >= 0) {
       stream_component_open(state, audio_index);
    }

    if (video_index >= 0) {
       stream_component_open(state, video_index);
    }

    printf("Found metadata\n");
    AVDictionaryEntry *tag = NULL;
    while ((tag = av_dict_get(state->pFormatCtx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {
       printf("Key %s: \n", tag->key);
       printf("Value %s: \n", tag->value);
    }

    *ps = state;
    return SUCCESS;
    </the>

    My issue is avformat_open_input doesn’t fail but it also doesn’t let me retrieve any metadata or frames, The same code works if I use a regular file URI (e.g file ://sdcard/test.mp3) as the path. What am I doing wrong ? Thanks in advance.

    Note : if you would like to look at all of the code I’m trying to solve the issue in order to provide this functionality for my library : FFmpegMediaMetadataRetriever.

  • How to properly pass an asset FileDescriptor to FFmpeg using JNI in Android

    6 janvier 2021, par William Seemann

    I'm trying to retrieve metadata in Android using FFmpeg, JNI and a Java FileDescriptor and it isn't' working. I know FFmpeg supports the pipe protocol so I'm trying to emmulate : "cat test.mp3 | ffmpeg i pipe:0" programmatically. I use the following code to get a FileDescriptor from an asset bundled with the Android application :

    &#xA;&#xA;

    FileDescriptor fd = getContext().getAssets().openFd("test.mp3").getFileDescriptor();&#xA;setDataSource(fd, 0, 0x7ffffffffffffffL); // native function, shown below&#xA;

    &#xA;&#xA;

    Then, in my native (In C++) code I get the FileDescriptor by calling :

    &#xA;&#xA;

    static void wseemann_media_FFmpegMediaMetadataRetriever_setDataSource(JNIEnv *env, jobject thiz, jobject fileDescriptor, jlong offset, jlong length)&#xA;{&#xA;    //...&#xA;&#xA;    int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); // function contents show below&#xA;&#xA;    //...&#xA;}&#xA;&#xA;// function contents&#xA;static int jniGetFDFromFileDescriptor(JNIEnv * env, jobject fileDescriptor) {&#xA;    jint fd = -1;&#xA;    jclass fdClass = env->FindClass("java/io/FileDescriptor");&#xA;&#xA;    if (fdClass != NULL) {&#xA;        jfieldID fdClassDescriptorFieldID = env->GetFieldID(fdClass, "descriptor", "I");&#xA;        if (fdClassDescriptorFieldID != NULL &amp;&amp; fileDescriptor != NULL) {&#xA;            fd = env->GetIntField(fileDescriptor, fdClassDescriptorFieldID);&#xA;        }&#xA;    }&#xA;&#xA;    return fd;&#xA;}&#xA;

    &#xA;&#xA;

    I then pass the file descriptor pipe # (In C) to FFmpeg :

    &#xA;&#xA;

    char path[256] = "";&#xA;&#xA;FILE *file = fdopen(fd, "rb");&#xA;&#xA;if (file &amp;&amp; (fseek(file, offset, SEEK_SET) == 0)) {&#xA;    char str[20];&#xA;    sprintf(str, "pipe:%d", fd);&#xA;    strcat(path, str);&#xA;}&#xA;&#xA;State *state = av_mallocz(sizeof(State));&#xA;state->pFormatCtx = NULL;&#xA;&#xA;if (avformat_open_input(&amp;state->pFormatCtx, path, NULL, &amp;options) != 0) { // Note: path is in the format "pipe:<the fd="fd">"&#xA;    printf("Metadata could not be retrieved\n");&#xA;    *ps = NULL;&#xA;    return FAILURE;&#xA;}&#xA;&#xA;if (avformat_find_stream_info(state->pFormatCtx, NULL) &lt; 0) {&#xA;    printf("Metadata could not be retrieved\n");&#xA;    avformat_close_input(&amp;state->pFormatCtx);&#xA;    *ps = NULL;&#xA;    return FAILURE;&#xA;}&#xA;&#xA;// Find the first audio and video stream&#xA;for (i = 0; i &lt; state->pFormatCtx->nb_streams; i&#x2B;&#x2B;) {&#xA;    if (state->pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO &amp;&amp; video_index &lt; 0) {&#xA;        video_index = i;&#xA;    }&#xA;&#xA;    if (state->pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO &amp;&amp; audio_index &lt; 0) {&#xA;        audio_index = i;&#xA;    }&#xA;&#xA;    set_codec(state->pFormatCtx, i);&#xA;}&#xA;&#xA;if (audio_index >= 0) {&#xA;    stream_component_open(state, audio_index);&#xA;}&#xA;&#xA;if (video_index >= 0) {&#xA;    stream_component_open(state, video_index);&#xA;}&#xA;&#xA;printf("Found metadata\n");&#xA;AVDictionaryEntry *tag = NULL;&#xA;while ((tag = av_dict_get(state->pFormatCtx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) {&#xA;    printf("Key %s: \n", tag->key);&#xA;    printf("Value %s: \n", tag->value);&#xA;}&#xA;&#xA;*ps = state;&#xA;return SUCCESS;&#xA;</the>

    &#xA;&#xA;

    My issue is avformat_open_input doesn't fail but it also doesn't let me retrieve any metadata or frames, The same code works if I use a regular file URI (e.g file ://sdcard/test.mp3) as the path. What am I doing wrong ? Thanks in advance.

    &#xA;&#xA;

    Note : if you would like to look at all of the code I'm trying to solve the issue in order to provide this functionality for my library : FFmpegMediaMetadataRetriever.

    &#xA;