Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

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

Autres articles (112)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs

    12 avril 2011, par

    La manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
    Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.

Sur d’autres sites (6614)

  • FFmpeg : Encoder did not produce proper pts, making some up

    22 novembre 2022, par Chroluma

    I'm trying to convert a yuv image to jpg format via FFmpeg. But I occured [image2 @ 0x38750] Encoder did not produce proper pts, making some up. while the program was encoding. I looked up some references that someone said avcodec_send_frame can only be used when the frames is more than one. Can I use this way to achieve image conversion ? Here is my code :

    


    int ff_yuv422P_to_jpeg(int imgWidth, int imgHeight, uint8_t* yuvData, int yuvLength)
{
    /* ===== define ===== */
    const char* OutputFileName = "img.jpg";
    int retval = 0;

    /* ===== context ===== */
    struct AVFormatContext* pFormatCtx = avformat_alloc_context();
    avformat_alloc_output_context2(&pFormatCtx, NULL, NULL, OutputFileName);
    struct AVOutputFormat* fmt = pFormatCtx->oformat;

    struct AVStream* video_st = avformat_new_stream(pFormatCtx, 0);
    if (!video_st)
    {
        retval = 1;
        perror("ff_yuv422_to_jpeg(): avformat_new_stream");
        goto out_close_ctx;
    }

    /* ===== codec ===== */
    struct AVCodecContext* pCodecCtx = avcodec_alloc_context3(NULL);
    if (avcodec_parameters_to_context(pCodecCtx, video_st->codecpar) < 0)
    {
        retval = 2;
        perror("ff_yuv422_to_jpeg(): avcodec_parameters_to_context");
        goto out_close_ctx;
    }

    pCodecCtx->codec_id = fmt->video_codec;
    pCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
    pCodecCtx->pix_fmt = AV_PIX_FMT_YUVJ422P;
    pCodecCtx->width = imgWidth;
    pCodecCtx->height = imgHeight;
    pCodecCtx->time_base.num = 1;
    pCodecCtx->time_base.den = 25;

    //dump info
    av_dump_format(pFormatCtx, 0, OutputFileName, 1);

    struct AVCodec *pCodec = avcodec_find_encoder(pCodecCtx->codec_id);
    if (!pCodec)
    {
        retval = 3;
        perror("ff_yuv422_to_jpeg(): avcodec_find_encoder");
        goto out_close_st;
    }

    if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0)
    {
        retval = 4;
        perror("ff_yuv422_to_jpeg(): avcodec_open2");
        goto out_close_st;
    }

    /* ===== frame ===== */
    struct AVFrame* pictureFrame = av_frame_alloc();
    pictureFrame->width = pCodecCtx->width;
    pictureFrame->height = pCodecCtx->height;
    pictureFrame->format = AV_PIX_FMT_YUVJ422P;

    int picSize = av_image_get_buffer_size(AV_PIX_FMT_YUVJ422P, pCodecCtx->width, pCodecCtx->height, 1);
    uint8_t* pictureBuffer = (uint8_t*)av_malloc(picSize);
    av_image_fill_arrays(pictureFrame->data, pictureFrame->linesize, pictureBuffer, AV_PIX_FMT_YUVJ422P, pCodecCtx->width, pCodecCtx->height, 1);

    /* ===== write header ===== */
    int notUseRetVal = avformat_write_header(pFormatCtx, NULL);
    
    struct AVPacket* pkt = av_packet_alloc();
    av_new_packet(pkt, imgHeight * imgWidth * 3);
    pictureFrame->data[0] = pictureBuffer + 0 * (yuvLength / 4);
    pictureFrame->data[1] = pictureBuffer + 2 * (yuvLength / 4);
    pictureFrame->data[2] = pictureBuffer + 3 * (yuvLength / 4);

    /* ===== encode ===== */
    int ret = avcodec_send_frame(pCodecCtx, pictureFrame);
    while (ret >= 0)
    {
        pkt->stream_index = video_st->index;
        ret = avcodec_receive_packet(pCodecCtx, pkt);
        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
        {
            retval = 5;
            perror("ff_yuv422_to_jpeg(): avcodec_receive_packet");
            goto out_close_picture;
        }
        else if (ret < 0)
        {
            retval = 6;
            perror("ff_yuv422_to_jpeg(): avcodec_receive_packet ret < 0");
            goto out_close_picture;
        }
        av_write_frame(pFormatCtx, pkt);
    }
    av_packet_unref(pkt);

    /* ===== write trailer ===== */
    av_write_trailer(pFormatCtx);

#if Print_Debug_Info
    printf("yuv2jpg Encode Success.\n");
#endif

out_close_picture:
    if (pictureFrame) av_free(pictureFrame);
    if (pictureBuffer) av_free(pictureBuffer);

out_close_st:
    // old school
    // if (video_st) avcodec_close(video_st->codec);

out_close_ctx:
    if (pFormatCtx) avformat_free_context(pFormatCtx);

out_return:
    return retval;
}


    


    and my log :

    


    Output #0, image2, to 'img.jpg':
    Stream #0:0: Unknown: none
[image2 @ 0x38750] Encoder did not produce proper pts, making some up.
ff_yuv422_to_jpeg(): avcodec_receive_packet: Success


    


    I looked up the avcodec_receive_packet()'s reference, and my code return error code AVERROR(EAGAIN).

    


  • Building C library (FFmpeg) with Android NDK r17 : undefined reference to '__mulodi4'

    14 mai 2018, par fpsulli3

    My problem happens to be with FFmpeg but I suspect that this would happen with almost any C library.

    Problem Description

    My app uses FFmpeg that is compiled with NDK r10e. I am trying to update everything to NDK r17, while also switching to clang, since Google prefers us to use that over gcc.

    My first step is to just build FFmpeg.

    To that end, I have used the make_standalone_toolchain.py script to create a stand-alone toolchain for the x86 architecture, like so :

    make_standalone_toolchain.py --arch x86 --api 21 --install-dir ~/Development/ndk-toolchains/x86

    Then I configure the FFmpeg build as follows :

    TOOLCHAIN_DIR=~/Development/ndk-toolchains/x86

    ./configure \
    --prefix=$(pwd)/android/x86 \
    --cross-prefix=$TOOLCHAIN_DIR/bin/i686-linux-android- \
    --target-os=android \
    --arch=x86 \
    --enable-cross-compile \
    --disable-asm \
    --toolchain=clang-usan \
    --disable-stripping \
    --extra-cflags="-m32" \
    --sysroot=$TOOLCHAIN_DIR/sysroot/

    And then I build it as follows :

    make clean
    make -j4
    make install

    Everything seems to compile fine, but I get several linker errors that all say the same thing :

    undefined reference to ’__mulodi4’

    Solutions I’ve tried

    1. Linking against libclang_rt.builtins*

    I found a few places around the Web which suggested that this is caused by the fact that libgcc doesn’t provide __mulodi4. A github user named sitsofe was nice enough to post a work-around here. However, I am sure where to find this libclang_rt.builtins-i686.a library. Here is what I was able to find in my standalone toolchain directory :

    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-x86_64.a
    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-i386.a
    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-aarch64-android.a
    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-mips64-android.a
    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-x86_64-android.a
    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-i686-android.a
    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-arm-android.a
    ./lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-mips-android.a

    The libclang_rt.builtins-i686-android.a library looks close but (I think) no cigar. When I try to link to it, I get the same error :

    undefined reference to ’__mulodi4’

    Here is my new FFmpeg build config command :

    ./configure \
    --prefix=$(pwd)/android/x86 \
    --cross-prefix=$TOOLCHAIN_DIR/bin/i686-linux-android- \
    --target-os=android \
    --arch=x86 \
    --enable-cross-compile \
    --disable-asm \
    --toolchain=clang-usan \
    --disable-stripping \
    --extra-cflags="-m32" \
    --extra-ldflags="-L${TOOLCHAIN_DIR}/lib64/clang/6.0.2/lib/linux/libclang_rt.builtins-i686-android.a" \
    --sysroot=$TOOLCHAIN_DIR/sysroot/

    I checked with -v to make sure that this line was added to the linker flags, and it was. However, I have no idea if this library should even be expected to work, let alone whether I’m adding it to the linker flags correctly. In any case, what I’m doing here doesn’t work.

    2. Switching to a different sanitizer

    Instead of using the undefined sanitizer, I tried switching to the address sanitizer. This is (frankly) a total stab in the dark, based on a vague mention of asan being available in r17 at Google I/O this week.

    In this case, FFmpeg builds just fine !

    However, when I try to pull FFmpeg into my test project (a simple AAR w/ C++ support, that just has one jni method that calls av_gettime(), I get a ton of linker errors :

    Error:error : undefined reference to ’__asan_option_detect_stack_use_after_return’
    Error:error : undefined reference to ’__asan_stack_malloc_0’
    Error:error : undefined reference to ’__asan_report_load4’
    Error:error : undefined reference to ’__asan_report_load4’
    Error:error : undefined reference to ’__asan_shadow_memory_dynamic_address’
    Error:error : undefined reference to ’__asan_option_detect_stack_use_after_return’
    Error:error : undefined reference to ’__asan_stack_malloc_0’
    Error:error : undefined reference to ’__asan_report_load4’
    Error:error : undefined reference to ’__asan_report_load4’
    Error:error : undefined reference to ’__asan_shadow_memory_dynamic_address’
    Error:error : undefined reference to ’__asan_option_detect_stack_use_after_return’
    Error:error : undefined reference to ’__asan_stack_malloc_0’
    Error:error : undefined reference to ’__asan_report_store4’
    Error:error : undefined reference to ’__asan_report_store4’
    Error:error : undefined reference to ’__asan_init’
    Error:error : undefined reference to ’__asan_version_mismatch_check_v9’

    So it seems to find the FFmpeg library just fine, indicating that that part of my CMake file is correct, but it can’t locate any of these asan references.

    This seems to be a common problem that people are running into, but I can’t see to find a work-around that actually works for me.

  • FFmpeg audio formats : ipod vs mov (for ALAC)

    22 juillet 2022, par Fabien Snauwaert

    In converting to Apple Lossless (ALAC) using FFmpeg, I have two options :

    


    ffmpeg -y -i whatever.wav -b:a 256k -ar 16000 -ac 1 -f ipod -acodec:a alac whatever.ipod.m4a
# Output #0, ipod, to 'content/tests/comparing-codecs/whatever.ipod.m4a':

ffmpeg -y -i whatever.wav -b:a 256k -ar 16000 -ac 1 -f mov -acodec:a alac whatever.mov.m4a
# Output #0, mov, to 'content/tests/comparing-codecs/whatever.mov.m4a':


    


    (I could also leave the -f alone, which the defaults to ipod.)

    


    This results in near identical files, from ffprobe :

    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'content/tests/comparing-codecs/whatever.ipod.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: isomiso2
    encoder         : Lavf58.29.100
  Duration: 00:00:01.46, start: 0.000000, bitrate: 67 kb/s
    Stream #0:0(und): Audio: alac (alac / 0x63616C61), 16000 Hz, mono, s16p, 63 kb/s (default)
    Metadata:
      handler_name    : SoundHandler


    


    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'content/tests/comparing-codecs/whatever.mov.m4a':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.29.100
  Duration: 00:00:01.46, start: 0.000000, bitrate: 67 kb/s
    Stream #0:0: Audio: alac (alac / 0x63616C61), 16000 Hz, mono, s16p, 63 kb/s (default)
    Metadata:
      handler_name    : SoundHandler


    


    Only the file size is slightly different, with the ipod file 43 bytes smaller.

    


    I'm able to play both files in on macOS and iPhone, at least on the devices I had access to.

    


    My question is : is there any practical difference between formats ? Is a given format preferable for a specific use ?